mirror of
https://github.com/RGBCube/serenity
synced 2025-07-19 20:37:34 +00:00
LibGUI: Allow setting max visible items for ComboBoxes
This will govern the maximum number of items ComboBox windows display before scrolling content.
This commit is contained in:
parent
aa8e7aba42
commit
f86c5b1fa7
2 changed files with 5 additions and 0 deletions
|
@ -58,6 +58,7 @@ ComboBox::ComboBox()
|
||||||
{
|
{
|
||||||
REGISTER_STRING_PROPERTY("placeholder", editor_placeholder, set_editor_placeholder);
|
REGISTER_STRING_PROPERTY("placeholder", editor_placeholder, set_editor_placeholder);
|
||||||
REGISTER_BOOL_PROPERTY("model_only", only_allow_values_from_model, set_only_allow_values_from_model);
|
REGISTER_BOOL_PROPERTY("model_only", only_allow_values_from_model, set_only_allow_values_from_model);
|
||||||
|
REGISTER_INT_PROPERTY("max_visible_items", max_visible_items, set_max_visible_items);
|
||||||
|
|
||||||
set_min_size({ 40, 22 });
|
set_min_size({ 40, 22 });
|
||||||
set_preferred_size({ SpecialDimension::OpportunisticGrow, 22 });
|
set_preferred_size({ SpecialDimension::OpportunisticGrow, 22 });
|
||||||
|
|
|
@ -44,6 +44,9 @@ public:
|
||||||
void set_editor_placeholder(StringView placeholder);
|
void set_editor_placeholder(StringView placeholder);
|
||||||
String const& editor_placeholder() const;
|
String const& editor_placeholder() const;
|
||||||
|
|
||||||
|
int max_visible_items() const { return m_max_visible_items; }
|
||||||
|
void set_max_visible_items(int max) { m_max_visible_items = max; }
|
||||||
|
|
||||||
Function<void(String const&, ModelIndex const&)> on_change;
|
Function<void(String const&, ModelIndex const&)> on_change;
|
||||||
Function<void()> on_return_pressed;
|
Function<void()> on_return_pressed;
|
||||||
|
|
||||||
|
@ -63,6 +66,7 @@ private:
|
||||||
Optional<ModelIndex> m_selected_index;
|
Optional<ModelIndex> m_selected_index;
|
||||||
bool m_only_allow_values_from_model { false };
|
bool m_only_allow_values_from_model { false };
|
||||||
bool m_updating_model { false };
|
bool m_updating_model { false };
|
||||||
|
int m_max_visible_items { 15 };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue