Trait fltk::prelude::WidgetExt

source ·
pub unsafe trait WidgetExt {
Show 100 methods // Required methods fn with_pos(self, x: i32, y: i32) -> Self where Self: Sized; fn with_size(self, width: i32, height: i32) -> Self where Self: Sized; fn with_label(self, title: &str) -> Self where Self: Sized; fn with_align(self, align: Align) -> Self where Self: Sized; fn with_type<T: WidgetType>(self, typ: T) -> Self where Self: Sized; fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self where Self: Sized; fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self where Self: Sized; fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self where Self: Sized; fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self where Self: Sized; fn center_of<W: WidgetExt>(self, w: &W) -> Self where Self: Sized; fn center_x<W: WidgetExt>(self, w: &W) -> Self where Self: Sized; fn center_y<W: WidgetExt>(self, w: &W) -> Self where Self: Sized; fn center_of_parent(self) -> Self where Self: Sized; fn size_of<W: WidgetExt>(self, w: &W) -> Self where Self: Sized; fn size_of_parent(self) -> Self where Self: Sized; fn set_pos(&mut self, x: i32, y: i32); fn set_size(&mut self, width: i32, height: i32); 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 w(&self) -> i32; fn h(&self) -> i32; fn label(&self) -> String; fn measure_label(&self) -> (i32, i32); fn as_widget_ptr(&self) -> *mut Fl_Widget; fn inside<W: WidgetExt>(&self, wid: &W) -> bool where Self: Sized; fn get_type<T: WidgetType>(&self) -> T where Self: Sized; fn set_type<T: WidgetType>(&mut self, typ: T) where Self: Sized; fn set_image<I: ImageExt>(&mut self, image: Option<I>) where Self: Sized; fn set_image_scaled<I: ImageExt>(&mut self, image: Option<I>) where Self: Sized; fn image(&self) -> Option<Box<dyn ImageExt>> where Self: Sized; fn set_deimage<I: ImageExt>(&mut self, image: Option<I>) where Self: Sized; fn set_deimage_scaled<I: ImageExt>(&mut self, image: Option<I>) where Self: Sized; fn deimage(&self) -> Option<Box<dyn ImageExt>> where Self: Sized; fn set_callback<F: FnMut(&mut Self) + 'static>(&mut self, cb: F) where Self: Sized; fn emit<T: 'static + Clone + Send + Sync>( &mut self, sender: Sender<T>, msg: T ) where Self: Sized; 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 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 parent(&self) -> Option<Group>; fn selection_color(&self) -> Color; fn set_selection_color(&mut self, color: Color); fn do_callback(&mut self); fn window(&self) -> Option<Box<dyn WindowExt>>; fn top_window(&self) -> Option<Box<dyn WindowExt>>; fn takes_events(&self) -> bool; 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(&self) -> bool; fn has_focus(&self) -> bool; fn was_deleted(&self) -> bool; fn damage(&self) -> bool; fn set_damage(&mut self, flag: bool); fn damage_type(&self) -> Damage; fn set_damage_type(&mut self, mask: Damage); fn set_damage_area(&mut self, mask: Damage, x: i32, y: i32, w: i32, h: i32); fn clear_damage(&mut self); fn set_trigger(&mut self, trigger: CallbackTrigger); fn trigger(&self) -> CallbackTrigger; fn as_window(&self) -> Option<Box<dyn WindowExt>>; fn as_group(&self) -> Option<Group>; unsafe fn into_widget<W: WidgetBase>(&self) -> W where Self: Sized; fn visible(&self) -> bool; fn visible_r(&self) -> bool; fn is_same<W: WidgetExt>(&self, other: &W) -> bool where Self: Sized; fn active(&self) -> bool; fn active_r(&self) -> bool; fn widget_resize(&mut self, x: i32, y: i32, w: i32, h: i32); fn handle_event(&mut self, event: Event) -> bool; // Provided methods fn as_base_widget(&self) -> Widget where Self: Sized { ... } fn is_derived(&self) -> bool { ... } unsafe fn image_mut(&self) -> Option<&mut Image> { ... } unsafe fn deimage_mut(&self) -> Option<&mut Image> { ... }
}
Expand description

