| 1 |
|
| 2 |
|
| 3 |
use bevy::{ |
| 4 |
feathers::{controls::FeathersCheckbox, display::caption}, |
| 5 |
picking::hover::Hovered, |
| 6 |
prelude::*, |
| 7 |
ui_widgets::checkbox_self_update, |
| 8 |
}; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
pub fn feathers_option_checkbox<T>( |
| 17 |
option_name: &str, |
| 18 |
checkbox_identifier: Option<T>, |
| 19 |
) -> Box<dyn Scene> |
| 20 |
where |
| 21 |
T: Template<Output: Component> + Clone + Default + Send + Sync + Unpin + 'static, |
| 22 |
{ |
| 23 |
if let Some(identifier) = checkbox_identifier { |
| 24 |
Box::new(bsn! { |
| 25 |
Node { |
| 26 |
align_items: AlignItems::Center, |
| 27 |
column_gap: px(5), |
| 28 |
} |
| 29 |
Children [ |
| 30 |
@FeathersCheckbox { |
| 31 |
@caption: bsn! { @caption(option_name) } |
| 32 |
} |
| 33 |
Hovered |
| 34 |
identifier |
| 35 |
on(checkbox_self_update) |
| 36 |
] |
| 37 |
}) |
| 38 |
} else { |
| 39 |
Box::new(bsn! { |
| 40 |
Node { |
| 41 |
align_items: AlignItems::Center, |
| 42 |
column_gap: px(5), |
| 43 |
} |
| 44 |
Children [ |
| 45 |
@FeathersCheckbox { |
| 46 |
@caption: bsn! { @caption(option_name) } |
| 47 |
} |
| 48 |
Hovered |
| 49 |
on(checkbox_self_update) |
| 50 |
] |
| 51 |
}) |
| 52 |
} |
| 53 |
} |