Trait fltk::prelude::WidgetBase [−][src]
pub unsafe trait WidgetBase: WidgetExt {
fn new<T: Into<Option<&'static str>>>(
x: i32,
y: i32,
width: i32,
height: i32,
title: T
) -> Self;
fn default_fill() -> Self;
fn delete(wid: Self)
where
Self: Sized;
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self;
unsafe fn from_widget<W: WidgetExt>(w: W) -> Self;
fn handle<F: FnMut(&mut Self, Event) -> bool + 'static>(&mut self, cb: F);
fn draw<F: FnMut(&mut Self) + 'static>(&mut self, cb: F);
unsafe fn draw_data(&mut self) -> Option<Box<dyn FnMut()>>;
unsafe fn handle_data(&mut self) -> Option<Box<dyn FnMut(Event) -> bool>>;
fn resize_callback<F: FnMut(&mut Self, i32, i32, i32, i32) + 'static>(
&mut self,
cb: F
);
}
Expand description
Defines the extended methods implemented by all widgets
Required methods
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 screeny
- The y coordinate in the screenwidth
- The width of the widgetheigth
- The height of the widgettitle
- The title or label of the widget The title is expected to be a static str or None. To use dynamic strings usewith_label(self, &str)
orset_label(&mut self, &str)
labels support special symbols preceded by an@
sign. and for the associated formatting.
fn default_fill() -> Self
fn default_fill() -> Self
Constructs a widget with the size of its parent
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
unsafe fn from_widget<W: WidgetExt>(w: W) -> Self
unsafe fn from_widget<W: WidgetExt>(w: W) -> Self
Set a custom handler, where events are managed manually, akin to Fl_Widget::handle(int)
.
Handled or ignored events should return true, unhandled events should return false.
takes the widget as a closure argument
Set a custom draw method.
takes the widget as a closure argument.
macOS requires that WidgetBase::draw
actually calls drawing functions