Struct native_windows_gui::Label
source · [−]pub struct Label {
pub handle: ControlHandle,
/* private fields */
}
Expand description
A label is a single line of static text. Use \r\n
to split the text on multiple lines.
Label is not behind any features.
Builder parameters:
parent
: Required. The label parent container.text
: The label text.size
: The label size.position
: The label position.enabled
: If the label is enabled. A disabled label won’t trigger eventsflags
: A combination of the LabelFlags values.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapifont
: The font used for the label textbackground_color
: The background color of the labelh_align
: The horizontal aligment of the label
Control events:
OnLabelClick
: When the user click the labelOnLabelDoubleClick
: When the user double click a labelMousePress(_)
: Generic mouse press events on the labelOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel event
** Example **
use native_windows_gui as nwg;
fn build_label(label: &mut nwg::Label, window: &nwg::Window, font: &nwg::Font) {
nwg::Label::builder()
.text("Hello")
.font(Some(font))
.parent(window)
.build(label);
}
Fields
handle: ControlHandle
Implementations
sourceimpl Label
impl Label
pub fn builder<'a>() -> LabelBuilder<'a>
sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Return 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
Return 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)
Set the position of the label 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 From<&Label> for ControlHandle
impl From<&Label> for ControlHandle
sourceimpl From<&mut Label> for ControlHandle
impl From<&mut Label> for ControlHandle
sourceimpl PartialEq<ControlHandle> for Label
impl PartialEq<ControlHandle> for Label
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<Label> for ControlHandle
impl PartialEq<Label> for ControlHandle
Auto Trait Implementations
impl !RefUnwindSafe for Label
impl !Send for Label
impl !Sync for Label
impl Unpin for Label
impl UnwindSafe for Label
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