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 | #define APPLE_LOGO_WIDTH 84␊ |
37 | #define APPLE_LOGO_HEIGHT 103␊ |
38 | ␊ |
39 | #define APPLE_LOGO_X ((VIDEO(width) - APPLE_LOGO_WIDTH) / 2)␊ |
40 | #define APPLE_LOGO_Y ((VIDEO(height) - APPLE_LOGO_HEIGHT) / 2)␊ |
41 | ␊ |
42 | // ====================================================================␊ |
43 | ␊ |
44 | enum {␊ |
45 | ␉HorizontalLayout␉= 0,␊ |
46 | ␉VerticalLayout␉␉= 1,␊ |
47 | };␊ |
48 | ␊ |
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 | ␊ |
64 | /*␊ |
65 | * Image structure.␊ |
66 | */␊ |
67 | typedef struct {␊ |
68 | ␉pixmap_t␉*image;␊ |
69 | ␉char␉␉name[32];␊ |
70 | } image_t;␊ |
71 | ␊ |
72 | // ====================================================================␊ |
73 | ␊ |
74 | /*␊ |
75 | * Font structure.␊ |
76 | */␊ |
77 | typedef struct {␊ |
78 | ␉uint16_t␉height;␉␉␉// Font Height ␊ |
79 | ␉uint16_t␉width;␉␉␉// Font Width for monospace font only␊ |
80 | ␉pixmap_t␉*chars[CHARACTERS_COUNT];␊ |
81 | ␉uint16_t␉count;␉␉␉// Number of chars in font␊ |
82 | } font_t;␊ |
83 | ␊ |
84 | // ====================================================================␊ |
85 | ␊ |
86 | /*␊ |
87 | * Window structure.␊ |
88 | */␊ |
89 | typedef struct␊ |
90 | {␊ |
91 | ␉position_t␉pos;␉␉␉// X,Y Position of window on screen␊ |
92 | ␉pixmap_t␉*pixmap;␉␉// Buffer␊ |
93 | ␉uint16_t␉width;␉␉␉// Width␊ |
94 | ␉uint16_t␉height;␉␉␉// Height␊ |
95 | ␉uint16_t␉hborder;␉␉// Horizontal border␊ |
96 | ␉uint16_t␉vborder;␉␉// Vertical border␊ |
97 | ␉uint16_t␉iconspacing;␉␉// Icon spacing␊ |
98 | ␉position_t␉cursor;␉␉␉// Text Cursor X,Y Position will be multiples of font width & height␊ |
99 | ␉uint32_t␉bgcolor;␉␉// Background color AARRGGBB␊ |
100 | ␉uint32_t␉fgcolor;␉␉// Foreground color AARRGGBB␊ |
101 | ␉uint32_t␉font_small_color;␉// Color for small font AARRGGBB␊ |
102 | ␉uint32_t␉font_console_color;␉// Color for consle font AARRGGBB␊ |
103 | ␉bool␉␉draw;␉␉␉// Draw flag␊ |
104 | } window_t;␊ |
105 | ␊ |
106 | // ====================================================================␊ |
107 | ␊ |
108 | /*␊ |
109 | * gui structure␊ |
110 | */␊ |
111 | typedef struct␊ |
112 | {␊ |
113 | ␉uint8_t␉␉maxdevices;␉␉//␊ |
114 | ␉uint8_t␉␉layout;␉␉␉// Horizontal or Vertical layout␊ |
115 | ␉␊ |
116 | ␉pixmap_t␉*backbuffer;␉␉// Off screen buffer␊ |
117 | ␊ |
118 | ␉window_t␉screen;␉␉␉// ␊ |
119 | ␉window_t␉background;␉␉// Position of background graphic within screen␊ |
120 | ␉window_t␉logo;␉␉␉// Logo␊ |
121 | ␉window_t␉bootprompt;␉␉// Bootprompt Window␊ |
122 | ␉window_t␉devicelist;␉␉// Devicelist Window␊ |
123 | ␉window_t␉infobox;␉␉// Infobox Window␊ |
124 | ␉window_t␉menu;␉␉␉// Menu␊ |
125 | ␊ |
126 | ␉window_t␉progressbar;␉␉// Progress bar␊ |
127 | ␉window_t␉countdown;␉␉// Countdown text␊ |
128 | ␉␊ |
129 | ␉window_t␉debug;␉␉␉// Debug␊ |
130 | ␊ |
131 | ␉bool␉␉initialised;␉␉// Initialised␊ |
132 | ␉bool␉␉redraw;␉␉␉// Redraw flag␊ |
133 | } gui_t;␊ |
134 | ␊ |
135 | ␊ |
136 | gui_t gui;␉␉␉␉␉// gui structure␊ |
137 | ␊ |
138 | font_t font_small;␊ |
139 | font_t font_console;␊ |
140 | ␊ |
141 | int initGUI();␊ |
142 | void drawBackground();␊ |
143 | ␊ |
144 | void setupDeviceList(config_file_t *theme);␊ |
145 | bool is_image_loaded(int i);␊ |
146 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
147 | void drawDeviceList(int start, int end, int selection);␊ |
148 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
149 | ␊ |
150 | void showInfoBox(char *title, char *text);␊ |
151 | ␊ |
152 | int dprintf( window_t * window, const char * fmt, ...) __attribute__((format(printf,2,3)));␊ |
153 | int gprintf( window_t * window, const char * fmt, ...) __attribute__((format(printf,2,3)));␊ |
154 | int␉ vprf(const char * fmt, va_list ap);␊ |
155 | ␊ |
156 | int drawInfoMenu();␊ |
157 | int updateInfoMenu(int key);␊ |
158 | void drawInfoMenuItems();␊ |
159 | ␊ |
160 | void showGraphicBootPrompt();␊ |
161 | void clearGraphicBootPrompt();␊ |
162 | void updateGraphicBootPrompt();␊ |
163 | ␊ |
164 | void updateVRAM();␊ |
165 | ␊ |
166 | position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
167 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
168 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
169 | ␊ |
170 | #endif /* !__BOOT2_GUI_H */␊ |
171 | |