aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUIListBox.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-03-23 10:46:13 +0100
committer GitHub <noreply@github.com>2024-03-23 10:46:13 +0100
commit9e99050cc93f4f482e70c218eb99c004d74a66d1 (patch)
treebb1e7fbe1e9f2c082ca82318911a09191455fd04 /extension/src/openvic-extension/classes/GUIListBox.hpp
parent8088824d7b78311c0613b3876ba9555fbbe96c17 (diff)
parent0cd976341792ea30ca41e09d9c238e4e342402cd (diff)
Merge pull request #214 from OpenVicProject/pop-menu
Assorted UI Changes (in preparation for Population Menu)
Diffstat (limited to 'extension/src/openvic-extension/classes/GUIListBox.hpp')
-rw-r--r--extension/src/openvic-extension/classes/GUIListBox.hpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/extension/src/openvic-extension/classes/GUIListBox.hpp b/extension/src/openvic-extension/classes/GUIListBox.hpp
index 9d49840..775feae 100644
--- a/extension/src/openvic-extension/classes/GUIListBox.hpp
+++ b/extension/src/openvic-extension/classes/GUIListBox.hpp
@@ -14,18 +14,18 @@ namespace OpenVic {
GUIScrollbar* scrollbar;
- struct child_data_t {
- Control* child;
- real_t start_pos, height;
- };
-
- std::vector<child_data_t> children_data;
-
/* The children_data index of the topmost visible child element. */
int32_t PROPERTY(scroll_index);
int32_t PROPERTY(max_scroll_index);
- godot::Error _calculate_child_arrangement();
+ bool PROPERTY_CUSTOM_PREFIX(fixed, is);
+ int32_t PROPERTY(fixed_item_count);
+ int32_t PROPERTY(fixed_visible_items);
+ real_t PROPERTY(fixed_item_height);
+
+ static godot::StringName const& _signal_scroll_index_changed();
+
+ godot::Error _calculate_max_scroll_index(bool signal);
godot::Error _update_child_positions();
protected:
@@ -42,10 +42,13 @@ namespace OpenVic {
/* Reset gui_listbox to nullptr, and remove all child elements. */
void clear();
- /* Remove all child elements except for the scrollbar. */
- void clear_children();
+ /* Remove child elements until there are remaining_child_count left excluding the scrollbar. */
+ void clear_children(int32_t remaining_child_count = 0);
+
+ void set_scroll_index(int32_t new_scroll_index, bool signal = true);
- void set_scroll_index(int32_t new_scroll_index);
+ godot::Error set_fixed(int32_t item_count, real_t item_height, bool signal = true);
+ godot::Error unset_fixed(bool signal = true);
/* Set the GUI::ListBox. This does not affect any existing child elements. */
godot::Error set_gui_listbox(GUI::ListBox const* new_gui_listbox);