PocketPutr/Desktop_Test/program.h
2026-01-05 16:57:37 +01:00

75 lines
1.2 KiB
C++

#pragma once
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "GLOBALS.h"
#include <string>
#include <vector>
#include "program_registry.h"
struct TaskBarItem {
int id;
int place_x;
int place_y;
int width;
int height;
int offset_x;
bool focused;
std::string name;
};
struct DesktopItem {
int id;
int place_x;
int place_y;
int icon_size_x;
int icon_size_y;
std::string name;
};
enum class WindowAction {
EXIT = 1,
FILE = 2,
HELP = 3,
MINIMIZE = 4,
CLOSE = 5,
};
struct WindowDecoration {
int x_offset;
int y_offset;
int width;
int height;
WindowAction action;
};
struct Window {
int id;
int x;
int y;
int width;
int height;
int background_color;
int foreground_color;
bool focused;
bool minimized;
std::string title;
std::vector<WindowDecoration> window_decorations;
};
class Program {
private:
Window* _window;
DISPLAY_STATE* _display_state;
TaskHandle_t _task_handle;
static void loop(void* pvParameters);
public:
int _id;
std::string _task_name = "";
void (InstalledProgram::*_program_func)();
InstalledProgram _installed_program;
Program(DISPLAY_STATE* display_state);
int init(int id, std::string name, Window* window);
void close();
};