[][src]Trait fltk::prelude::MenuExt

pub unsafe trait MenuExt: WidgetExt {
    pub fn find_item(&self, name: &str) -> Option<MenuItem>;
pub fn set_item(&mut self, item: &MenuItem) -> bool;
pub fn find_index(&self, label: &str) -> u32;
pub fn text_font(&self) -> Font;
pub fn set_text_font(&mut self, c: Font);
pub fn text_size(&self) -> u32;
pub fn set_text_size(&mut self, c: u32);
pub fn text_color(&self) -> Color;
pub fn set_text_color(&mut self, c: Color);
pub fn add<F: FnMut() + 'static>(
        &mut self,
        label: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: F
    );
pub fn add2<F: FnMut(&mut Self) + 'static>(
        &mut self,
        name: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: F
    );
pub fn insert<F: FnMut() + 'static>(
        &mut self,
        idx: u32,
        label: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: F
    );
pub fn insert2<F: FnMut(&mut Self) + 'static>(
        &mut self,
        idx: u32,
        name: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: F
    );
pub fn add_emit<T: 'static + Copy + Send + Sync>(
        &mut self,
        label: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        sender: Sender<T>,
        msg: T
    );
pub fn insert_emit<T: 'static + Copy + Send + Sync>(
        &mut self,
        idx: u32,
        label: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        sender: Sender<T>,
        msg: T
    );
pub fn remove(&mut self, idx: u32);
pub fn add_choice(&mut self, text: &str);
pub fn choice(&self) -> Option<String>;
pub fn value(&self) -> i32;
pub fn set_value(&mut self, v: i32) -> bool;
pub fn clear(&mut self);
pub fn clear_submenu(&mut self, idx: u32) -> Result<(), FltkError>;
pub unsafe fn unsafe_clear(&mut self);
pub unsafe fn unsafe_clear_submenu(
        &mut self,
        idx: u32
    ) -> Result<(), FltkError>;
pub fn size(&self) -> u32;
pub fn text(&self, idx: u32) -> Option<String>;
pub fn at(&self, idx: u32) -> Option<MenuItem>;
pub fn mode(&self, idx: u32) -> MenuFlag;
pub fn set_mode(&mut self, idx: u32, flag: MenuFlag); }

Defines the methods implemented by all menu widgets

Required methods

pub fn find_item(&self, name: &str) -> Option<MenuItem>[src]

Get a menu item by name

pub fn set_item(&mut self, item: &MenuItem) -> bool[src]

Set selected item

pub fn find_index(&self, label: &str) -> u32[src]

Find an item's index by its label

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

Return the text font

pub fn set_text_font(&mut self, c: Font)[src]

Sets the text font

pub fn text_size(&self) -> u32[src]

Return the text size

pub fn set_text_size(&mut self, c: u32)[src]

Sets the text size

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

Return the text color

pub fn set_text_color(&mut self, c: Color)[src]

Sets the text color

pub fn add<F: FnMut() + 'static>(
    &mut self,
    label: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: F
)
[src]

Add a menu item along with its callback The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item.

pub fn add2<F: FnMut(&mut Self) + 'static>(
    &mut self,
    name: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: F
)
[src]

Add a menu item along with its callback The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item. Takes the menu item as a closure argument

pub fn insert<F: FnMut() + 'static>(
    &mut self,
    idx: u32,
    label: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: F
)
[src]

Inserts a menu item at an index along with its callback The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item.

pub fn insert2<F: FnMut(&mut Self) + 'static>(
    &mut self,
    idx: u32,
    name: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: F
)
[src]

Inserts a menu item at an index along with its callback The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item. Takes the menu item as a closure argument

pub fn add_emit<T: 'static + Copy + Send + Sync>(
    &mut self,
    label: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    sender: Sender<T>,
    msg: T
)
[src]

Add a menu item along with an emit (sender and message) The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item.

pub fn insert_emit<T: 'static + Copy + Send + Sync>(
    &mut self,
    idx: u32,
    label: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    sender: Sender<T>,
    msg: T
)
[src]

Inserts a menu item along with an emit (sender and message) The characters "&", "/", "\", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item.

pub fn remove(&mut self, idx: u32)[src]

Remove a menu item by index

pub fn add_choice(&mut self, text: &str)[src]

Adds a simple text option to the Choice and MenuButton widgets The characters "&", "/", "\", "|", and "" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "" character cause a divider to be placed after that menu item.

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

Gets the user choice from the Choice and MenuButton widgets

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

Get index into menu of the last item chosen, returns -1 if no item was chosen

pub fn set_value(&mut self, v: i32) -> bool[src]

Set index into menu of the last item chosen,return true if the new value is different than the old one

pub fn clear(&mut self)[src]

Clears the items in a menu, effectively deleting them.

pub fn clear_submenu(&mut self, idx: u32) -> Result<(), FltkError>[src]

Clears a submenu by index, failure return FltkErrorKind::FailedOperation

pub unsafe fn unsafe_clear(&mut self)[src]

Clears the items in a menu, effectively deleting them, and recursively force-cleans capturing callbacks

Safety

Deletes user_data and any captured objects in the callback

pub unsafe fn unsafe_clear_submenu(&mut self, idx: u32) -> Result<(), FltkError>[src]

Clears a submenu by index, failure return FltkErrorKind::FailedOperation. Also recursively force-cleans capturing callbacks

Safety

Deletes user_data and any captured objects in the callback

pub fn size(&self) -> u32[src]

Get the size of the menu widget

pub fn text(&self, idx: u32) -> Option<String>[src]

Get the text label of the menu item at index idx

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

Get the menu item at an index

pub fn mode(&self, idx: u32) -> MenuFlag[src]

Set the mode of a menu item by index and flag

pub fn set_mode(&mut self, idx: u32, flag: MenuFlag)[src]

Get the mode of a menu item

Loading content...

Implementors

impl MenuExt for Choice[src]

impl MenuExt for MenuBar[src]

impl MenuExt for MenuButton[src]

impl MenuExt for SysMenuBar[src]

Loading content...