impl<'a, T> LabelBuilder<'a, T> {
pub fn create(&mut self) -> Label {
- unsafe {
- Label { ptr: (self.create)(self.obj.ptr, self.args) }
- }
+ Label { ptr: (self.create)(self.obj.ptr, self.args) }
}
pub fn fill(&mut self, fill: bool) -> &mut Self {
pub fn onclick<F>(&mut self, f: F) -> &mut Self
where F: FnMut(&mut event::Event<T>) + 'static {
let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
- let mut ctx = UiContext { ptr: self.ctx };
+ let ctx = UiContext { ptr: self.ctx };
let ptr = ctx.reg_box(wrapper);
unsafe {
ui_menuitem_args_set_onclick(self.args, Some(event::event_wrapper::<T>));
pub fn onchange<F>(&mut self, f: F) -> &mut Self
where F: FnMut(&mut event::Event<T>) + 'static {
let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
- let mut ctx = UiContext { ptr: self.ctx };
+ let ctx = UiContext { ptr: self.ctx };
let ptr = ctx.reg_box(wrapper);
unsafe {
ui_menutoggleitem_args_set_onchange(self.args, Some(event::event_wrapper::<T>));
pub fn onclick<F>(&mut self, f: F) -> &mut Self
where F: FnMut(&mut event::Event<T>) + 'static {
let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
- let mut ctx = UiContext { ptr: self.ctx };
+ let ctx = UiContext { ptr: self.ctx };
let ptr = ctx.reg_box(wrapper);
unsafe {
ui_toolbar_item_args_set_onclick(self.args, Some(event::event_wrapper::<T>));
pub fn onchange<F>(&mut self, f: F) -> &mut Self
where F: FnMut(&mut event::Event<T>) + 'static {
let wrapper = Box::new(EventWrapper { callback: Box::new(f) });
- let mut ctx = UiContext { ptr: self.ctx };
+ let ctx = UiContext { ptr: self.ctx };
let ptr = ctx.reg_box(wrapper);
unsafe {
ui_toolbar_toggleitem_args_set_onchange(self.args, Some(event::event_wrapper::<T>));
pub fn new(mut data: T) -> UiDoc<T> {
unsafe {
let doc = ui_document_new(mem::size_of::<*mut T>());
- let mut ctx = UiContext { ptr: ui_document_context(doc) };
+ let ctx = UiContext { ptr: ui_document_context(doc) };
data.init(&ctx);
let data_ptr = ctx.reg_box(Box::new(data)); // returns *mut T
let doc_storage: *mut *mut T = doc.cast();
// only unregister if the object still exists
if !obj_ptr.is_null() {
- let ctx = unsafe { ui_object_get_context(obj_ptr) };
+ let ctx = ui_object_get_context(obj_ptr);
let xptr = &mut *self.ptr as *mut *mut ffi::UiObject;
ui_remove_destructor(ctx, xptr as *mut c_void);
}