Macro native_windows_gui::nwg_template
[−]
[src]
macro_rules! nwg_template { ( head: $n:ident<$t:ty>, controls: [ $( ($i1:expr, $c:expr) ),* ]; events: [ $( ($i4:expr, $i5:expr, $e:expr, $b:expr) ),* ]; resources: [ $( ($i2:expr, $r:expr) ),* ]; values: [ $( ($i3:expr, $v:expr) ),* ] ) => { ... }; }
Generates a function that initialize the content of a UI.
head: Define the name of the function and Ui key type. Ex: my_function<my_type>
controls: A list of controls to add to the Ui. Accepts an array of (ID, Template)
events: A list of events to bind to the controls of the UI. Accepts an array of (ControlID, EventID, Event, Callback)
resources: A list of resources to add to the Ui. Accepts an array of (ID, Template)
values: A list of user values to add to the Ui. Accepts an array of (ID, Template)
Return Value: The function calls commit
before returning. If the Ui initialization fails,
the function will return the error.
Usage:
nwg_template!( head: setup_ui<&'static str>, controls: [ ("TEST", Control), ("TEST2", Control) ], events: [ ("TEST", "ACTION", Event::Click, |ui, caller, event, args| { println!("Hello World!"); }) ], resources: [ ("Font1", Font1), ("Font1", Font1) ], values: [ ("True", true), ("()", ()) ] );