[][src]Trait fltk::prelude::WidgetTrait

pub trait WidgetTrait {
    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 with_label(self, title: &str) -> Self;
fn below_of<W: WidgetTrait>(self, w: &W, padding: i32) -> Self;
fn above_of<W: WidgetTrait>(self, w: &W, padding: i32) -> Self;
fn right_of<W: WidgetTrait>(self, w: &W, padding: i32) -> Self;
fn left_of<W: WidgetTrait>(self, w: &W, padding: i32) -> Self;
fn center_of<W: WidgetTrait>(self, w: &W) -> Self;
fn size_of<W: WidgetTrait>(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;
fn as_widget_ptr(&self) -> *mut Fl_Widget;
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) -> 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<T: WidgetType>(&self) -> T;
fn set_label_type<T: WidgetType>(&mut self, typ: T);
fn frame<T: WidgetType>(&self) -> T;
fn set_frame<T: WidgetType>(&mut self, typ: T);
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<Image: ImageTrait>(&mut self, image: &Image);
fn set_callback<'a>(&'a mut self, cb: Box<dyn FnMut() + 'a>);
fn set_custom_handler<'a>(
        &'a mut self,
        cb: Box<dyn FnMut(Event) -> bool + 'a>
    );
fn set_trigger(&mut self, trigger: CallbackTrigger); }

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 with_label(self, title: &str) -> Self

Initialize with label/title

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

Positions the widget below w

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

Positions the widget above w

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

Positions the widget to the right of w

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

Positions the widget to the left of w

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

Positions the widget to the center of w

fn size_of<W: WidgetTrait>(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

fn as_widget_ptr(&self) -> *mut Fl_Widget

transforms a widget to a base Fl_Widget, for internal use

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

transforms a widget pointer to a Widget, for internal use

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) -> 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<T: WidgetType>(&self) -> T

Returns the widget label's type

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

Sets the widget label's type

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

Returns the widget's frame type

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

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<Image: ImageTrait>(&mut self, image: &Image)

Sets the image of the widget

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

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

fn set_custom_handler<'a>(&'a mut self, cb: Box<dyn FnMut(Event) -> bool + 'a>)

Set a custom handler, where events are managed manually, akin to Fl_Widget::handle(int)

fn set_trigger(&mut self, trigger: CallbackTrigger)

Sets the default callback trigger for a widget

Loading content...

Implementors

impl WidgetTrait for Browser[src]

impl WidgetTrait for FileBrowser[src]

impl WidgetTrait for HoldBrowser[src]

impl WidgetTrait for MultiBrowser[src]

impl WidgetTrait for SelectBrowser[src]

impl WidgetTrait for Button[src]

impl WidgetTrait for CheckButton[src]

impl WidgetTrait for LightButton[src]

impl WidgetTrait for RadioButton[src]

impl WidgetTrait for RepeatButton[src]

impl WidgetTrait for ReturnButton[src]

impl WidgetTrait for RoundButton[src]

impl WidgetTrait for ToggleButton[src]

impl WidgetTrait for Frame[src]

impl WidgetTrait for Group[src]

impl WidgetTrait for Pack[src]

impl WidgetTrait for Scroll[src]

impl WidgetTrait for Tabs[src]

impl WidgetTrait for Tile[src]

impl WidgetTrait for Wizard[src]

impl WidgetTrait for FileInput[src]

impl WidgetTrait for FloatInput[src]

impl WidgetTrait for Input[src]

impl WidgetTrait for IntInput[src]

impl WidgetTrait for MultilineInput[src]

impl WidgetTrait for SecretInput[src]

impl WidgetTrait for Choice[src]

impl WidgetTrait for MenuBar[src]

impl WidgetTrait for MenuButton[src]

impl WidgetTrait for Chart[src]

impl WidgetTrait for Clock[src]

impl WidgetTrait for Progress[src]

impl WidgetTrait for Spinner[src]

impl WidgetTrait for MultilineOutput[src]

impl WidgetTrait for Output[src]

impl WidgetTrait for SimpleTerminal[src]

impl WidgetTrait for TextDisplay[src]

impl WidgetTrait for TextEditor[src]

impl WidgetTrait for Adjuster[src]

impl WidgetTrait for Counter[src]

impl WidgetTrait for Dial[src]

impl WidgetTrait for LineDial[src]

impl WidgetTrait for NiceSlider[src]

impl WidgetTrait for Roller[src]

impl WidgetTrait for Scrollbar[src]

impl WidgetTrait for Slider[src]

impl WidgetTrait for ValueInput[src]

impl WidgetTrait for ValueSlider[src]

impl WidgetTrait for DoubleWindow[src]

impl WidgetTrait for MenuWindow[src]

impl WidgetTrait for Window[src]

Loading content...