Struct native_windows_gui::Label [−][src]
pub struct Label { pub handle: ControlHandle, // some fields omitted }
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
impl Label
[src]
pub fn builder<'a>() -> LabelBuilder<'a>
[src]
pub fn font(&self) -> Option<Font>
[src]
Return the font of the control
pub fn set_font(&self, font: Option<&Font>)
[src]
Set the font of the control
pub fn focus(&self) -> bool
[src]
Return true if the control currently has the keyboard focus
pub fn set_focus(&self)
[src]
Set the keyboard focus on the button.
pub fn enabled(&self) -> bool
[src]
Return true if the control user can interact with the control, return false otherwise
pub fn set_enabled(&self, v: bool)
[src]
Enable or disable the control
pub fn visible(&self) -> bool
[src]
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))
pub fn set_visible(&self, v: bool)
[src]
Show or hide the control to the user
pub fn size(&self) -> (u32, u32)
[src]
Return the size of the label in the parent window
pub fn set_size(&self, x: u32, y: u32)
[src]
Set the size of the label in the parent window
pub fn position(&self) -> (i32, i32)
[src]
Return the position of the label in the parent window
pub fn set_position(&self, x: i32, y: i32)
[src]
Set the position of the label in the parent window
pub fn text(&self) -> String
[src]
Return the label text
pub fn set_text<'a>(&self, v: &'a str)
[src]
Set the label text
pub fn class_name(&self) -> &'static str
[src]
Winapi class name used during control creation
pub fn flags(&self) -> u32
[src]
Winapi base flags used during window creation
pub fn forced_flags(&self) -> u32
[src]
Winapi flags required by the control
Trait Implementations
impl Default for Label
[src]
impl Drop for Label
[src]
impl From<&'_ Label> for ControlHandle
[src]
impl From<&'_ mut Label> for ControlHandle
[src]
impl PartialEq<ControlHandle> for Label
[src]
fn eq(&self, other: &ControlHandle) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Label> for Label
[src]
impl PartialEq<Label> for ControlHandle
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,