diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/CustomRendererWidget.hpp | 1 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 12 | ||||
-rw-r--r-- | include/gui/Subsection.hpp | 24 | ||||
-rw-r--r-- | include/gui/Widget.hpp | 1 |
4 files changed, 34 insertions, 4 deletions
diff --git a/include/gui/CustomRendererWidget.hpp b/include/gui/CustomRendererWidget.hpp index e16e532..20bfec8 100644 --- a/include/gui/CustomRendererWidget.hpp +++ b/include/gui/CustomRendererWidget.hpp @@ -15,6 +15,7 @@ namespace gsr { void draw(mgl::Window &window, mgl::vec2f offset) override; mgl::vec2f get_size() override; + void set_size(mgl::vec2f size); std::function<void(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size)> draw_handler; // Return true to allow other widgets to handle events diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index 1ad4c67..b22506e 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -13,6 +13,7 @@ namespace gsr { class GsrPage; class PageStack; + class ScrollablePage; class SettingsPage : public StaticPage { public: @@ -31,7 +32,7 @@ namespace gsr { private: std::unique_ptr<RadioButton> create_view_radio_button(); std::unique_ptr<ComboBox> create_record_area_box(const GsrInfo &gsr_info); - std::unique_ptr<List> create_record_area(const GsrInfo &gsr_info); + std::unique_ptr<Widget> create_record_area(const GsrInfo &gsr_info); std::unique_ptr<List> create_select_window(); std::unique_ptr<Entry> create_area_width_entry(); std::unique_ptr<Entry> create_area_height_entry(); @@ -39,14 +40,14 @@ namespace gsr { std::unique_ptr<List> create_area_size_section(); std::unique_ptr<CheckBox> create_restore_portal_session_checkbox(); std::unique_ptr<List> create_restore_portal_session_section(); - std::unique_ptr<List> create_capture_target(const GsrInfo &gsr_info); + std::unique_ptr<Widget> create_capture_target(const GsrInfo &gsr_info); std::unique_ptr<ComboBox> create_audio_track_selection_checkbox(const std::vector<AudioDevice> &audio_devices); std::unique_ptr<Button> create_remove_audio_track_button(List *audio_device_list_ptr); std::unique_ptr<List> create_audio_track(const std::vector<AudioDevice> &audio_devices); std::unique_ptr<Button> create_add_audio_track_button(const std::vector<AudioDevice> &audio_devices); std::unique_ptr<List> create_audio_track_section(const std::vector<AudioDevice> &audio_devices); std::unique_ptr<CheckBox> create_merge_audio_tracks_checkbox(); - std::unique_ptr<List> create_audio_device_section(const std::vector<AudioDevice> &audio_devices); + std::unique_ptr<Widget> create_audio_device_section(const std::vector<AudioDevice> &audio_devices); std::unique_ptr<ComboBox> create_video_quality_box(); std::unique_ptr<List> create_video_quality(); std::unique_ptr<ComboBox> create_color_range_box(); @@ -62,7 +63,9 @@ namespace gsr { std::unique_ptr<ComboBox> create_framerate_mode_box(); std::unique_ptr<List> create_framerate_mode(); std::unique_ptr<List> create_framerate_section(); - std::unique_ptr<List> create_settings(const GsrInfo &gsr_info, const std::vector<AudioDevice> &audio_devices); + std::unique_ptr<Widget> create_record_cursor_section(); + std::unique_ptr<Widget> create_video_section(const GsrInfo &gsr_info); + std::unique_ptr<Widget> create_settings(const GsrInfo &gsr_info, const std::vector<AudioDevice> &audio_devices); void add_widgets(const GsrInfo &gsr_info, const std::vector<AudioDevice> &audio_devices); void add_page_specific_widgets(); @@ -92,6 +95,7 @@ namespace gsr { std::optional<Config> &config; GsrPage *content_page_ptr = nullptr; + ScrollablePage *settings_scrollable_page_ptr = nullptr; List *settings_list_ptr = nullptr; List *select_window_list_ptr = nullptr; List *area_size_list_ptr = nullptr; diff --git a/include/gui/Subsection.hpp b/include/gui/Subsection.hpp new file mode 100644 index 0000000..90cb798 --- /dev/null +++ b/include/gui/Subsection.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "Widget.hpp" +#include "Label.hpp" +#include <memory> + +namespace gsr { + class Subsection : public Widget { + public: + // If size width or height is 0 then the size in that direction is the size of the widgets + Subsection(const char *title, std::unique_ptr<Widget> inner_widget, mgl::vec2f size); + Subsection(const Subsection&) = delete; + Subsection& operator=(const Subsection&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + mgl::vec2f get_size() override; + private: + Label label; + std::unique_ptr<Widget> inner_widget; + mgl::vec2f size; + }; +}
\ No newline at end of file diff --git a/include/gui/Widget.hpp b/include/gui/Widget.hpp index 498ca05..9a18722 100644 --- a/include/gui/Widget.hpp +++ b/include/gui/Widget.hpp @@ -13,6 +13,7 @@ namespace gsr { friend class ScrollablePage; friend class List; friend class Page; + friend class Subsection; public: enum class Alignment { START, |