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

pub unsafe trait MenuExt: WidgetExt {
    fn find_item(&self, name: &str) -> Option<MenuItem>;
fn set_item(&mut self, item: &MenuItem) -> bool;
fn text_font(&self) -> Font;
fn set_text_font(&mut self, c: Font);
fn text_size(&self) -> u32;
fn set_text_size(&mut self, c: u32);
fn text_color(&self) -> Color;
fn set_text_color(&mut self, c: Color);
fn add(
        &mut self,
        name: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: Box<dyn FnMut()>
    );
fn insert(
        &mut self,
        idx: u32,
        name: &str,
        shortcut: Shortcut,
        flag: MenuFlag,
        cb: Box<dyn FnMut()>
    );
fn add_choice(&mut self, text: &str);
fn choice(&self) -> Option<String>;
fn value(&self) -> i32;
fn set_value(&mut self, v: i32) -> bool;
fn clear(&mut self);
fn clear_submenu(&mut self, idx: u32) -> Result<(), FltkError>; }

Defines the methods implemented by all menu widgets

Required methods

fn find_item(&self, name: &str) -> Option<MenuItem>

Get a menu item by name

fn set_item(&mut self, item: &MenuItem) -> bool

Set selected item

fn text_font(&self) -> Font

Return the text font

fn set_text_font(&mut self, c: Font)

Sets the text font

fn text_size(&self) -> u32

Return the text size

fn set_text_size(&mut self, c: u32)

Sets the text size

fn text_color(&self) -> Color

Return the text color

fn set_text_color(&mut self, c: Color)

Sets the text color

fn add(
    &mut self,
    name: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: Box<dyn FnMut()>
)

Add a menu item along with its callback

fn insert(
    &mut self,
    idx: u32,
    name: &str,
    shortcut: Shortcut,
    flag: MenuFlag,
    cb: Box<dyn FnMut()>
)

Inserts a menu item at an index along with its callback

fn add_choice(&mut self, text: &str)

Adds a simple text option to the Choice and MenuButton widgets

fn choice(&self) -> Option<String>

Gets the user choice from the Choice and MenuButton widgets

fn value(&self) -> i32

Get index into menu of the last item chosen

fn set_value(&mut self, v: i32) -> bool

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

fn clear(&mut self)

Clears the items in a menu

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

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

Loading content...

Implementors

impl MenuExt for Choice[src]

impl MenuExt for MenuBar[src]

impl MenuExt for MenuButton[src]

Loading content...