Subject: [PATCH 0013] linux: Enable/disable (grey out) a control --- a/cpp_src/widgets_bridge.cpp +++ b/cpp_src/widgets_bridge.cpp @@ -945,6 +945,11 @@ ((wxCheckBox*)win)->SetValue(v != 0); } +// Enable or disable (grey out) any window/control. +void wxbr_enable(void* win, int on) { + ((wxWindow*)win)->Enable(on != 0); +} + // ---- check list box --------------------------------------------------------- void* wxbr_check_list_box(void* parent) { --- a/src/widgets.rs +++ b/src/widgets.rs @@ -49,6 +49,7 @@ pub fn wxbr_check_box(parent: *mut c_void, label: *const c_char) -> *mut c_void; pub fn wxbr_check_box_get(win: *mut c_void) -> c_int; pub fn wxbr_check_box_set(win: *mut c_void, v: c_int); + pub fn wxbr_enable(win: *mut c_void, on: c_int); pub fn wxbr_check_list_box(parent: *mut c_void) -> *mut c_void; pub fn wxbr_clb_append(win: *mut c_void, label: *const c_char); pub fn wxbr_clb_clear(win: *mut c_void); @@ -508,6 +509,11 @@ unsafe { notsafe::wxbr_check_box_set(self.0, v as c_int) } } + /// Enable or disable (grey out) this control. + pub fn set_enabled(&self, on: bool) { + unsafe { notsafe::wxbr_enable(self.0, on as c_int) } + } + pub fn check_list_box(parent: Widget) -> Widget { Widget(unsafe { notsafe::wxbr_check_list_box(parent.0) }) }