Struct native_windows_gui::NumberSelect
source · [−]pub struct NumberSelect {
pub handle: ControlHandle,
/* private fields */
}
Expand description
A NumberSelect control is a pair of arrow buttons that the user can click to increment or decrement a value. NumberSelect is implemented as a custom control because the one provided by winapi really sucks.
Requires the number-select
feature.
Builder parameters:
parent
: Required. The number select parent container.value
: The default value of the number selectsize
: The number select size.position
: The number select position.enabled
: If the number select can be used by the user. It also has a grayed out look if disabled.flags
: A combination of the NumberSelectFlags values.font
: The font used for the number select text
Control events:
MousePress(_)
: Generic mouse press events on the buttonOnMouseMove
: Generic mouse mouse event
use native_windows_gui as nwg;
fn build_number_select(num_select: &mut nwg::NumberSelect, window: &nwg::Window, font: &nwg::Font) {
nwg::NumberSelect::builder()
.font(Some(font))
.parent(window)
.build(num_select);
}
Fields
handle: ControlHandle
Implementations
sourceimpl NumberSelect
impl NumberSelect
pub fn builder<'a>() -> NumberSelectBuilder<'a>
sourcepub fn data(&self) -> NumberSelectData
pub fn data(&self) -> NumberSelectData
Returns inner data specifying the possible input of a number select See NumberSelectData for the possible values
sourcepub fn set_data(&self, v: NumberSelectData)
pub fn set_data(&self, v: NumberSelectData)
Sets the inner data specifying the possible input of a number select. Also update the value display. See NumberSelectData for the possible values
sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Returns true if the control user can interact with the control, return false otherwise
sourcepub fn set_enabled(&self, v: bool)
pub fn set_enabled(&self, v: bool)
Enable or disable the control
sourcepub fn visible(&self) -> bool
pub fn visible(&self) -> bool
Returns true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))
sourcepub fn set_visible(&self, v: bool)
pub fn set_visible(&self, v: bool)
Show or hide the control to the user
sourcepub fn set_position(&self, x: i32, y: i32)
pub fn set_position(&self, x: i32, y: i32)
Sets the position of the control in the parent window
sourcepub fn class_name(&self) -> &'static str
pub fn class_name(&self) -> &'static str
Winapi class name used during control creation
sourcepub fn forced_flags(&self) -> u32
pub fn forced_flags(&self) -> u32
Winapi flags required by the control
Trait Implementations
sourceimpl Default for NumberSelect
impl Default for NumberSelect
sourcefn default() -> NumberSelect
fn default() -> NumberSelect
Returns the “default value” for a type. Read more
sourceimpl Drop for NumberSelect
impl Drop for NumberSelect
sourceimpl From<&NumberSelect> for ControlHandle
impl From<&NumberSelect> for ControlHandle
sourcefn from(control: &NumberSelect) -> Self
fn from(control: &NumberSelect) -> Self
Converts to this type from the input type.
sourceimpl From<&mut NumberSelect> for ControlHandle
impl From<&mut NumberSelect> for ControlHandle
sourcefn from(control: &mut NumberSelect) -> Self
fn from(control: &mut NumberSelect) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<ControlHandle> for NumberSelect
impl PartialEq<ControlHandle> for NumberSelect
sourcefn eq(&self, other: &ControlHandle) -> bool
fn eq(&self, other: &ControlHandle) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialEq<NumberSelect> for ControlHandle
impl PartialEq<NumberSelect> for ControlHandle
sourcefn eq(&self, other: &NumberSelect) -> bool
fn eq(&self, other: &NumberSelect) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for NumberSelect
impl !Send for NumberSelect
impl !Sync for NumberSelect
impl Unpin for NumberSelect
impl !UnwindSafe for NumberSelect
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more