Temp
This commit is contained in:
parent
ead8dfe39f
commit
987fb1cde9
@ -79,7 +79,7 @@ void setup() {
|
||||
.x = 30,
|
||||
.y = 50,
|
||||
.width = 350,
|
||||
.height = 250,
|
||||
.height = 270,
|
||||
.background_color = 0xbdf7,
|
||||
.foreground_color = COL_DARK_BLUE,
|
||||
.focused = true,
|
||||
|
||||
@ -55,8 +55,7 @@ void Desktop_Hander::draw_task_bar(int color) {
|
||||
}
|
||||
|
||||
void Desktop_Hander::draw_desktop_Item(const Desktop_Item& desktop_item) {
|
||||
tft->draw_box(desktop_item.place_x, desktop_item.place_y,
|
||||
desktop_item.icon_size_x, desktop_item.icon_size_y, 0x4648);
|
||||
tft->draw_box(desktop_item.place_x, desktop_item.place_y, desktop_item.icon_size_x, desktop_item.icon_size_y, 0x4648);
|
||||
}
|
||||
|
||||
void Desktop_Hander::on_click_event(const CLICK_EVENT& event) {
|
||||
@ -64,10 +63,11 @@ void Desktop_Hander::on_click_event(const CLICK_EVENT& event) {
|
||||
return;
|
||||
}
|
||||
|
||||
handle_desktop_click(event);
|
||||
int id = handle_desktop_click(event);
|
||||
bool task_bar_clicked = handle_taskbar_click(event);
|
||||
}
|
||||
|
||||
void Desktop_Hander::handle_desktop_click(const CLICK_EVENT& event) {
|
||||
int Desktop_Hander::handle_desktop_click(const CLICK_EVENT& event) {
|
||||
// Check if click is on desktop (not on taskbar or windows)
|
||||
// This is where you'd check if an icon was clicked
|
||||
for (const auto& item : items) {
|
||||
@ -78,9 +78,22 @@ void Desktop_Hander::handle_desktop_click(const CLICK_EVENT& event) {
|
||||
|
||||
Serial.print("Desktop item clicked: ");
|
||||
Serial.println(item.id);
|
||||
|
||||
|
||||
// TODO: Handle icon click (open window, etc.)
|
||||
break;
|
||||
return item.id;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool Desktop_Hander::handle_taskbar_click(const CLICK_EVENT& event) {
|
||||
if (event.x >= 6 && event.x <= (6 + 50) && event.y >= 298 && event.y <= (298 + 18)) {
|
||||
Serial.println("Taskbar button clicked");
|
||||
|
||||
// TODO: Handle icon click (open window, etc.)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -11,7 +11,8 @@ private:
|
||||
DISPLAY_STATE* display_state;
|
||||
std::vector<Desktop_Item> items;
|
||||
|
||||
void handle_desktop_click(const CLICK_EVENT& event);
|
||||
int handle_desktop_click(const CLICK_EVENT& event);
|
||||
bool handle_taskbar_click(const CLICK_EVENT& event);
|
||||
|
||||
public:
|
||||
void init(TFT_Handler* th, DISPLAY_STATE* ds);
|
||||
|
||||
@ -47,22 +47,22 @@ void InputManager::handle_button_press(int buttonIndex) {
|
||||
bool needs_redraw = false;
|
||||
|
||||
switch(buttonIndex) {
|
||||
case 0: // Right
|
||||
case 0:
|
||||
mi.x = (mi.x + 5 > 476) ? 476 : mi.x + 5;
|
||||
needs_redraw = true;
|
||||
break;
|
||||
|
||||
case 1: // Down
|
||||
case 1:
|
||||
mi.y = (mi.y + 5 > 316) ? 316 : mi.y + 5;
|
||||
needs_redraw = true;
|
||||
break;
|
||||
|
||||
case 2: // Up
|
||||
case 2:
|
||||
mi.y = (mi.y - 5 < 0) ? 0 : mi.y - 5;
|
||||
needs_redraw = true;
|
||||
break;
|
||||
|
||||
case 3: // Left
|
||||
case 3:
|
||||
mi.x = (mi.x - 5 < 0) ? 0 : mi.x - 5;
|
||||
needs_redraw = true;
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user