gloss_renderer/plugin_manager/gui/
selectable.rs1use crate::scene::Scene;
2
3use gloss_hecs::Entity;
4use gloss_utils::abi_stable_aliases::std_types::{RString, RVec};
5#[cfg(not(target_arch = "wasm32"))]
6use gloss_utils::abi_stable_aliases::StableAbi;
7
8#[repr(C)]
9#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
10pub struct Selectable {
11 pub name: RString,
12 pub is_selected: bool,
13 pub f_clicked: extern "C" fn(&RString, &Entity, &mut Scene),
14}
15impl Selectable {
16 pub fn new(name: &str, is_selected: bool, f_clicked: extern "C" fn(&RString, &Entity, &mut Scene)) -> Self {
17 Self {
18 name: RString::from(name),
19 is_selected,
20 f_clicked,
21 }
22 }
23}
24
25#[repr(C)]
26#[cfg_attr(not(target_arch = "wasm32"), derive(StableAbi))]
27pub struct SelectableList {
28 pub items: RVec<Selectable>,
29 pub is_horizontal: bool,
30}
31
32impl SelectableList {
33 pub fn new(items: RVec<Selectable>, is_horizontal: bool) -> Self {
34 Self { items, is_horizontal }
35 }
36}