Prepare for display orientation part 1 (#2661)

This commit is contained in:
Totoo
2025-05-22 17:24:53 +02:00
committed by GitHub
parent 6f6d863a14
commit a1d7cf2b86
85 changed files with 405 additions and 334 deletions
+11 -5
View File
@@ -55,7 +55,7 @@ void load_blacklist();
class BtnGridView : public View {
public:
BtnGridView(Rect new_parent_rect = {0, 0, 240, 304}, bool keep_highlight = false);
BtnGridView(Rect new_parent_rect = {0, 0, screen_width, screen_height - 16}, bool keep_highlight = false);
~BtnGridView();
@@ -89,27 +89,33 @@ class BtnGridView : public View {
bool blacklisted_app(GridItem new_item);
void update_items();
void set_btn_min_max_height(uint8_t min, uint8_t max) {
btn_h_min = min;
btn_h_max = max;
}
protected:
virtual void on_populate() = 0;
private:
int rows_{3};
uint8_t btn_h_min{40};
uint8_t btn_h_max{60};
bool keep_highlight{false};
std::vector<GridItem> menu_items{};
std::vector<std::unique_ptr<NewButton>> menu_item_views{};
Button button_pgup{
{0, 324, 120, 16},
{0, 1324, 120, 16},
" "};
Button button_pgdown{
{121, 324, 119, 16},
{121, 1324, 119, 16},
" "};
int button_w = 240 / rows_;
static constexpr int button_h = 48;
int button_w = screen_width / rows_;
int button_h = 48;
size_t displayed_max{0};
size_t highlighted_item{0};
size_t offset{0};