-
Notifications
You must be signed in to change notification settings - Fork 1
Object
Since this is a GUI toolkit, it makes sense to have a system of signals and callbacks. That means, for example, when you click on a Button widget, an event is fired. Callbacks wait for the event to be signaled, and are then executed. Inheriting from [[suit]].Object
gives the power to connect callback functions to your object while you can emit whichever ones you want.
This is not to be messed with. It contains a mapping of the names of signals to the callbacks that are connected to them.
Object->connect( (string) signal, (function) fn, (mixed) custom... )
Use this to connect a callback to a signal. For example, you can use this code to increase a counter when a button is activated:
var counter = {value: 0};
var button = new suit.Button("Test");
button.connect("activate", function(counter) {
counter.value++;
}, counter);
`Object->disconnect( (string) signal, (function) fn )```
Use this to remove a callback once one has been added.
button.disconnect("activate", my_counter_function);
Object->emit( (string) signal, (mixed) custom...)
Use this to emit a signal, therefore calling each of the callbacks that are connected with the signal. You may add custom arguments which are pushed to the front of the argument list of the callback function.
button.emit("activate");
[[suit]].Object
+--- [[suit]].[[Widget]]