Defines the methods implemented by all widgets

For multithreaded usage, see the widget module documentation’s note

§Safety

fltk-rs traits depend on some FLTK internal code

§Warning

fltk-rs traits are non-exhaustive, to avoid future breakage if you try to implement them manually, use the Deref and DerefMut pattern or the widget_extends! macro

Required Methods§

source

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

Initialize to a position x, y

source

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

Initialize to size width, height

source

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

Initialize with a label

source

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

Initialize with alignment

source

fn with_type<T: WidgetType>(self, typ: T) -> Self
where Self: Sized,

Initialize with type

source

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

Initialize at bottom of another widget

source

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

Initialize above of another widget

source

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

Initialize right of another widget

source

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

Initialize left of another widget

source

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

Initialize center of another widget

source

fn center_x<W: WidgetExt>(self, w: &W) -> Self
where Self: Sized,

Initialize center of another widget on the x axis

source

fn center_y<W: WidgetExt>(self, w: &W) -> Self
where Self: Sized,

Initialize center of another widget on the y axis

source

fn center_of_parent(self) -> Self
where Self: Sized,

Initialize center of parent

source

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

Initialize to the size of another widget

source

fn size_of_parent(self) -> Self
where Self: Sized,

Initialize to the size of the parent

source

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

Set to position x, y

source

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

Set to dimensions width and height

source

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

Sets the widget’s label. labels support special symbols preceded by an @ sign. and for the associated formatting.

source

fn redraw(&mut self)

Redraws a widget, necessary for resizing and changing positions

source

fn show(&mut self)

Shows the widget

source

fn hide(&mut self)

Hides the widget

source

fn x(&self) -> i32

Returns the x coordinate of the widget

source

fn y(&self) -> i32

Returns the y coordinate of the widget

source

fn width(&self) -> i32

Returns the width of the widget

source

fn height(&self) -> i32

Returns the height of the widget

source

fn w(&self) -> i32

Returns the width of the widget

source

fn h(&self) -> i32

Returns the height of the widget

source

fn label(&self) -> String

Returns the label of the widget

source

fn measure_label(&self) -> (i32, i32)

Measures the label’s width and height

source

fn as_widget_ptr(&self) -> *mut Fl_Widget

transforms a widget to a base Fl_Widget, for internal use

source

fn inside<W: WidgetExt>(&self, wid: &W) -> bool
where Self: Sized,

Checks whether the self widget is inside another widget

source

fn get_type<T: WidgetType>(&self) -> T
where Self: Sized,

Returns the widget type when applicable

source

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

Sets the widget type

source

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

Sets the image of the widget

source

fn set_image_scaled<I: ImageExt>(&mut self, image: Option<I>)
where Self: Sized,

Sets the image of the widget scaled to the widget’s size

source

fn image(&self) -> Option<Box<dyn ImageExt>>
where Self: Sized,

Gets the image associated with the widget

source

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

Sets the deactivated image of the widget

source

fn set_deimage_scaled<I: ImageExt>(&mut self, image: Option<I>)
where Self: Sized,

Sets the deactivated image of the widget scaled to the widget’s size

source

fn deimage(&self) -> Option<Box<dyn ImageExt>>
where Self: Sized,

Gets the deactivated image associated with the widget

source

fn set_callback<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
where Self: Sized,

Sets the callback when the widget is triggered (clicks for example) takes the widget as a closure argument

source

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

Emits a message on callback using a sender

source

fn activate(&mut self)

Activates the widget

source

fn deactivate(&mut self)

Deactivates the widget

source

fn redraw_label(&mut self)

Redraws the label of the widget

source

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

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

source

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

Returns the tooltip text

source

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

Sets the tooltip text

source

fn color(&self) -> Color

Returns the widget color

