pub struct CheckBox { /* private fields */ }Expand description
§CheckBox的示例用法
use xlui::*;
fn checked<A:App>(_:&mut A,_:&mut Ui,check:bool){
println!("复选框状态改变: {}",check);
}
fn draw<A:App>(ui:&mut Ui){
//快速创建一个复选框
ui.checkbox(false,"Hello CheckBox")
//设置回调函数
.set_callback(checked::<A>);
let mut check=CheckBox::new(false,"hello button")
//连接到回调函数
.connect(checked::<A>)
//设置控件宽度
.with_width(100.0)
//与ID为my_radio的控件关联
.contact("my_radio")
//设置ID
.id("my_checked");
ui.add(check);
}Implementations§
Source§impl CheckBox
impl CheckBox
pub fn new(v: bool, label: impl Into<RichText>) -> CheckBox
pub fn connect<A: 'static>(self, f: fn(&mut A, &mut Ui<'_, '_>, bool)) -> Self
pub fn with_width(self, width: f32) -> Self
pub fn id(self, id: impl ToString) -> Self
pub fn contact(self, id: impl ToString) -> Self
pub fn set_callback<A: App>(&mut self, f: fn(&mut A, &mut Ui<'_, '_>, bool))
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CheckBox
impl !RefUnwindSafe for CheckBox
impl !Send for CheckBox
impl !Sync for CheckBox
impl Unpin for CheckBox
impl !UnwindSafe for CheckBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more