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 | /*␊ |
42 | * Menu item structure.␊ |
43 | */␊ |
44 | ␊ |
45 | typedef struct {␊ |
46 | ␉position_t␉pos;␊ |
47 | ␉char␉␉*text;␊ |
48 | ␉bool␉␉enabled;␊ |
49 | ␉bool␉␉expandable;␊ |
50 | } menuitem_t;␊ |
51 | ␊ |
52 | /*␊ |
53 | * Image structure.␊ |
54 | */␊ |
55 | typedef struct {␊ |
56 | ␉pixmap_t␉*image;␊ |
57 | ␉char␉␉name[32];␊ |
58 | } image_t;␊ |
59 | ␊ |
60 | /*␊ |
61 | * Font structure.␊ |
62 | */␊ |
63 | typedef struct {␊ |
64 | ␉uint16_t␉height;␉␉␉// Font Height ␊ |
65 | ␉uint16_t␉width;␉␉␉// Font Width for monospace font only␊ |
66 | ␉pixmap_t␉*chars[CHARACTERS_COUNT];␊ |
67 | } font_t;␊ |
68 | ␊ |
69 | /*␊ |
70 | * Window structure.␊ |
71 | */␊ |
72 | typedef struct␊ |
73 | {␊ |
74 | ␉position_t␉pos;␉␉␉// X,Y Position of window on screen␊ |
75 | ␉pixmap_t␉*pixmap;␉␉// Buffer␊ |
76 | ␉uint16_t␉width;␉␉␉// Width␊ |
77 | ␉uint16_t␉height;␉␉␉// Height␊ |
78 | ␉uint16_t␉hborder;␉␉// Horizontal border␊ |
79 | ␉uint16_t␉vborder;␉␉// Vertical border␊ |
80 | ␉uint16_t␉iconspacing;␉␉// Icon spacing␊ |
81 | ␉position_t␉cursor;␉␉␉// Text Cursor X,Y Position will be multiples of font width & height␊ |
82 | ␉uint32_t␉bgcolor;␉␉// Background color AARRGGBB␊ |
83 | ␉uint32_t␉fgcolor;␉␉// Foreground color AARRGGBB␊ |
84 | ␉uint32_t␉font_small_color;␉// Color for small font AARRGGBB␊ |
85 | ␉uint32_t␉font_console_color;␉// Color for consle font AARRGGBB␊ |
86 | ␉bool␉␉draw;␉␉␉// Draw flag␊ |
87 | ␉// Azi:autoresolution␊ |
88 | ␉//resolution specifics␊ |
89 | ␉uint16_t␉htotal;␉␉␉␉␊ |
90 | ␉uint16_t␉vtotal;␉␉␉␉␊ |
91 | ␉uint16_t␉hsyncstart;␉␉␉␊ |
92 | ␉uint16_t␉hsyncend;␊ |
93 | ␉uint16_t␉vsyncstart;␉␉␉␊ |
94 | ␉uint16_t␉vsyncend;␊ |
95 | ␉uint8_t␉␉mm;␊ |
96 | ␉uint16_t␉attr;␊ |
97 | } window_t;␊ |
98 | ␉␊ |
99 | /*␊ |
100 | * gui structure␊ |
101 | */␊ |
102 | typedef struct␊ |
103 | {␊ |
104 | ␉uint8_t␉␉maxdevices;␉␉//␊ |
105 | ␉uint8_t␉␉layout;␉␉␉// Horizontal or Vertical layout␊ |
106 | ␉␊ |
107 | ␉pixmap_t␉*backbuffer;␉␉// Off screen buffer␊ |
108 | ␊ |
109 | ␉window_t␉screen;␉␉␉// ␊ |
110 | ␉window_t␉background;␉␉// Position of background graphic within screen␊ |
111 | ␉window_t␉logo;␉␉␉// Logo␊ |
112 | ␉window_t␉bootprompt;␉␉// Bootprompt Window␊ |
113 | ␉window_t␉devicelist;␉␉// Devicelist Window␊ |
114 | ␉window_t␉infobox;␉␉// Infobox Window␊ |
115 | ␉window_t␉menu;␉␉␉// Menu␊ |
116 | ␊ |
117 | ␉window_t␉progressbar;␉␉// Progress bar␊ |
118 | ␉window_t␉countdown;␉␉// Countdown text␊ |
119 | ␉␊ |
120 | ␉window_t␉debug;␉␉␉// Debug␊ |
121 | ␊ |
122 | ␉bool␉␉initialised;␉␉// Initialised␊ |
123 | ␉bool␉␉redraw;␉␉␉// Redraw flag␊ |
124 | } gui_t;␊ |
125 | ␊ |
126 | ␊ |
127 | gui_t gui;␉␉␉␉␉// gui structure␊ |
128 | ␊ |
129 | font_t font_small;␊ |
130 | font_t font_console;␊ |
131 | ␊ |
132 | int initGUI();␊ |
133 | void drawBackground();␊ |
134 | ␊ |
135 | void setupDeviceList(config_file_t *theme);␊ |
136 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
137 | void drawDeviceList(int start, int end, int selection);␊ |
138 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
139 | ␊ |
140 | void showInfoBox(char *title, char *text);␊ |
141 | ␊ |
142 | int dprintf( window_t * window, const char * fmt, ...);␊ |
143 | int gprintf( window_t * window, const char * fmt, ...);␊ |
144 | int␉ vprf(const char * fmt, va_list ap);␊ |
145 | ␊ |
146 | int drawInfoMenu();␊ |
147 | int updateInfoMenu(int key);␊ |
148 | void drawInfoMenuItems();␊ |
149 | ␊ |
150 | void showGraphicBootPrompt();␊ |
151 | void clearGraphicBootPrompt();␊ |
152 | void updateGraphicBootPrompt();␊ |
153 | ␊ |
154 | void updateVRAM();␊ |
155 | ␊ |
156 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
157 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
158 | ␊ |
159 | #endif /* !__BOOT2_GUI_H */␊ |
160 | |