source

fn set_color(&mut self, color: Color)

Sets the widget’s color

source

fn label_color(&self) -> Color

Returns the widget label’s color

source

fn set_label_color(&mut self, color: Color)

Sets the widget label’s color

source

fn label_font(&self) -> Font

Returns the widget label’s font

source

fn set_label_font(&mut self, font: Font)

Sets the widget label’s font

source

fn label_size(&self) -> i32

Returns the widget label’s size

source

fn set_label_size(&mut self, sz: i32)

Sets the widget label’s size

source

fn label_type(&self) -> LabelType

Returns the widget label’s type

source

fn set_label_type(&mut self, typ: LabelType)

Sets the widget label’s type

source

fn frame(&self) -> FrameType

Returns the widget’s frame type

source

fn set_frame(&mut self, typ: FrameType)

Sets the widget’s frame type

source

fn changed(&self) -> bool

Returns whether the widget was changed

source

fn set_changed(&mut self)

Mark the widget as changed

source

fn clear_changed(&mut self)

Clears the changed status of the widget

source

fn align(&self) -> Align

Returns the alignment of the widget

source

fn set_align(&mut self, align: Align)

Sets the alignment of the widget

source

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

Returns the parent of the widget

source

fn selection_color(&self) -> Color

Gets the selection color of the widget

source

fn set_selection_color(&mut self, color: Color)

Sets the selection color of the widget

source

fn do_callback(&mut self)

Runs the already registered callback

source

fn window(&self) -> Option<Box<dyn WindowExt>>

Returns the direct window holding the widget

source

fn top_window(&self) -> Option<Box<dyn WindowExt>>

Returns the topmost window holding the widget

source

fn takes_events(&self) -> bool

Checks whether a widget is capable of taking events

source

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

Make the widget take focus

§Errors

Errors on failure to take focus

source

fn set_visible_focus(&mut self)

Set the widget to have visible focus

source

fn clear_visible_focus(&mut self)

Clear visible focus

source

fn visible_focus(&mut self, v: bool)

Set the visible focus using a flag

source

fn has_visible_focus(&self) -> bool

Return whether the widget has visible focus

source

fn has_focus(&self) -> bool

Return whether the widget has focus

source

fn was_deleted(&self) -> bool

Check if a widget was deleted

source

fn damage(&self) -> bool

Return whether the widget was damaged

source

fn set_damage(&mut self, flag: bool)

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

source

fn damage_type(&self) -> Damage

Return the damage mask

source

fn set_damage_type(&mut self, mask: Damage)

Signal the type of damage a widget received

source

fn set_damage_area(&mut self, mask: Damage, x: i32, y: i32, w: i32, h: i32)

Signal damage for an area inside the widget

source

fn clear_damage(&mut self)

Clear the damaged flag

source

fn set_trigger(&mut self, trigger: CallbackTrigger)

Sets the default callback trigger for a widget, equivalent to when()

source

fn trigger(&self) -> CallbackTrigger

Return the callback trigger, equivalent to when()

source

fn as_window(&self) -> Option<Box<dyn WindowExt>>

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

source

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

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

source

unsafe fn into_widget<W: WidgetBase>(&self) -> W
where Self: Sized,

Upcast a WidgetExt to some widget type

§Safety

Allows for potentially unsafe casts between incompatible widget types

source

fn visible(&self) -> bool

Returns whether a widget is visible

source

fn visible_r(&self) -> bool

Returns whether a widget or any of its parents are visible (recursively)

source

fn is_same<W: WidgetExt>(&self, other: &W) -> bool
where Self: Sized,

Return whether two widgets object point to the same widget

source

fn active(&self) -> bool

Returns whether a widget is active

source

fn active_r(&self) -> bool

Returns whether a widget or any of its parents are active (recursively)

source

fn widget_resize(&mut self, x: i32, y: i32, w: i32, h: i32)

Does a simple resize ignoring class-specific resize functionality

source

fn handle_event(&mut self, event: Event) -> bool

