pub unsafe trait WidgetBase: WidgetExt {
// Required methods
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§
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)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.