[][src]Trait fltk::prelude::WidgetExt

pub unsafe trait WidgetExt {
    fn new(x: i32, y: i32, width: i32, height: i32, title: &str) -> Self;
fn default() -> Self;
fn with_pos(self, x: i32, y: i32) -> Self;
fn with_size(self, width: i32, height: i32) -> Self;
fn set_pos(&mut self, x: i32, y: i32);
fn set_size(&mut self, width: i32, height: i32);
fn with_label(self, title: &str) -> Self;
fn with_align(self, align: Align) -> Self;
fn below_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self;
fn above_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self;
fn right_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self;
fn left_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self;
fn center_of<W: WidgetExt>(self, w: &W) -> Self;
fn size_of<W: WidgetExt>(self, w: &W) -> Self;
fn set_label(&mut self, title: &str);
fn redraw(&mut self);
fn show(&mut self);
fn hide(&mut self);
fn x(&self) -> i32;
fn y(&self) -> i32;
fn width(&self) -> i32;
fn height(&self) -> i32;
fn label(&self) -> String;
unsafe fn as_widget_ptr(&self) -> *mut Fl_Widget;
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self;
fn activate(&mut self);
fn deactivate(&mut self);
fn redraw_label(&mut self);
fn resize(&mut self, x: i32, y: i32, width: i32, height: i32);
fn tooltip(&self) -> Option<String>;
fn set_tooltip(&mut self, txt: &str);
fn get_type<T: WidgetType>(&self) -> T;
fn set_type<T: WidgetType>(&mut self, typ: T);
fn color(&self) -> Color;
fn set_color(&mut self, color: Color);
fn label_color(&self) -> Color;
fn set_label_color(&mut self, color: Color);
fn label_font(&self) -> Font;
fn set_label_font(&mut self, font: Font);
fn label_size(&self) -> i32;
fn set_label_size(&mut self, sz: i32);
fn label_type(&self) -> LabelType;
fn set_label_type(&mut self, typ: LabelType);
fn frame(&self) -> FrameType;
fn set_frame(&mut self, typ: FrameType);
fn changed(&self) -> bool;
fn set_changed(&mut self);
fn clear_changed(&mut self);
fn align(&self) -> Align;
fn set_align(&mut self, align: Align);
fn set_image<I: ImageExt>(&mut self, image: Option<I>);
fn image(&self) -> Option<Image>;
fn set_deimage<I: ImageExt>(&mut self, image: Option<I>);
fn deimage(&self) -> Option<Image>;
fn set_callback(&mut self, cb: Box<dyn FnMut()>);
fn handle(&mut self, cb: Box<dyn FnMut(Event) -> bool>);
fn set_trigger(&mut self, trigger: CallbackTrigger);
fn draw(&mut self, cb: Box<dyn FnMut()>);
fn parent(&self) -> Option<Widget>;
fn selection_color(&mut self) -> Color;
fn set_selection_color(&mut self, color: Color);
fn do_callback(&mut self);
fn inside(&self, wid: Widget) -> bool;
fn window(&self) -> Option<Window>;
fn top_window(&self) -> Option<Window>;
fn takes_events(&self) -> bool;
fn emit<T: 'static + Copy + Send + Sync>(
        &mut self,
        sender: Sender<T>,
        msg: T
    );
fn take_focus(&mut self) -> Result<(), FltkError>;
fn set_visible_focus(&mut self);
fn clear_visible_focus(&mut self);
fn visible_focus(&mut self, v: bool);
fn has_visible_focus(&mut self) -> bool;
fn delete(&mut self);
unsafe fn unsafe_delete(&mut self);
fn was_deleted(&self) -> bool;
fn damage(&self) -> bool;
fn set_damage(&mut self, flag: bool);
fn clear_damage(&mut self);
fn as_window(&mut self) -> Option<Window>;
fn as_group(&mut self) -> Option<Group>;
unsafe fn user_data(&self) -> Option<Box<dyn FnMut()>>;
unsafe fn set_user_data(&mut self, data: *mut c_void);
unsafe fn raw_user_data(&self) -> *mut c_void;
unsafe fn cleanup(&mut self);
unsafe fn unset_callback(&mut self);
unsafe fn draw_data(&mut self) -> Option<Box<dyn FnMut()>>;
unsafe fn set_draw_data(&mut self, data: *mut c_void);
unsafe fn unset_draw_callback(&mut self); }

Defines the methods implemented by all widgets

Required methods

fn new(x: i32, y: i32, width: i32, height: i32, title: &str) -> Self

Creates a new widget, takes an x, y coordinates, as well as a width and height, plus a title

Arguments

  • x - The x coordinate in the screen
  • y - The y coordinate in the screen
  • width - The width of the widget
  • heigth - The height of the widget
  • title - The title or label of the widget

fn default() -> Self

Creates a default and zero initialized widget

fn with_pos(self, x: i32, y: i32) -> Self

Initialize to position x, y

fn with_size(self, width: i32, height: i32) -> Self

Initialilze to dimensions width and height

fn set_pos(&mut self, x: i32, y: i32)

Set to position x, y

fn set_size(&mut self, width: i32, height: i32)