Handle a specific event

Provided Methods§

source

fn as_base_widget(&self) -> Widget
where Self: Sized,

Upcast a WidgetExt to a Widget

source

fn is_derived(&self) -> bool

Check whether a widget is derived

source

unsafe fn image_mut(&self) -> Option<&mut Image>

Get a reference type of the widget’s image

§Safety

The widget needs to be still around when the image is accessed

source

unsafe fn deimage_mut(&self) -> Option<&mut Image>

Get a reference type of the widget’s deactivated image

§Safety

The widget needs to be still around when the image is accessed

Implementors§

source§

impl WidgetExt for Browser

source§

impl WidgetExt for CheckBrowser

source§

impl WidgetExt for FileBrowser

source§

impl WidgetExt for HoldBrowser

source§

impl WidgetExt for MultiBrowser

source§

impl WidgetExt for SelectBrowser

source§

impl WidgetExt for Button

source§

impl WidgetExt for CheckButton

source§

impl WidgetExt for LightButton

source§

impl WidgetExt for RadioButton

source§

impl WidgetExt for RadioLightButton

source§

impl WidgetExt for RadioRoundButton

source§

impl WidgetExt for RepeatButton

source§

impl WidgetExt for ReturnButton

source§

impl WidgetExt for RoundButton

source§

impl WidgetExt for ShortcutButton

source§

impl WidgetExt for ToggleButton

source§

impl WidgetExt for Frame

source§

impl WidgetExt for Grid

source§

impl WidgetExt for Terminal

source§

impl WidgetExt for ColorChooser

source§

impl WidgetExt for Flex

source§

impl WidgetExt for Group

source§

impl WidgetExt for Pack

source§

impl WidgetExt for Scroll

source§

impl WidgetExt for Tabs

source§

impl WidgetExt for Tile

source§

impl WidgetExt for Wizard

source§

impl WidgetExt for FileInput

source§

impl WidgetExt for FloatInput

source§

impl WidgetExt for Input

source§

impl WidgetExt for IntInput

source§

impl WidgetExt for MultilineInput

source§

impl WidgetExt for SecretInput

source§

impl WidgetExt for Choice

source§

impl WidgetExt for MenuBar

source§

impl WidgetExt for MenuButton

source§

impl WidgetExt for SysMenuBar

source§

impl WidgetExt for Chart

source§

impl WidgetExt for Clock

source§

impl WidgetExt for HelpView

source§

impl WidgetExt for InputChoice

source§

impl WidgetExt for Progress

source§

impl WidgetExt for Spinner

source§

impl WidgetExt for MultilineOutput

source§

impl WidgetExt for Output

source§

impl WidgetExt for Table

source§

impl WidgetExt for TableRow

source§

impl WidgetExt for SimpleTerminal

source§

impl WidgetExt for TextDisplay

source§

impl WidgetExt for TextEditor

source§

impl WidgetExt for Tree

source§

impl WidgetExt for Adjuster

source§

impl WidgetExt for Counter

source§

impl WidgetExt for Dial

source§

impl WidgetExt for FillDial

source§

impl WidgetExt for FillSlider

source§

impl WidgetExt for HorFillSlider

source§

impl WidgetExt for HorNiceSlider

source§

impl WidgetExt for HorSlider

source§

impl WidgetExt for HorValueSlider

source§

impl WidgetExt for LineDial

source§

impl WidgetExt for NiceSlider

source§

impl WidgetExt for Roller

source§

impl WidgetExt for Scrollbar

source§

impl WidgetExt for Slider

source§

impl WidgetExt for ValueInput

source§

impl WidgetExt for ValueOutput

source§

impl WidgetExt for ValueSlider

source§

impl WidgetExt for Widget

source§

impl WidgetExt for DoubleWindow

source§

impl WidgetExt for GlutWindow

source§

impl WidgetExt for MenuWindow

source§

impl WidgetExt for OverlayWindow

source§

impl WidgetExt for SingleWindow