aboutsummaryrefslogtreecommitdiff
path: root/include/gui
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
commit3a20c417cbf7d5db1d9d26abfbda388e58f96c18 (patch)
treea7552bff0a5164446eaade0dde570cd6111e474d /include/gui
parentc080342fcd358561af7edc64cea2222880923b93 (diff)
Align list items, dont process selected item twice if changed in event loop, mouse button events should only occur when pressing left mouse button
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/ComboBox.hpp1
-rw-r--r--include/gui/List.hpp9
2 files changed, 9 insertions, 1 deletions
diff --git a/include/gui/ComboBox.hpp b/include/gui/ComboBox.hpp
index 591901c..70a79a7 100644
--- a/include/gui/ComboBox.hpp
+++ b/include/gui/ComboBox.hpp
@@ -16,6 +16,7 @@ namespace gsr {
void draw(mgl::Window &window, mgl::vec2f offset) override;
void add_item(const std::string &text, const std::string &id);
+ void set_selected_item(const std::string &id);
mgl::vec2f get_size() override;
private:
diff --git a/include/gui/List.hpp b/include/gui/List.hpp
index 23bf5ea..8c4e1fc 100644
--- a/include/gui/List.hpp
+++ b/include/gui/List.hpp
@@ -12,7 +12,13 @@ namespace gsr {
HORIZONTAL
};
- List(Orientation orientation);
+ enum class Alignment {
+ START,
+ CENTER,
+ END
+ };
+
+ List(Orientation orientation, Alignment content_alignment = Alignment::START);
List(const List&) = delete;
List& operator=(const List&) = delete;
@@ -24,5 +30,6 @@ namespace gsr {
protected:
std::vector<std::unique_ptr<Widget>> widgets;
Orientation orientation;
+ Alignment content_alignment;
};
} \ No newline at end of file