1 | /*␊ |
2 | * gui.h␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by Jasmin Fazlic on 18.12.08.␊ |
6 | * Copyright 2008/09 Jasmin Fazlic All rights reserved.␊ |
7 | * Copyright 2008/09 iNDi All rights reserved.␊ |
8 | *␊ |
9 | */␊ |
10 | ␊ |
11 | #ifndef __BOOT2_GUI_H␊ |
12 | #define __BOOT2_GUI_H␊ |
13 | ␊ |
14 | #include "graphics.h"␊ |
15 | #include "picopng.h"␊ |
16 | ␊ |
17 | #define CHARACTERS_COUNT␉223␊ |
18 | ␊ |
19 | #define BOOT_NORMAL␉␉␉0␊ |
20 | #define BOOT_VERBOSE␉␉1␊ |
21 | #define BOOT_IGNORECACHE␉2␊ |
22 | #define BOOT_SINGLEUSER␉␉3␊ |
23 | #define DO_NOT_BOOT␉␉␉4␊ |
24 | #define CLOSE_INFO_MENU␉␉5␊ |
25 | ␊ |
26 | #define INFOMENU_NATIVEBOOT_START␉1␊ |
27 | #define INFOMENU_NATIVEBOOT_END␉␉3␊ |
28 | ␊ |
29 | #define MENU_SHOW_MEMORY_INFO␉␉4␊ |
30 | #define MENU_SHOW_VIDEO_INFO␉␉5␊ |
31 | #define MENU_SHOW_HELP␉␉␉␉6␊ |
32 | ␊ |
33 | enum {␊ |
34 | ␉HorizontalLayout␉= 0,␊ |
35 | ␉VerticalLayout␉␉= 1␊ |
36 | };␊ |
37 | /*␊ |
38 | enum {␊ |
39 | ␉kBackspaceKey␉␉= 0x08,␊ |
40 | ␉kTabKey␉␉␉␉= 0x09,␊ |
41 | ␉kReturnKey␉␉␉= '\r',␊ |
42 | ␉kEscapeKey␉␉␉= 0x1b,␊ |
43 | ␉kUpArrowkey␉␉␉= 0x4800,␊ |
44 | ␉kDownArrowkey␉␉= 0x5000,␊ |
45 | ␉kASCIIKeyMask␉␉= 0x7f,␊ |
46 | ␉kF2Key␉␉␉␉= 0x3c00, //Azi:autoresolution␊ |
47 | ␉kF5Key␉␉␉␉= 0x3f00,␊ |
48 | ␉kF10Key␉␉␉␉= 0x4400␊ |
49 | };␊ |
50 | */␊ |
51 | /*␊ |
52 | * Menu item structure.␊ |
53 | */␊ |
54 | ␊ |
55 | typedef struct {␊ |
56 | ␉position_t␉pos;␊ |
57 | ␉char␉␉*text;␊ |
58 | ␉bool␉␉enabled;␊ |
59 | ␉bool␉␉expandable;␊ |
60 | } menuitem_t;␊ |
61 | ␊ |
62 | /*␊ |
63 | * Image structure.␊ |
64 | */␊ |
65 | typedef struct {␊ |
66 | ␉pixmap_t␉*image;␊ |
67 | ␉char␉␉name[32];␊ |
68 | } image_t;␊ |
69 | ␊ |
70 | /*␊ |
71 | * Font structure.␊ |
72 | */␊ |
73 | typedef struct {␊ |
74 | ␉uint16_t␉height;␉␉␉// Font Height ␊ |
75 | ␉uint16_t␉width;␉␉␉// Font Width for monospace font only␊ |
76 | ␉pixmap_t␉*chars[CHARACTERS_COUNT];␊ |
77 | } font_t;␊ |
78 | ␊ |
79 | /*␊ |
80 | * Window structure.␊ |
81 | */␊ |
82 | typedef struct␊ |
83 | {␊ |
84 | ␉position_t␉pos;␉␉␉// X,Y Position of window on screen␊ |
85 | ␉pixmap_t␉*pixmap;␉␉// Buffer␊ |
86 | ␉uint16_t␉width;␉␉␉// Width␊ |
87 | ␉uint16_t␉height;␉␉␉// Height␊ |
88 | ␉uint16_t␉hborder;␉␉// Horizontal border␊ |
89 | ␉uint16_t␉vborder;␉␉// Vertical border␊ |
90 | ␉uint16_t␉iconspacing;␉␉// Icon spacing␊ |
91 | ␉position_t␉cursor;␉␉␉// Text Cursor X,Y Position will be multiples of font width & height␊ |
92 | ␉uint32_t␉bgcolor;␉␉// Background color AARRGGBB␊ |
93 | ␉uint32_t␉fgcolor;␉␉// Foreground color AARRGGBB␊ |
94 | ␉uint32_t␉font_small_color;␉// Color for small font AARRGGBB␊ |
95 | ␉uint32_t␉font_console_color;␉// Color for consle font AARRGGBB␊ |
96 | ␉bool␉␉draw;␉␉␉// Draw flag␊ |
97 | ␉// Azi:autoresolution␊ |
98 | ␉//resolution specifics␊ |
99 | ␉uint16_t␉htotal;␉␉␉␉␊ |
100 | ␉uint16_t␉vtotal;␉␉␉␉␊ |
101 | ␉uint16_t␉hsyncstart;␉␉␉␊ |
102 | ␉uint16_t␉hsyncend;␊ |
103 | ␉uint16_t␉vsyncstart;␉␉␉␊ |
104 | ␉uint16_t␉vsyncend;␊ |
105 | ␉uint8_t␉␉mm;␉␉␉␉// Azi:autoresolution - showinfo␊ |
106 | ␉uint16_t␉attr;␊ |
107 | } window_t;␊ |
108 | ␉␊ |
109 | /*␊ |
110 | * gui structure␊ |
111 | */␊ |
112 | typedef struct␊ |
113 | {␊ |
114 | ␉uint8_t␉␉maxdevices;␉␉//␊ |
115 | ␉uint8_t␉␉layout;␉␉␉// Horizontal or Vertical layout␊ |
116 | ␉␊ |
117 | ␉pixmap_t␉*backbuffer;␉␉// Off screen buffer␊ |
118 | ␊ |
119 | ␉window_t␉screen;␉␉␉// ␊ |
120 | ␉window_t␉background;␉␉// Position of background graphic within screen␊ |
121 | ␉window_t␉logo;␉␉␉// Logo␊ |
122 | ␉window_t␉bootprompt;␉␉// Bootprompt Window␊ |
123 | ␉window_t␉devicelist;␉␉// Devicelist Window␊ |
124 | ␉window_t␉infobox;␉␉// Infobox Window␊ |
125 | ␉window_t␉menu;␉␉␉// Menu␊ |
126 | ␊ |
127 | ␉window_t␉progressbar;␉␉// Progress bar␊ |
128 | ␉window_t␉countdown;␉␉// Countdown text␊ |
129 | ␉␊ |
130 | ␉window_t␉debug;␉␉␉// Debug␊ |
131 | ␊ |
132 | ␉bool␉␉initialised;␉␉// Initialised␊ |
133 | ␉bool␉␉redraw;␉␉␉// Redraw flag␊ |
134 | } gui_t;␊ |
135 | ␊ |
136 | ␊ |
137 | gui_t gui;␉␉␉␉␉// gui structure␊ |
138 | ␊ |
139 | font_t font_small;␊ |
140 | font_t font_console;␊ |
141 | ␊ |
142 | extern int␉gDeviceCount;␊ |
143 | ␊ |
144 | int initGUI();␊ |
145 | void drawBackground();␊ |
146 | ␊ |
147 | void setupDeviceList(config_file_t *theme);␊ |
148 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
149 | void drawDeviceList(int start, int end, int selection);␊ |
150 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
151 | ␊ |
152 | void showInfoBox(char *title, char *text);␊ |
153 | ␊ |
154 | int dprintf( window_t * window, const char * fmt, ...);␊ |
155 | int gprintf( window_t * window, const char * fmt, ...);␊ |
156 | int␉ vprf(const char * fmt, va_list ap);␊ |
157 | ␊ |
158 | int drawInfoMenu();␊ |
159 | int updateInfoMenu(int key);␊ |
160 | void drawInfoMenuItems();␊ |
161 | ␊ |
162 | void showGraphicBootPrompt();␊ |
163 | void clearGraphicBootPrompt();␊ |
164 | void updateGraphicBootPrompt();␊ |
165 | ␊ |
166 | void updateVRAM();␊ |
167 | ␊ |
168 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
169 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
170 | ␊ |
171 | #endif /* !__BOOT2_GUI_H */␊ |
172 | |