Struct fltk::menu::MenuItem[][src]

pub struct MenuItem { /* fields omitted */ }
Expand description

Creates a menu item

Implementations

impl MenuItem[src]

pub fn new(choices: &[&'static str]) -> MenuItem[src]

Initializes a new window, useful for popup menus

pub fn popup(&self, x: i32, y: i32) -> Option<MenuItem>[src]

Creates a popup menu at the specified coordinates and returns its choice

pub fn label(&self) -> Option<String>[src]

Returns the label of the menu item

pub fn set_label(&mut self, txt: &str)[src]

Sets the label of the menu item

pub fn label_type(&self) -> LabelType[src]

Returns the label type of the menu item

pub fn set_label_type(&mut self, typ: LabelType)[src]

Sets the label type of the menu item

pub fn label_color(&self) -> Color[src]

Returns the label color of the menu item

pub fn set_label_color(&mut self, color: Color)[src]

Sets the label color of the menu item

pub fn label_font(&self) -> Font[src]

Returns the label font of the menu item

pub fn set_label_font(&mut self, font: Font)[src]

Sets the label font of the menu item

pub fn label_size(&self) -> i32[src]

Returns the label size of the menu item

pub fn set_label_size(&mut self, sz: i32)[src]

Sets the label size of the menu item

pub fn value(&self) -> bool[src]

Returns the value of the menu item

pub fn set(&mut self)[src]

Sets the menu item

pub fn clear(&mut self)[src]

Clears the menu item

pub fn visible(&self) -> bool[src]

Returns whether the menu item is visible or not

pub fn active(&mut self) -> bool[src]

Returns whether the menu item is active

pub fn activate(&mut self)[src]

Activates the menu item

pub fn deactivate(&mut self)[src]

Deactivates the menu item

pub fn is_submenu(&self) -> bool[src]

Returns whether a menu item is a submenu

pub fn is_checkbox(&self) -> bool[src]

Returns whether a menu item is a checkbox

pub fn is_radio(&self) -> bool[src]

Returns whether a menu item is a radio item

pub fn show(&mut self)[src]

Shows the menu item

pub fn hide(&mut self)[src]

Hides the menu item

pub fn next(&self, idx: i32) -> Option<MenuItem>[src]

Get the next menu item

pub fn children(&self) -> i32[src]

Get children of MenuItem

pub fn at(&self, idx: i32) -> Option<MenuItem>[src]

Get the menu item at idx

pub unsafe fn user_data(&self) -> Option<Box<dyn FnMut()>>[src]

Get the user data

Safety

Can return multiple mutable instances of the user data, which has a different lifetime than the object

pub fn set_callback<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)[src]

Set a callback for the menu item

pub fn emit<T: 'static + Clone + Send + Sync>(
    &mut self,
    sender: Sender<T>,
    msg: T
)
[src]

Use a sender to send a message during callback

pub fn was_deleted(&self) -> bool[src]

Check if a menu item was deleted

pub fn draw<M: MenuExt>(
    &self,
    x: i32,
    y: i32,
    w: i32,
    h: i32,
    menu: &M,
    selected: bool
)
[src]

Draw a box around the menu item. Requires the call to be made inside a MenuExt-implementing widget’s own draw method

pub fn measure(&self) -> (i32, i32)[src]

Measure the width and height of a menu item

pub unsafe fn set_image<I: ImageExt>(&mut self, image: I)[src]

Set the image of the menu item

Safety

Trying to add a label after adding an image might lead to undefined behavior

Trait Implementations

impl Clone for MenuItem[src]

fn clone(&self) -> MenuItem[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for MenuItem[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl IntoIterator for MenuItem[src]

type Item = MenuItem

The type of the elements being iterated over.

type IntoIter = IntoIter<Self::Item>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl Send for MenuItem[src]

impl Sync for MenuItem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.