Set to dimensions width and height

fn with_label(self, title: &str) -> Self

Initialize with label/title

fn with_align(self, align: Align) -> Self

Sets the initial alignment of the widget

fn below_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self

Positions the widget below w

fn above_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self

Positions the widget above w

fn right_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self

Positions the widget to the right of w

fn left_of<W: WidgetExt>(self, w: &W, padding: i32) -> Self

Positions the widget to the left of w

fn center_of<W: WidgetExt>(self, w: &W) -> Self

Positions the widget to the center of w

fn size_of<W: WidgetExt>(self, w: &W) -> Self

Takes the size of w

fn set_label(&mut self, title: &str)

Sets the widget's label

fn redraw(&mut self)

Redraws a widget, necessary for resizing and changing positions

fn show(&mut self)

Shows the widget

fn hide(&mut self)

Hides the widget

fn x(&self) -> i32

Returns the x coordinate of the widget

fn y(&self) -> i32

Returns the y coordinate of the widget

fn width(&self) -> i32

Returns the width of the widget

fn height(&self) -> i32

Returns the height of the widget

fn label(&self) -> String

Returns the label of the widget

unsafe fn as_widget_ptr(&self) -> *mut Fl_Widget

transforms a widget to a base Fl_Widget, for internal use

Safety

Can return multiple mutable pointers to the same widget

unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self

transforms a widget pointer to a Widget, for internal use

Safety

The pointer must be valid

fn activate(&mut self)

Activates the widget

fn deactivate(&mut self)

Deactivates the widget

fn redraw_label(&mut self)

Redraws the label of the widget

fn resize(&mut self, x: i32, y: i32, width: i32, height: i32)

Resizes and/or moves the widget, takes x, y, width and height

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

Returns the tooltip text

fn set_tooltip(&mut self, txt: &str)

Sets the tooltip text

fn get_type<T: WidgetType>(&self) -> T

Returns the widget type when applicable

fn set_type<T: WidgetType>(&mut self, typ: T)

Sets the widget type

fn color(&self) -> Color

Returns the widget color

fn set_color(&mut self, color: Color)

Sets the widget's color

fn label_color(&self) -> Color

Returns the widget label's color

fn set_label_color(&mut self, color: Color)

Sets the widget label's color

fn label_font(&self) -> Font

Returns the widget label's font

fn set_label_font(&mut self, font: Font)

Sets the widget label's font

fn label_size(&self) -> i32

Returns the widget label's size

fn set_label_size(&mut self, sz: i32)

Sets the widget label's size

fn label_type(&self) -> LabelType

Returns the widget label's type

fn set_label_type(&mut self, typ: LabelType)

Sets the widget label's type

fn frame(&self) -> FrameType

Returns the widget's frame type

fn set_frame(&mut self, typ: FrameType)

Sets the widget's frame type

fn changed(&self) -> bool

Returns whether the widget was changed

fn set_changed(&mut self)

Mark the widget as changed

fn clear_changed(&mut self)

Clears the changed status of the widget

fn align(&self) -> Align

Returns the alignment of the widget

fn set_align(&mut self, align: Align)

Sets the alignment of the widget

fn set_image<I: ImageExt>(&mut self, image: Option<I>)

Sets the image of the widget

fn image(&self) -> Option<Image>

Gets the image associated with the widget

fn set_deimage<I: ImageExt>(&mut self, image: Option<I>)

Sets the image of the widget

fn deimage(&self) -> Option<Image>

Gets the image associated with the widget

fn set_callback(&mut self, cb: Box<dyn FnMut()>)

Sets the callback when the widget is triggered (clicks for example)

fn handle(&mut self, cb: Box<dyn FnMut(Event) -> bool>)

Set a custom handler, where events are managed manually, akin to Fl_Widget::handle(int) Handled or ignored events shoult return true, unhandled events should return false

fn set_trigger(&mut self, trigger: CallbackTrigger)

Sets the default callback trigger for a widget

fn draw(&mut self, cb: Box<dyn FnMut()>)

Set a custom draw method

fn parent(&self) -> Option<Widget>

Returns the parent of the widget

fn selection_color(&mut self) -> Color

Gets the selection color of the widget

fn set_selection_color(&mut self, color: Color)

Sets the selection color of the widget

fn do_callback(&mut self)

Runs the already registered callback

fn inside(&self, wid: Widget) -> bool

Checks whether the self widget is inside another widget

fn window(&self) -> Option<Window>

Returns the direct window holding the widget

fn top_window(&self) -> Option<Window>

Returns the topmost window holding the widget

fn takes_events(&self) -> bool

Checks whether a widget is capable of taking events

fn emit<T: 'static + Copy + Send + Sync>(&mut self, sender: Sender<T>, msg: T)

Emits a message on callback using a sender

fn take_focus(&mut self) -> Result<(), FltkError>

Make the widget take focus

fn set_visible_focus(&mut self)

Set the widget to have visible focus

fn clear_visible_focus(&mut self)

Clear visible focus

fn visible_focus(&mut self, v: bool)

Set the visible focus using a flag

fn has_visible_focus(&mut self) -> bool

