From dd906c6a9dde666af0b10cc016039f312733201f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 11 Sep 2024 00:54:57 +0200 Subject: Make scrollbar movable with mouse, limit filechooser content to inside of file item --- include/gui/ScrollablePage.hpp | 9 +++++++++ include/gui/SettingsPage.hpp | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'include/gui') diff --git a/include/gui/ScrollablePage.hpp b/include/gui/ScrollablePage.hpp index 5a31b92..ade7c67 100644 --- a/include/gui/ScrollablePage.hpp +++ b/include/gui/ScrollablePage.hpp @@ -4,6 +4,8 @@ #include "../SafeVector.hpp" #include +#include + namespace gsr { class ScrollablePage : public Widget { public: @@ -15,15 +17,22 @@ namespace gsr { void draw(mgl::Window &window, mgl::vec2f offset) override; mgl::vec2f get_size() override; + mgl::vec2f get_inner_size() override; void set_size(mgl::vec2f size); void add_widget(std::unique_ptr widget); void reset_scroll(); + private: + float get_scrollbar_width() const; private: mgl::vec2f size; SafeVector> widgets; int scroll_target_y = 0; double scroll_y = 0.0; + mgl::FloatRect scrollbar_rect; + bool moving_scrollbar_with_cursor = false; + mgl::vec2f scrollbar_move_cursor_start_pos; + double scrollbar_move_cursor_scroll_y_start = 0.0; }; } \ No newline at end of file diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index b22506e..a9d79bc 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -57,7 +57,6 @@ namespace gsr { std::unique_ptr create_video_codec(const GsrInfo &gsr_info); std::unique_ptr create_audio_codec_box(); std::unique_ptr create_audio_codec(); - std::unique_ptr create_codec_section(const GsrInfo &gsr_info); std::unique_ptr create_framerate_entry(); std::unique_ptr create_framerate(); std::unique_ptr create_framerate_mode_box(); @@ -101,7 +100,8 @@ namespace gsr { List *area_size_list_ptr = nullptr; List *restore_portal_session_list_ptr = nullptr; List *color_range_list_ptr = nullptr; - List *codec_list_ptr = nullptr; + Widget *video_codec_ptr = nullptr; + Widget *audio_codec_ptr = nullptr; List *framerate_mode_list_ptr = nullptr; ComboBox *record_area_box_ptr = nullptr; Entry *area_width_entry_ptr = nullptr; -- cgit v1.2.3