mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-05 06:20:44 +09:00
Change text renderer to pango (supports all languages and loads font automatically), start on game detection
This commit is contained in:
@@ -11,24 +11,24 @@
|
||||
namespace gsr {
|
||||
class ComboBox : public Widget {
|
||||
public:
|
||||
ComboBox(mgl::Font *font);
|
||||
ComboBox(const char *font_desc);
|
||||
ComboBox(const ComboBox&) = delete;
|
||||
ComboBox& operator=(const ComboBox&) = delete;
|
||||
|
||||
bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
|
||||
void draw(mgl::Window &window, mgl::vec2f offset) override;
|
||||
|
||||
void add_item(const std::string &text, const std::string &id, bool allow_duplicate = true);
|
||||
void add_item(std::string_view text, const std::string &id, bool allow_duplicate = true);
|
||||
void clear_items();
|
||||
|
||||
// The item can only be selected if it's enabled
|
||||
void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true);
|
||||
void set_item_enabled(const std::string &id, bool enabled);
|
||||
const std::string& get_selected_id() const;
|
||||
void set_selected_item(std::string_view id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true);
|
||||
void set_item_enabled(std::string_view id, bool enabled);
|
||||
std::string_view get_selected_id() const;
|
||||
|
||||
mgl::vec2f get_size() override;
|
||||
|
||||
std::function<void(const std::string &text, const std::string &id)> on_selection_changed;
|
||||
std::function<void(std::string_view text, std::string_view id)> on_selection_changed;
|
||||
private:
|
||||
void draw_selected(mgl::Window &window, mgl::vec2f draw_pos);
|
||||
void draw_unselected(mgl::Window &window, mgl::vec2f draw_pos);
|
||||
@@ -44,7 +44,8 @@ namespace gsr {
|
||||
};
|
||||
|
||||
mgl::vec2f max_size;
|
||||
mgl::Font *font;
|
||||
std::string font_desc;
|
||||
int font_size = 0;
|
||||
std::vector<Item> items;
|
||||
mgl::Sprite dropdown_arrow;
|
||||
bool dirty = true;
|
||||
|
||||
Reference in New Issue
Block a user