File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 3
3
Example for how to create a base widget which exposes virtual methods that other widgets can override.
4
4
In this case, a ` BaseButton ` class is defined which is a gtk::Button with two additional methods:
5
5
6
- * ` sync_method ` : Synchonous method that updates the button label to ` BaseButton sync ` , or ` BaseButton sync {} `
7
- where {} is replaced with the ` extra_text ` parameter, if it's ` Some ` . This demos how arguments
6
+ * ` sync_method ` : Synchronous method that updates the button label to ` BaseButton sync ` , or ` BaseButton sync {} `
7
+ where {} is replaced with the ` extra_text ` parameter, if it's ` Some ` . This showcases how arguments
8
8
can be added to virtual methods. The ` Option<String> ` has to be boxed to be FFI-safe.
9
- * ` async_method ` ` Asynchronous method that updates the button label to ` BaseButton async`
9
+ * ` async_method ` : Asynchronous method that updates the button label to ` BaseButton async `
10
10
11
11
` DerivedButton ` overrides the two methods. During construction ` sync_method ` is called in
12
12
` BaseButton ` which will set the label to ` BaseButton sync ` for ` BaseButton ` and to
13
- ` DerivedButton sync ` for ` DerivedButton ` . In the ` VirtualMethodsWindow ` ` connect_clicked ` is
14
- called on both buttons and ` async_method ` is called on both of them and updates their
15
- label accordingly when clicking the button.
13
+ ` DerivedButton sync ` for ` DerivedButton ` . In the ` VirtualMethodsWindow ` , ` connect_clicked ` is
14
+ called on both buttons. Each handler for ` ::clicked ` will invoke the respective ` async_method ` .
15
+ This updates the button's label accordingly when clicking it.
You can’t perform that action at this time.
0 commit comments