#include <ucall.hpp>
Inheritance diagram for UGenCallImpl:
UClass is never instanciated nor used directly. Instead, you must use a variety of ucall( ) or uset( ) functions as explained below.
a) Calling non-member functions
ubutton("Click Me" + UOn::action / ucall(arg, func1))
ubutton("Click Me" + ucallref(arg1, arg2, func2))
b) Calling member functions (ie. "methods")
ucheckbox("Select Me" + UOn::select / ucall(obj, &Myclass::memfunc1))
uhbox("Press Me" + UOn::mpress / ucallref(obj, arg1, arg2, &Myclass::memfunc2)
c) Adding callbacks after object creation
This can be done by using the add( ) method:
UBox& b = ubutton("Click Me");
b.add(UOn::mclick / ucall(....));
d) Callback Prototypes
They must have the same arguments as those that are passed to ucall(). Note that the types must be IDENTICAL. Prototypes can also have an optional UEvent& argument (which must be the first argument when present).
Exemples:
void func1(bool state) { ...}
or:
void func1(UEvent& e, bool state) { ...}
ucheckbox("Select Me"
+ UOn::select / ucall(true, func1)
+ UOn::unselect / ucall(false, func1)
);
void MyClass::memfunc2(UColor& fg, UBgolor& bg) { ...}
or:
void MyClass::memfunc2(UEvent& e, UColor& fg, UBgolor& bg) { ...}
MyClass* obj = new MyClass();
UColor& col1 = ...;
UBgcolor& col2 = ...;
ubutton("Click Me" + ucallref(obj, col1, col2, &Myclass::memfunc2);
Examples:
UStr s1; UStr s2 = "toto";
ubutton("Press Me" + UOn::mpress / uset(&a, &b)) or: ubutton("Press Me" + UOn::mpress / usetref(&a, b))
Example: the dialog will be closed when the "Close" button is clicked or released:
udialog( ... + ubutton("Close" + ucloseWin()) + ... ) udialog( ... + ubutton("Close" + UOn::mrelease / ucloseWin()) + ... )