pub fn on_clicked<'ctx, F: FnMut(&mut Button) + 'ctx>(&mut self, _ctx: &'ctx UI, callback: F) {
        unsafe {
            let mut data: Box<Box<FnMut(&mut Button)>> = Box::new(Box::new(callback));
            ui_sys::uiButtonOnClicked(
                self.uiButton,
                Some(c_callback),
                &mut *data as *mut Box<FnMut(&mut Button)> as *mut c_void,
            );
            mem::forget(data);
        }

        extern "C" fn c_callback(button: *mut uiButton, data: *mut c_void) {
            unsafe {
                let mut button = Button { uiButton: button };
                mem::transmute::<*mut c_void, &mut Box<FnMut(&mut Button)>>(data)(&mut button)
            }
        }
    }
/// Run the given callback when the button is clicked.
Run the given callback when the button is clicked.
Run the given callback when the button is clicked .
pub fn on_clicked<'ctx, F: FnMut(&mut Button) + 'ctx>(&mut self, _ctx: &'ctx UI, callback: F) {
        unsafe {
            let mut data: Box<Box<FnMut(&mut Button)>> = Box::new(Box::new(callback));
            ui_sys::uiButtonOnClicked(
                self.uiButton,
                Some(c_callback),
                &mut *data as *mut Box<FnMut(&mut Button)> as *mut c_void,
            );
            mem::forget(data);
        }
        extern "C" fn c_callback(button: *mut uiButton, data: *mut c_void) {
            unsafe {
                let mut button = Button { uiButton: button };
                mem::transmute::<*mut c_void, &mut Box<FnMut(&mut Button)>>(data)(&mut button)
            }
        }
    }
pub fn on_clicked < ' ctx , F : FnMut ( & mut Button ) + ' ctx > ( & mut self , _ctx : & ' ctx UI , callback : F ) { unsafe { let mut data : Box < Box < FnMut ( & mut Button ) > > = Box :: new ( Box :: new ( callback ) ) ; ui_sys :: uiButtonOnClicked ( self . uiButton , Some ( c_callback ) , & mut * data as * mut Box < FnMut ( & mut Button ) > as * mut c_void , ) ; mem :: forget ( data ) ; } extern " " fn c_callback ( button : * mut uiButton , data : * mut c_void ) { unsafe { let mut button = Button { uiButton : button } ; mem :: transmute :: < * mut c_void , & mut Box < FnMut ( & mut Button ) > > ( data ) ( & mut button ) } } }
Run the given callback when the button is clicked.
Run the given callback when the button is clicked .
&mut self
_ctx
&'ctx UI
callback
F
&mut self
_ctx
&'ctx UI
callback
F