Return whether the widget has visible focus

fn delete(&mut self)

Manually delete a widget

unsafe fn unsafe_delete(&mut self)

Manually delete a widget and recursively force-cleans capturing callbacks

Safety

Deletes user_data and any captured objects in the callback

fn was_deleted(&self) -> bool

Check if a widget was deleted

fn damage(&self) -> bool

Return whether the widget was damaged

fn set_damage(&mut self, flag: bool)

Signal the widget as damaged and it should be redrawn in the next event loop cycle

fn clear_damage(&mut self)

Clear the damaged flag

fn as_window(&mut self) -> Option<Window>

Return the widget as a window if it's a window

fn as_group(&mut self) -> Option<Group>

Return the widget as a group widget if it's a group widget

unsafe fn user_data(&self) -> Option<Box<dyn FnMut()>>

INTERNAL: Retakes ownership of the user callback data

Safety

Can return multiple mutable references to the user_data

unsafe fn set_user_data(&mut self, data: *mut c_void)

INTERNAL: Manually set the user data

Safety

The data must be valid, and it cannot be checked since it's opaque

unsafe fn raw_user_data(&self) -> *mut c_void

INTERNAL: Retakes ownership of the user callback data

Safety

Can return multiple mutable references to the user_data

unsafe fn cleanup(&mut self)

INTERNAL: Cleanup after widget deletion

Safety

The widget tracker is destroyed along the widget, so widget tracking is lost

unsafe fn unset_callback(&mut self)

INTERNAL: Unset the defined callback

Safety

Can be unsafe if a callback is invoked after unsetting it

unsafe fn draw_data(&mut self) -> Option<Box<dyn FnMut()>>

INTERNAL: Retrieve the draw data

Safety

Can return multiple mutable references to the draw_data

unsafe fn set_draw_data(&mut self, data: *mut c_void)

INTERNAL: Manually set the draw data

Safety

The data must be valid, and it cannot be checked since it's opaque

unsafe fn unset_draw_callback(&mut self)

INTERNAL: Unset the draw callback

Safety

Can be unsafe if the draw() method is called after being unset

Loading content...

Implementors

impl WidgetExt for Browser[src]

impl WidgetExt for FileBrowser[src]

impl WidgetExt for HoldBrowser[src]

impl WidgetExt for MultiBrowser[src]

impl WidgetExt for SelectBrowser[src]

impl WidgetExt for Button[src]

impl WidgetExt for CheckButton[src]

impl WidgetExt for LightButton[src]

impl WidgetExt for RadioButton[src]

impl WidgetExt for RadioLightButton[src]

impl WidgetExt for RadioRoundButton[src]

impl WidgetExt for RepeatButton[src]

impl WidgetExt for ReturnButton[src]

impl WidgetExt for RoundButton[src]

impl WidgetExt for ToggleButton[src]

impl WidgetExt for Frame[src]

impl WidgetExt for ColorChooser[src]

impl WidgetExt for Group[src]

impl WidgetExt for Pack[src]

impl WidgetExt for Scroll[src]

impl WidgetExt for Tabs[src]

impl WidgetExt for Tile[src]

impl WidgetExt for Wizard[src]

impl WidgetExt for FileInput[src]

impl WidgetExt for FloatInput[src]

impl WidgetExt for Input[src]

impl WidgetExt for IntInput[src]

impl WidgetExt for MultilineInput[src]

impl WidgetExt for SecretInput[src]

impl WidgetExt for Choice[src]

impl WidgetExt for MenuBar[src]

impl WidgetExt for MenuButton[src]

impl WidgetExt for SysMenuBar[src]

impl WidgetExt for Chart[src]

impl WidgetExt for Clock[src]

impl WidgetExt for Progress[src]

impl WidgetExt for Spinner[src]

impl WidgetExt for MultilineOutput[src]

impl WidgetExt for Output[src]

impl WidgetExt for Table[src]

impl WidgetExt for TableRow[src]

impl WidgetExt for SimpleTerminal[src]

impl WidgetExt for TextDisplay[src]

impl WidgetExt for TextEditor[src]

impl WidgetExt for Tree[src]

impl WidgetExt for Adjuster[src]

impl WidgetExt for Counter[src]

impl WidgetExt for Dial[src]

impl WidgetExt for FillDial[src]

impl WidgetExt for FillSlider[src]

impl WidgetExt for HorFillSlider[src]

impl WidgetExt for HorNiceSlider[src]

impl WidgetExt for HorSlider[src]

impl WidgetExt for HorValueSlider[src]

impl WidgetExt for LineDial[src]

impl WidgetExt for NiceSlider[src]

impl WidgetExt for Roller[src]

impl WidgetExt for Scrollbar[src]

impl WidgetExt for Slider[src]

impl WidgetExt for ValueInput[src]

impl WidgetExt for ValueOutput[src]

impl WidgetExt for ValueSlider[src]

impl WidgetExt for Widget[src]

impl WidgetExt for DoubleWindow[src]

impl WidgetExt for MenuWindow[src]

impl WidgetExt for SingleWindow[src]

impl WidgetExt for Window[src]

Loading content...