Foenix A2650 OS/f Library
 
Loading...
Searching...
No Matches
window.h
Go to the documentation of this file.
1
2
3/*
4 * window.h
5 *
6* Created on: Mar 19, 2022
7 * Author: micahbly
8 */
9
10#ifndef LIB_WINDOW_H_
11#define LIB_WINDOW_H_
12
13
14/* about this library: Window
15 *
16 * This provides functionality for working with windows
17 *
18 * See also: control.h
19 *
20 *** things this library needs to be able to do
21 * Create a new window instance based on a Theme object and other parameters
22 * Render a window on the screen
23 * Receive and manage events
24 * Identify which control is affected by a mouse click or mouse move event
25 * Manage state of all controls on the window
26 * Handle resizing/minimizing/maximizing of window
27 * Reposition controls on window in response to resize events
28 *
29 *
30 * STRETCH GOALS
31 *
32 *
33 * SUPER STRETCH GOALS
34 *
35 *
36 */
37
38
39/*****************************************************************************/
40/* Includes */
41/*****************************************************************************/
42
43// project includes
44#include "control.h"
45#include "mouse.h"
46
47// C includes
48#include <stdbool.h>
49
50// A2560 includes
51#include <mcp/syscalls.h>
52#include "a2560k.h"
53
54
55/*****************************************************************************/
56/* Macro Definitions */
57/*****************************************************************************/
58
59#define WIN_DEFAULT_WIDTH 512
60#define WIN_DEFAULT_HEIGHT 342
61#define WIN_DEFAULT_MIN_WIDTH 90
62#define WIN_DEFAULT_MIN_HEIGHT 60
63#define WIN_DEFAULT_MAX_WIDTH 800
64#define WIN_DEFAULT_MAX_HEIGHT 600
65
66#define WIN_DEFAULT_DRAG_ZONE_SIZE 3
67
68#define WIN_DEFAULT_X 50
69#define WIN_DEFAULT_Y 25
70#define WIN_STAGGER_X 14 // when multiple windows are opened, how far apart are they positioned?
71#define WIN_STAGGER_Y 14
72
73#define WINDOW_MAX_WINTITLE_SIZE 128
74
75#define WIN_MAX_CLIP_RECTS 10
76#define WIN_MENU_MAX_GROUPS 4
77
78#define WIN_PARAM_OPEN_AS_BACKDROP true // Window_New() parameter
79#define WIN_PARAM_DO_NOT_OPEN_AS_BACKDROP false // Window_New() parameter
80
81#define WIN_PARAM_FORCE_CONTROL_REDRAW true // Window_DrawControls() parameter
82#define WIN_PARAM_ONLY_REDRAW_INVAL_CONTROLS false // Window_DrawControls() parameter
83
84#define WIN_PARAM_UPDATE_NORM_SIZE_TO_MATCH true // Window_ChangeWindow() parameter
85#define WIN_PARAM_DO_NOT_UPDATE_NORM_SIZE false // Window_ChangeWindow() parameter
86
87
88/*****************************************************************************/
89/* Enumerations */
90/*****************************************************************************/
91
92typedef enum window_type
93{
94 WIN_STANDARD = 0,
95 WIN_BACKDROP = 1,
96 WIN_DIALOG = 2,
97 WIN_UNKNOWN_TYPE,
98} window_type;
99
100typedef enum window_state
101{
102 WIN_HIDDEN = 0,
103 WIN_MINIMIZED = 1,
104 WIN_NORMAL = 2,
105 WIN_MAXIMIZED = 3,
106 WIN_UNKNOWN_STATE,
107} window_state;
108
109typedef enum window_base_control_id
110{
111 CLOSE_WIDGET_ID = 0,
112 MINIMIZE_WIDGET_ID = 1,
113 NORM_SIZE_WIDGET_ID = 2,
114 MAXIMIZE_WIDGET_ID = 3,
115 MAX_BUILT_IN_WIDGET = 4,
116} window_base_control_id;
117
118
119
120
121/*****************************************************************************/
122/* Structs */
123/*****************************************************************************/
124
125
127{
128 int16_t x_; // horizontal coordinate, relative to the parent window
129 int16_t y_; // vertical coordinate, relative to the parent window
130 int16_t width_;
131 int16_t height_;
132};
133
134struct Window
135{
136 uint8_t id_; // reserved. Not currently used.
137 int8_t display_order_; // 0 = active window, ascending order from there. maintained by system.
138 uint32_t user_data_; // 32 bits for use of programs. The system will not process this field.
139 char* title_;
140 window_type type_;
141 window_state state_; // read-only: whether the window is currently hidden, minimized, normal/window sized, or maximized
142 Bitmap* bitmap_; // on-screen bitmap covering the visible portion of window
143 Bitmap* buffer_bitmap_; // off-screen bitmap covering the visible portion of window
144// struct Region* global_region_;
145// struct Region* content_region_; // portion of window that will contain content. excludes the borders and title bar
146// struct Region* iconbar_region_; // region for the iconbar, if any
147// struct Region* titlebar_region_;
148 int16_t pen_x_; // H position relative to the content_rect_, of the "pen", for drawing functions
149 int16_t pen_y_; // V position relative to the content_rect_, of the "pen", for drawing functions
150 uint8_t pen_color_; // Color index of the "pen", for drawing functions
151 Font* pen_font_; // Font to be used by the "pen", for drawing functions
152 Rectangle overall_rect_; // the local rect describing the total area of the window
153 Rectangle titlebar_rect_; // the local rect describing the titlebar area
154 Rectangle title_drag_rect_; // the local rect describing the drag zone for the titlebar (excludes the close/etc controls)
155 Rectangle iconbar_rect_; // the local rect describing the optional iconbar area
156 Rectangle content_rect_; // the local rect describing the content area of the window
157 Rectangle grow_left_rect_; // the local rect defining the area in which a click/drag will resize window
158 Rectangle grow_right_rect_; // the local rect defining the area in which a click/drag will resize window
159 Rectangle grow_top_rect_; // the local rect defining the area in which a click/drag will resize window
160 Rectangle grow_bottom_rect_; // the local rect defining the area in which a click/drag will resize window
161 Rectangle grow_bottom_right_rect_; // the local rect defining the area in which a click/drag will resize window
162 bool show_iconbar_; // true if the iconbar area should be rendered
163 bool is_backdrop_; // true if this is the backdrop (desktop) window
164 bool visible_; // is the window visible?
165 bool active_; // keep 1 window as the active one. only active windows get regular updates
166 bool changes_to_save_; // starts at false; if window is resized or repositioned, is set to true. used to know if we have to save out to icon file when window is closed.
167 bool can_resize_; // if true, window can be stretched or shrunk. If false, the width_ and height_ will be locked.
168 bool invalidated_; // if true, the window needs to be completely re-rendered on the next render pass
169 bool titlebar_invalidated_; // if true, the titlebar needs to be redrawn and reblitted on the next render pass
170 int16_t x_; // current global horizontal coordinate
171 int16_t y_; // current global vertical coordinate
172 int16_t proposed_x_; // during a window drag or resize event, the potential future global horizontal coordinate
173 int16_t proposed_y_; // during a window drag or resize event, the potential future global vertical coordinate
174 Rectangle global_rect_; // the global rect describing the total area of the window
175 int16_t width_; // current width of window
176 int16_t height_; // current height of window
177 int16_t norm_x_; // global horizontal coordinate when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
178 int16_t norm_y_; // global vertical coordinate when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
179 int16_t norm_width_; // width of window when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
180 int16_t norm_height_; // height of window when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
181 int16_t min_width_; // minimum width of window when in window-sized (normal) mode.
182 int16_t min_height_; // minimum height of window when in window-sized (normal) mode.
183 int16_t max_width_; // maximum width of window when in window-sized (normal) mode. If > 0, the window will not maximize. Default 0.
184 int16_t max_height_; // maximum height of window when in window-sized (normal) mode. If > 0, the window will not maximize. Default 0.
185 int16_t inner_width_; // space available inside the content area, accounting for border thicknesses
186 int16_t inner_height_; // space available inside the content area, accounting for border thicknesses and title bar
187 int16_t avail_title_width_; // available pixel width for the title to be rendered, based on delta between title x offset and left-most titlebar control
188 int16_t content_left_; // of the raw x pos of the window (non-gzz), the x pos where window should start rendering content. =gzz_left_ until window is scrolled leftwards
189 int16_t content_top_; // of the raw y pos of the window (non-gzz), the y pos where window should start rendering content. =gzz_top_ until window is scrolled down
190 int16_t required_inner_width_; // greater of current inner_width or H space required inside the window to display all content. If greater than H space, a scroller is needed.
191 int16_t required_inner_height_; // greater of current inner_height or V space required inside the window to display all content. If greater than V space, a scroller is needed.
192 bool h_scroller_visible_;
193 bool v_scroller_visible_;
194 Bitmap* pattern_; // optional pattern used for filling the window content rect background on refresh.
195 Window* parent_window_; // can be NULL. used for requesters that are spawned from a specific window.
196 Window* child_window_; // can be NULL. used when a window spawns a requester. (This is the requester). NULLs out again when requester is closed.
197 Control* root_control_; // first control in the window
198 Control* selected_control_; // the currently selected control for the window. Only 1 can be selected per window. No guarantee that any are selected.
199 Rectangle clip_rect_[WIN_MAX_CLIP_RECTS]; // one or more clipping rects; determines which parts of window need to be blitted to the main screen
200 int16_t clip_count_; // number of clip rects the window is currently tracking
201 Rectangle damage_rect_[4]; // 0 to 4 rects that describe to other windows under this one, which parts of the screen were previously covered by this window (prior to a move or resize)
202 int16_t damage_count_; // number of damage rects the window is currently tracking
203 void (*event_handler_)(EventRecord*); // function that will be called by the system when an event related to the window is encountered.
204 Menu* menu_[WIN_MENU_MAX_GROUPS]; // non-permanent containers for menu structures; will be used for first, 2nd, 3rd, and 4th level menus as used in the window.
205 int16_t current_menu_level_; // index to menu_[]; starts out at menu_no_menu; when a menu is opened, it goes to menu_level_0; increases with each submenu. Resets to menu_no_men uon close of menu.
206// Window* zoom_to_window_; // the window that contains the zoom_to_file, so we can get offset to global screen coords
207// int16_t zoom_x_[WIN_ZOOM_RECT_COUNT]; // Used to plot the coords for zoom rects when opening/closing window
208// int16_t zoom_y_[WIN_ZOOM_RECT_COUNT]; // Used to plot the coords for zoom rects when opening/closing window
209// int16_t zoom_w_[WIN_ZOOM_RECT_COUNT]; // Used to plot the coords for zoom rects when opening/closing window
210// int16_t zoom_h_[WIN_ZOOM_RECT_COUNT]; // Used to plot the coords for zoom rects when opening/closing window
211// unsigned char* keyboard_buffer_; // used by key detection
212// uint16_t keyboard_buf_pos_; // used by key detection
213};
214
215
217{
218 uint32_t user_data_; // 32 bits for use of programs. The system will not process this field.
219 char* title_;
220 window_type type_;
221 Bitmap* bitmap_; // on-screen bitmap covering the visible portion of window
222 Bitmap* buffer_bitmap_; // off-screen bitmap covering the visible portion of window
223 bool show_iconbar_; // true if the iconbar area should be rendered
224 bool is_backdrop_; // true if this is the backdrop (desktop) window
225 bool can_resize_; // if true, window can be stretched or shrunk. If false, the width_ and height_ will be locked.
226 int16_t x_; // horizontal coordinate when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
227 int16_t y_; // vertical coordinate when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
228 int16_t width_; // width of window when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
229 int16_t height_; // height of window when in window-sized (normal) mode. Not adjusted when window is minimized or maximized.
230 int16_t min_width_; // minimum width of window when in window-sized (normal) mode.
231 int16_t min_height_; // minimum height of window when in window-sized (normal) mode.
232 int16_t max_width_; // maximum width of window when in window-sized (normal) mode. If > 0, the window will not maximize. Default 0.
233 int16_t max_height_; // maximum height of window when in window-sized (normal) mode. If > 0, the window will not maximize. Default 0.
234};
235
236/*****************************************************************************/
237/* Global Variables */
238/*****************************************************************************/
239
240
241/*****************************************************************************/
242/* Public Function Prototypes */
243/*****************************************************************************/
244
245
246// **** CONSTRUCTOR AND DESTRUCTOR *****
247
248// constructor
258Window* Window_New(NewWinTemplate* the_win_template, void (* event_handler)(EventRecord*));
259
260// destructor
261// frees all allocated memory associated with the passed object, and the object itself
263bool Window_Destroy(Window** the_window);
264
270NewWinTemplate* Window_GetNewWinTemplate(char* the_win_title);
271
272
273
274// **** CLIP RECT MANAGEMENT functions *****
275
282bool Window_AddClipRect(Window* the_window, Rectangle* new_rect);
283
287bool Window_MergeClipRects(Window* the_window);
288
293bool Window_BlitClipRects(Window* the_window);
294
300bool Window_GenerateDamageRects(Window* the_window, Rectangle* the_old_rect);
301
308bool Window_AcceptDamageRect(Window* the_window, Rectangle* damage_rect);
309
310
311
312// **** BUILT-IN PSEUDO CONTROL MANAGEMENT functions *****
313
319//@ return Returns mouseFree if the coordinates are in anything but a draggable region. Otherwise returns mouseResizeUp, etc., as appropriate.
320MouseMode Window_CheckForDragZone(Window* the_window, int16_t x, int16_t y);
321
322
323
324// **** CONTROL MANAGEMENT functions *****
325
330bool Window_SetSelectedControl(Window* the_window, Control* the_control);
331
336bool Window_AddControl(Window* the_window, Control* the_control);
337
344Control* Window_AddNewControlFromTemplate(Window* the_window, ControlTemplate* the_template, int16_t the_id, int16_t group_id);
345
359Control* Window_AddNewControl(Window* the_window, control_type the_type, int16_t width, int16_t height, int16_t x_offset, int16_t y_offset, h_align_type the_h_align, v_align_type the_v_align, char* the_caption, int16_t the_id, int16_t group_id);
360
364void Window_InvalidateTitlebar(Window* the_window);
365
369void Window_InvalidateControlByID(Window* the_window, uint16_t the_control_id);
370
371
372
377
382
388Control* Window_GetControl(Window* the_window, int16_t the_control_id);
389
395int16_t Window_GetControlID(Window* the_window, Control* the_control);
396
403Control* Window_GetControlAtXY(Window* the_window, int16_t x, int16_t y);
404
405
406
407// **** Set functions *****
408
409
414void Window_SetTitle(Window* the_window, char* the_title);
415
420void Window_SetVisible(Window* the_window, bool is_visible);
421
427void Window_SetDisplayOrder(Window* the_window, int8_t the_display_order);
428
433void Window_SetActive(Window* the_window, bool is_active);
434
439void Window_SetState(Window* the_window, window_state the_state);
440
448void Window_EvaluateWindowChange(Window* the_window, int16_t* x, int16_t* y, int16_t* width, int16_t* height);
449
459void Window_ChangeWindow(Window* the_window, int16_t x, int16_t y, int16_t width, int16_t height, bool update_norm);
460
464void Window_Maximize(Window* the_window);
465
469void Window_NormSize(Window* the_window);
470
474void Window_Minimize(Window* the_window);
475
476
477// **** Get functions *****
478
479
485char* Window_GetTitle(Window* the_window);
486
491uint32_t Window_GetUserData(Window* the_window);
492
496window_type Window_GetType(Window* the_window);
497
501window_state Window_GetState(Window* the_window);
502
507Bitmap* Window_GetBitmap(Window* the_window);
508
512int16_t Window_GetX(Window* the_window);
513
517int16_t Window_GetY(Window* the_window);
518
522int16_t Window_GetWidth(Window* the_window);
523
527int16_t Window_GetHeight(Window* the_window);
528
532bool Window_IsBackdrop(Window* the_window);
533
538bool Window_IsVisible(Window* the_window);
539
543bool Window_IsActive(Window* the_window);
544
545
546
547// **** RENDER functions *****
548
551void Window_Render(Window* the_window);
552
555void Window_ClearContent(Window* the_window);
556
559void Window_UpdateTheme(Window* the_window);
560
564void Window_Invalidate(Window* the_window);
565
566
567
568// **** DRAW functions *****
569
574void Window_GlobalToLocal(Window* the_window, int16_t* x, int16_t* y);
575
580void Window_LocalToGlobal(Window* the_window, int16_t* x, int16_t* y);
581
589bool Window_SetFont(Window* the_window, Font* the_font);
590
598bool Window_SetColor(Window* the_window, uint8_t the_color);
599
607bool Window_SetPenXYFromGlobal(Window* the_window, int16_t x, int16_t y);
608
616bool Window_SetPenXY(Window* the_window, int16_t x, int16_t y);
617
626bool Window_Blit(Window* the_window, Bitmap* src_bm, int16_t src_x, int16_t src_y, int16_t width, int16_t height);
627
634bool Window_FillBox(Window* the_window, int16_t width, int16_t height, uint8_t the_color);
635
641bool Window_FillBoxRect(Window* the_window, Rectangle* the_coords, uint8_t the_color);
642
647bool Window_SetPixel(Window* the_window, uint8_t the_color);
648
658bool Window_DrawLine(Window* the_window, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t the_color);
659
665bool Window_DrawHLine(Window* the_window, int16_t the_line_len, uint8_t the_color);
666
672bool Window_DrawVLine(Window* the_window, int16_t the_line_len, uint8_t the_color);
673
679bool Window_DrawBoxRect(Window* the_window, Rectangle* the_coords, uint8_t the_color);
680
689bool Window_DrawBoxCoords(Window* the_window, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t the_color);
690
698bool Window_DrawBox(Window* the_window, int16_t width, int16_t height, uint8_t the_color, bool do_fill);
699
708bool Window_DrawRoundBox(Window* the_window, int16_t width, int16_t height, int16_t radius, uint8_t the_color, bool do_fill);
709
715bool Window_DrawCircle(Window* the_window, int16_t radius, uint8_t the_color);
716
717// Draw a string at the current "pen" location, using the current pen color of the Window
718// Truncate, but still draw the string if it is too long to display on the line it started.
719// No word wrap is performed.
720// If max_chars is less than the string length, only that many characters will be drawn (as space allows)
721// If max_chars is -1, then the full string length will be drawn, as space allows.
722bool Window_DrawString(Window* the_window, char* the_string, int16_t max_chars);
723
735char* Window_DrawStringInBox(Window* the_window, int16_t width, int16_t height, char* the_string, int16_t num_chars, char** wrap_buffer, bool (* continue_function)(void));
736
737
738
739// **** Debug functions *****
740
742void Window_Print(Window* the_window);
743
744// helper function called by List class's print function: prints one window entry
745void Window_PrintBrief(void* the_payload);
746
747
748#endif /* LIB_WINDOW_H_ */
749
750
control_type
Definition: control.h:83
Definition: bitmap.h:97
Definition: window.h:127
This structure describes an instantiated control on a window.
Definition: control.h:130
A structure that can be used to instantiate a ControlTemplate object instance in a window The Control...
Definition: control_template.h:69
Definition: event.h:211
This Font object is essentially the Mac "fontRecord" struct, with added pointers for the data tables.
Definition: font.h:71
Definition: menu.h:120
Definition: window.h:217
Definition: a2560k.h:1369
Definition: window.h:135
bool Window_SetPixel(Window *the_window, uint8_t the_color)
Set the color of the pixel at the current pen location.
Definition: window.c:2813
char * Window_GetTitle(Window *the_window)
Get a pointer to the current window title Note: It is not guaranteed that every window will have a ti...
Definition: window.c:2321
void Window_Invalidate(Window *the_window)
Mark entire window as invalidated This will cause it to be redrawn and fully reblitted in the next re...
Definition: window.c:1885
window_type Window_GetType(Window *the_window)
Get the window's type (normal, backdrop, dialog, etc.)
Definition: window.c:2360
bool Window_AddClipRect(Window *the_window, Rectangle *new_rect)
Copy the passed rectangle to the window's clip rect collection If the window already has the maximum ...
Definition: window.c:1088
window_state Window_GetState(Window *the_window)
Get the window's state (maximized, minimized, etc.)
Definition: window.c:2379
bool Window_DrawBox(Window *the_window, int16_t width, int16_t height, uint8_t the_color, bool do_fill)
Draws a rectangle based on start coords and width/height, and optionally fills the rectangle.
Definition: window.c:2971
bool Window_DrawRoundBox(Window *the_window, int16_t width, int16_t height, int16_t radius, uint8_t the_color, bool do_fill)
Draws a rounded rectangle from the current pen location, with the specified size and radius,...
Definition: window.c:2995
bool Window_IsActive(Window *the_window)
Get the active/inactive condition of the window.
Definition: window.c:2533
Control * Window_GetLastControl(Window *the_window)
Find and return the last control in the window's chain of controls This corresponds to the first cont...
Definition: window.c:1589
int16_t Window_GetControlID(Window *the_window, Control *the_control)
Return the ID of the control passed, if the window actually owns that control NOTE: Control IDs 0-3 a...
Definition: window.c:1659
bool Window_SetPenXY(Window *the_window, int16_t x, int16_t y)
Set the "pen" position within the content area This also sets the pen position of the window's bitmap...
Definition: window.c:2690
NewWinTemplate * Window_GetNewWinTemplate(char *the_win_title)
Allocate and populate a new window template object Assigns (but does not copy) the passed title strin...
Definition: window.c:1038
bool Window_FillBox(Window *the_window, int16_t width, int16_t height, uint8_t the_color)
Fill a rectangle drawn from the current pen location, for the passed width/height.
Definition: window.c:2761
Control * Window_AddNewControlFromTemplate(Window *the_window, ControlTemplate *the_template, int16_t the_id, int16_t group_id)
Instantiate a new control from the passed template, and add it to the window's list of controls.
Definition: window.c:1433
bool Window_GenerateDamageRects(Window *the_window, Rectangle *the_old_rect)
Calculate damage rects, if any, caused by window moving or being resized NOTE: it is not necessarily ...
Definition: window.c:1213
bool Window_SetFont(Window *the_window, Font *the_font)
Set the font This is the font that will be used for any subsequent font drawing in this Window This a...
Definition: window.c:2602
bool Window_FillBoxRect(Window *the_window, Rectangle *the_coords, uint8_t the_color)
Fill pixel values for the passed Rectangle object, using the specified LUT value.
Definition: window.c:2782
Control * Window_GetControl(Window *the_window, int16_t the_control_id)
Return a pointer to the control owned by the window that matches the specified ID NOTE: Control IDs 0...
Definition: window.c:1624
bool Window_MergeClipRects(Window *the_window)
Merge and de-duplicate clip rects Consolidating the clip rects will happen reduce unnecessary reblitt...
Definition: window.c:1137
void Window_SetState(Window *the_window, window_state the_state)
Set the window's state (maximized, minimized, etc.) NOTE: This does not immediately cause the window ...
Definition: window.c:2022
bool Window_IsBackdrop(Window *the_window)
Check if a window is a backdrop window or a regular window.
Definition: window.c:2494
void Window_ClearContent(Window *the_window)
Clears the content area rect by filling it with the theme's backcolor.
Definition: window.c:1861
bool Window_IsVisible(Window *the_window)
Check if a window should be visible or not NOTE: this does not necessarily mean the window isn't curr...
Definition: window.c:2514
void Window_SetActive(Window *the_window, bool is_active)
Set the passed window's active flag.
Definition: window.c:1995
void Window_EvaluateWindowChange(Window *the_window, int16_t *x, int16_t *y, int16_t *width, int16_t *height)
Evaluate potential change to window position or size, and correct if out of allowed limits Negative v...
Definition: window.c:2050
Bitmap * Window_GetBitmap(Window *the_window)
Get the bitmap object used as the offscreen buffer for the window NOTE: this is not a pointer into VR...
Definition: window.c:2399
bool Window_SetPenXYFromGlobal(Window *the_window, int16_t x, int16_t y)
Set the local "pen" position within the window, based on global coordinates This also sets the pen po...
Definition: window.c:2660
MouseMode Window_CheckForDragZone(Window *the_window, int16_t x, int16_t y)
Checks if the passed coordinate is within one of the draggable event zones Draggable event zones incl...
Definition: window.c:1301
void Window_SetVisible(Window *the_window, bool is_visible)
Set the window's visibility flag.
Definition: window.c:1950
bool Window_DrawBoxCoords(Window *the_window, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t the_color)
Draws a rectangle based on 2 sets of coords, using the specified LUT value.
Definition: window.c:2942
void Window_NormSize(Window *the_window)
Set the window to normal size (window-size mode) Sets window's x, y, width, height parameters to thos...
Definition: window.c:2229
bool Window_SetColor(Window *the_window, uint8_t the_color)
Set the "pen" color This is the color that the next pen-based graphics function will use This also se...
Definition: window.c:2634
bool Window_BlitClipRects(Window *the_window)
Blit each clip rect to the screen, and clear all clip rects when done This is the actual mechanics of...
Definition: window.c:1157
bool Window_DrawHLine(Window *the_window, int16_t the_line_len, uint8_t the_color)
Draws a horizontal line from the current pen location, for n pixels, using the specified pixel value.
Definition: window.c:2865
bool Window_DrawBoxRect(Window *the_window, Rectangle *the_coords, uint8_t the_color)
Draws a rectangle based on the passed Rectangle object, using the specified LUT value.
Definition: window.c:2907
bool Window_Destroy(Window **the_window)
Definition: window.c:999
int16_t Window_GetHeight(Window *the_window)
Get the height of the window.
Definition: window.c:2475
bool Window_DrawCircle(Window *the_window, int16_t radius, uint8_t the_color)
Draw a circle centered on the current pen location Based on http://rosettacode.org/wiki/Bitmap/Midpoi...
Definition: window.c:3016
bool Window_AddControl(Window *the_window, Control *the_control)
Adds the passed control to the window's list of controls.
Definition: window.c:1392
void Window_InvalidateControlByID(Window *the_window, uint16_t the_control_id)
Invalidate the control matching the ID passed.
void Window_UpdateTheme(Window *the_window)
Updates the current window controls, etc., to match the current system theme.
Definition: window.c:1829
void Window_SetDisplayOrder(Window *the_window, int8_t the_display_order)
Set the display order of the window NOTE: This does not immediately re-render or change the display o...
Definition: window.c:1973
int16_t Window_GetX(Window *the_window)
Get the global horizontal coordinate of the window.
Definition: window.c:2418
Control * Window_GetControlAtXY(Window *the_window, int16_t x, int16_t y)
Find the control, if any, located at the specified local coordinates Transparency is not taken into a...
Definition: window.c:1695
bool Window_Blit(Window *the_window, Bitmap *src_bm, int16_t src_x, int16_t src_y, int16_t width, int16_t height)
Blit from source bitmap to the window's content area, at the window's current pen coordinate The sour...
Definition: window.c:2739
void Window_Minimize(Window *the_window)
Hides the window (minimize mode) Does not change the window's x, y, width, height parameters,...
Definition: window.c:2259
int16_t Window_GetY(Window *the_window)
Get the global vertical coordinate of the window.
Definition: window.c:2437
void Window_InvalidateTitlebar(Window *the_window)
Invalidate the title bar and the controls in the title bar Call when switching from inactive to activ...
Definition: window.c:1535
void Window_Render(Window *the_window)
Draw/re-draw any necessary components, and blit the window (or parts of it, via cliprects) to the scr...
Definition: window.c:1741
Control * Window_AddNewControl(Window *the_window, control_type the_type, int16_t width, int16_t height, int16_t x_offset, int16_t y_offset, h_align_type the_h_align, v_align_type the_v_align, char *the_caption, int16_t the_id, int16_t group_id)
Instantiate a new control of the type specified, and add it to the window's list of controls.
Definition: window.c:1480
int16_t Window_GetWidth(Window *the_window)
Get the width of the window.
Definition: window.c:2456
bool Window_AcceptDamageRect(Window *the_window, Rectangle *damage_rect)
Copy the passed rectangle to the window's clip rect collection, translating to local coordinates as i...
Definition: window.c:1239
bool Window_SetSelectedControl(Window *the_window, Control *the_control)
Sets the passed control as the currently selected control and unselects any previously selected contr...
Definition: window.c:1364
void Window_SetTitle(Window *the_window, char *the_title)
Replace the current window title with the passed string Note: the passed string will be copied into s...
Definition: window.c:1916
uint32_t Window_GetUserData(Window *the_window)
Get the value stored in the user data field of the window.
Definition: window.c:2341
void Window_ChangeWindow(Window *the_window, int16_t x, int16_t y, int16_t width, int16_t height, bool update_norm)
Change position and/or size of window NOTE: passed x, y will be checked against the window's min/max ...
Definition: window.c:2099
char * Window_DrawStringInBox(Window *the_window, int16_t width, int16_t height, char *the_string, int16_t num_chars, char **wrap_buffer, bool(*continue_function)(void))
Draw a string in a rectangular block on the window, with wrap.
Definition: window.c:3064
void Window_Maximize(Window *the_window)
Set the window to full-screen size (maximize mode) Sets window's x, y, width, height parameters to ma...
Definition: window.c:2197
bool Window_DrawVLine(Window *the_window, int16_t the_line_len, uint8_t the_color)
Draws a vertical line from specified coords, for n pixels.
Definition: window.c:2886
void Window_GlobalToLocal(Window *the_window, int16_t *x, int16_t *y)
Convert the passed x, y global coordinates to local (to window) coordinates.
Definition: window.c:2556
void Window_Print(Window *the_window)
Definition: window.c:752
bool Window_DrawLine(Window *the_window, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t the_color)
Draws a line between 2 passed coordinates.
Definition: window.c:2838
Window * Window_New(NewWinTemplate *the_win_template, void(*event_handler)(EventRecord *))
Allocate a Window object the_win_template->width_: cannot be smaller than WIN_DEFAULT_MIN_WIDTH,...
Definition: window.c:827
Control * Window_GetSelectedControl(Window *the_window)
Get the control listed as the currently selected control.
Definition: window.c:1571
void Window_LocalToGlobal(Window *the_window, int16_t *x, int16_t *y)
Convert the passed x, y local coordinates to global coordinates.
Definition: window.c:2576