roo_e/client/src/gui/wmwindow.h
2022-06-20 18:09:51 -05:00

55 lines
1.7 KiB
C

#ifndef WMWINDOW_H
#define WMWINDOW_H
#include "gui.h"
#define WIN_NONE 0
#define WIN_CLOSE 1
#define WIN_MAXIMIZE 2
#define WIN_MINIMIZE 4
#define WIN_RESIZE 8
#define WIN_SCROLL_V 16
#define WIN_SCROLL_H 32
#define WIN_IS_ICON 64
#define WIN_IS_MAX 128
typedef struct WindowS {
WidgetT base; // Required by all widgets.
char *title; // Title of window.
uint8_t flags; // Window flags (see defines above).
RectT close; // Coordinates of close box, if any.
RectT titlebar; // Coordinates of title bar, if any.
RectT minimize; // Coordinates of minimize box, if any.
RectT maximize; // Coordinates of maximize box, if any.
RectT resize1; // First resize area.
RectT resize2; // Second resize area.
RectT bounds; // Inside edge of window frame.
RectT restore; // Size of window if they restore from maximized.
SurfaceT *content; // Actual window contents - widgets and such.
SurfaceT *cached; // Once rendered, keep a cached copy for faster redrawing.
} WindowT;
extern uint8_t __MAGIC_WINDOW; // Magic ID assigned to us from the GUI.
WindowT *windowCreate(uint16_t x, uint16_t y, uint16_t w, uint16_t h, char *title, int flags, ...);
void windowDestroy(struct WidgetS *widget, ...);
void windowFocusSet(WindowT *win);
void windowMaximizeRestore(WindowT *win);
void windowMinimize(WindowT *win);
void windowMoveTo(WindowT *win, uint16_t x, uint16_t y);
void windowPaint(struct WidgetS *widget, ...);
RegisterT *windowRegister(uint8_t magic);
void windowResizeTo(WindowT *win, uint16_t width, uint16_t height);
void wmShutdown(void);
void wmStartup(void);
void wmUpdate(EventT *event);
#endif // WMWINDOW_H