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