Consolidate MenuListButton into TextButton (#1470)

This commit is contained in:
Keavon Chambers
2023-11-25 01:56:05 -08:00
committed by GitHub
parent 34c6c0431b
commit ab3410cffe
14 changed files with 141 additions and 138 deletions
@@ -100,6 +100,9 @@ pub struct TextButton {
#[serde(skip)]
pub tooltip_shortcut: Option<ActionKeys>,
#[serde(rename = "menuListChildren")]
pub menu_list_children: MenuListEntrySections,
// Callbacks
#[serde(skip)]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
@@ -48,7 +48,7 @@ impl Default for CheckboxInput {
#[derivative(Debug, PartialEq, Default)]
pub struct DropdownInput {
#[widget_builder(constructor)]
pub entries: DropdownInputEntries,
pub entries: MenuListEntrySections,
// This uses `u32` instead of `usize` since it will be serialized as a normal JS number (replace this with `usize` after switching to a Rust-based GUI)
#[serde(rename = "selectedIndex")]
@@ -68,15 +68,15 @@ pub struct DropdownInput {
pub tooltip_shortcut: Option<ActionKeys>,
//
// Callbacks
// `on_update` exists on the `DropdownEntryData`, not this parent `DropdownInput`
// `on_update` exists on the `MenuListEntry`, not this parent `DropdownInput`
}
pub type DropdownInputEntries = Vec<Vec<DropdownEntryData>>;
pub type MenuListEntrySections = Vec<Vec<MenuListEntry>>;
#[derive(Clone, Serialize, Deserialize, Derivative, Default, WidgetBuilder, specta::Type)]
#[derivative(Debug, PartialEq)]
#[widget_builder(not_widget_holder)]
pub struct DropdownEntryData {
pub struct MenuListEntry {
pub value: String,
#[widget_builder(constructor)]
@@ -91,7 +91,7 @@ pub struct DropdownEntryData {
pub disabled: bool,
pub children: DropdownInputEntries,
pub children: MenuListEntrySections,
// Callbacks
#[serde(skip)]