Trait fltk::prelude::WidgetBase
source · pub unsafe trait WidgetBase: WidgetExt {
// Required methods
fn new<'a, T: Into<Option<&'a 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);
fn resize_callback<F: FnMut(&mut Self, i32, i32, i32, i32) + 'static>(
&mut self,
cb: F
);
// Provided methods
unsafe fn assume_derived(&mut self) { ... }
fn from_dyn_widget<W: WidgetExt>(_w: &W) -> Option<Self>
where Self: Sized { ... }
fn from_dyn_widget_ptr(_w: *mut Fl_Widget) -> Option<Self>
where Self: Sized { ... }
}
Expand description
Required Methods§
sourcefn new<'a, T: Into<Option<&'a str>>>(
x: i32,
y: i32,
width: i32,
height: i32,
title: T
) -> Self
fn new<'a, T: Into<Option<&'a str>>>( x: i32, y: i32, width: i32, height: i32, title: T ) -> 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 screeny
- The y coordinate in the screenwidth
- The width of the widgetheigth
- The height of the widgettitle
- The title or label of the widget 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.
sourcefn default_fill() -> Self
fn default_fill() -> Self
Constructs a widget with the size of its parent
sourceunsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
sourceunsafe fn from_widget<W: WidgetExt>(w: W) -> Self
unsafe fn from_widget<W: WidgetExt>(w: W) -> Self
sourcefn handle<F: FnMut(&mut Self, Event) -> bool + 'static>(&mut self, cb: F)
fn handle<F: FnMut(&mut Self, Event) -> bool + 'static>(&mut self, cb: F)
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.
The ability to handle an event might depend on handling other events, as explained here
Provided Methods§
sourceunsafe fn assume_derived(&mut self)
unsafe fn assume_derived(&mut self)
Object Safety§
This trait is not object safe.