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