mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 17:27:05 +09:00
Remove scrollable page from gsr page, fix crash when navigating back
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
namespace gsr {
|
||||
class FileChooser : public Widget {
|
||||
public:
|
||||
FileChooser(const char *start_directory, mgl::vec2f content_size);
|
||||
FileChooser(const char *start_directory, mgl::vec2f size);
|
||||
FileChooser(const FileChooser&) = delete;
|
||||
FileChooser& operator=(const FileChooser&) = delete;
|
||||
|
||||
@@ -24,11 +24,16 @@ namespace gsr {
|
||||
|
||||
void set_current_directory(const char *directory);
|
||||
private:
|
||||
mgl::vec2f content_size;
|
||||
struct Folder {
|
||||
mgl::Text text;
|
||||
time_t last_modified_seconds = 0;
|
||||
};
|
||||
|
||||
mgl::vec2f size;
|
||||
mgl::Text current_directory_text;
|
||||
int mouse_over_item = -1;
|
||||
int selected_item = -1;
|
||||
std::vector<mgl::Text> folders;
|
||||
std::vector<Folder> folders;
|
||||
mgl::Clock double_click_timer;
|
||||
int times_clicked_within_timer = 0;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Page.hpp"
|
||||
#include "ScrollablePage.hpp"
|
||||
#include "Button.hpp"
|
||||
|
||||
#include <mglpp/graphics/Text.hpp>
|
||||
@@ -19,20 +18,21 @@ namespace gsr {
|
||||
mgl::vec2f get_size() override;
|
||||
mgl::vec2f get_inner_size() override;
|
||||
|
||||
void add_widget(std::unique_ptr<Widget> widget) override;
|
||||
|
||||
void set_margins(float top, float bottom, float left, float right);
|
||||
void set_on_back_button_click(std::function<void()> on_click_handler);
|
||||
private:
|
||||
void draw_page_label(mgl::Window &window, mgl::vec2f body_pos);
|
||||
void draw_children(mgl::Window &window, mgl::vec2f position);
|
||||
|
||||
float get_border_size() const;
|
||||
float get_horizontal_spacing() const;
|
||||
mgl::vec2f get_content_position();
|
||||
mgl::vec2f get_content_position_with_margin();
|
||||
private:
|
||||
float margin_top_scale = 0.0f;
|
||||
float margin_bottom_scale = 0.0f;
|
||||
float margin_left_scale = 0.0f;
|
||||
float margin_right_scale = 0.0f;
|
||||
ScrollablePage scrollable_body;
|
||||
Button back_button;
|
||||
mgl::Text label_text;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Widget.hpp"
|
||||
#include <vector>
|
||||
#include "../SafeVector.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace gsr {
|
||||
@@ -19,6 +19,6 @@ namespace gsr {
|
||||
|
||||
virtual void add_widget(std::unique_ptr<Widget> widget);
|
||||
protected:
|
||||
std::vector<std::unique_ptr<Widget>> widgets;
|
||||
SafeVector<std::unique_ptr<Widget>> widgets;
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Widget.hpp"
|
||||
#include "../SafeVector.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace gsr {
|
||||
class ScrollablePage : public Widget {
|
||||
@@ -20,6 +20,6 @@ namespace gsr {
|
||||
void add_widget(std::unique_ptr<Widget> widget);
|
||||
private:
|
||||
mgl::vec2f size;
|
||||
std::vector<std::unique_ptr<Widget>> widgets;
|
||||
SafeVector<std::unique_ptr<Widget>> widgets;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user