Skip to content

Commit 88434ab

Browse files
authored
Merge pull request #51 from barzamin/35-enable-disable-controls
Enable/disable controls
2 parents b43042c + 4ff7f75 commit 88434ab

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
99
### Added
1010

1111
- `ProgressBar` control for tracking the completion of a task
12+
- `enable()` and `disable()` methods on all controls
1213
- `RadioButtons` control for groups of radio buttons
1314
- `Combobox::selected()` method to retrieve the currently selected index of the combobox
1415

iui/src/controls/create_macro.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ macro_rules! define_control {
5555
unsafe { ui_sys::uiControlHide(control.ui_control) }
5656
}
5757

58+
// Enable this control.
59+
pub fn enable(&mut self, _ctx: &UI) {
60+
let control: Control = self.clone().into();
61+
unsafe { ui_sys::uiControlEnable(control.ui_control) }
62+
}
63+
64+
// Disable this control.
65+
pub fn disable(&mut self, _ctx: &UI) {
66+
let control: Control = self.clone().into();
67+
unsafe { ui_sys::uiControlDisable(control.ui_control) }
68+
}
69+
5870
/// Create an `iui` struct for this control from the raw pointer for it.
5971
///
6072
/// # Unsafety

0 commit comments

Comments
 (0)