91 lines
3 KiB
C
91 lines
3 KiB
C
/*
|
|
* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
|
* Copyright (C) 2022 Scott Duensing
|
|
*
|
|
* http://kangaroopunch.com
|
|
*
|
|
*
|
|
* This file is part of Roo/E.
|
|
*
|
|
* Roo/E is free software: you can redistribute it and/or modify it under the
|
|
* terms of the GNU Affero General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* Roo/E is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
|
|
#ifndef WMWINDOW_H
|
|
#define WMWINDOW_H
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "widgets/scroll.h"
|
|
|
|
|
|
#define ICON_SIZE 32
|
|
#define GADGET_SIZE 20
|
|
|
|
#define WINDOW_PAINT_ICONS 0
|
|
#define WINDOW_PAINT_NORMAL 1
|
|
|
|
#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
|
|
|
|
#define WIN_STANDARD (WIN_CLOSE | WIN_MAXIMIZE | WIN_MINIMIZE | WIN_RESIZE | WIN_SCROLL_V | WIN_SCROLL_H)
|
|
|
|
|
|
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.
|
|
ScrollableT *scroll; // Window contents and scroll bars.
|
|
RectWT restore; // Size of window if they restore from maximized.
|
|
PointT restoreOffset; // Scroll position if they restore from maximized.
|
|
RectT bounds; // Window contents in screen space. Does not include titlebar or window chrome.
|
|
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 windowFocusSet(WindowT *win);
|
|
void windowMaximizeRestore(WindowT *win);
|
|
void windowMinimize(WindowT *win);
|
|
void windowMove(WindowT *win, uint16_t x, uint16_t y);
|
|
RegisterT *windowRegister(uint8_t magic);
|
|
void windowResize(WindowT *win, uint16_t width, uint16_t height);
|
|
|
|
|
|
void wmRender(void);
|
|
void wmShutdown(void);
|
|
void wmStartup(void);
|
|
void wmUpdate(EventT *event);
|
|
WindowT *wmWindowOnTopGet(void);
|
|
|
|
|
|
#endif // WMWINDOW_H
|