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 | /*␊ |
12 | * cparm : cleaned␊ |
13 | */␊ |
14 | #ifndef __BOOT2_GUI_H␊ |
15 | #define __BOOT2_GUI_H␊ |
16 | ␊ |
17 | #include "boot.h"␊ |
18 | #include "bootstruct.h"␊ |
19 | #include "graphics.h"␊ |
20 | #include "graphic_utils.h"␊ |
21 | #include "picopng.h"␊ |
22 | #include "options.h"␊ |
23 | ␊ |
24 | void showTextBuffer(char *buf, int size);␊ |
25 | int GUI_initGraphicsMode ();␊ |
26 | int GUI_countdown( const char * msg, int row, int timeout );␊ |
27 | ␊ |
28 | #define kGUIKey␉␉␉␉"GUI"␊ |
29 | #define kBootBannerKey␉␉"Boot Banner"␊ |
30 | ␊ |
31 | #define CHARACTERS_COUNT␉223␊ |
32 | ␊ |
33 | #define BOOT_NORMAL␉␉0␊ |
34 | #define BOOT_VERBOSE␉␉1␊ |
35 | #define BOOT_IGNORECACHE␉2␊ |
36 | #define BOOT_SINGLEUSER␉␉3␊ |
37 | #define DO_NOT_BOOT␉␉4␊ |
38 | #define CLOSE_INFO_MENU␉␉5␊ |
39 | ␊ |
40 | #define INFOMENU_NATIVEBOOT_START 1␊ |
41 | #define INFOMENU_NATIVEBOOT_END␉3␊ |
42 | ␊ |
43 | #define MENU_SHOW_MEMORY_INFO␉4␊ |
44 | #define MENU_SHOW_VIDEO_INFO␉5␊ |
45 | #define MENU_SHOW_HELP␉␉6␊ |
46 | ␊ |
47 | enum {␊ |
48 | ␉HorizontalLayout␉= 0,␊ |
49 | ␉VerticalLayout␉␉= 1,␊ |
50 | };␊ |
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 | extern gui_t gui;␉␉␉␉␉// gui structure␊ |
130 | ␊ |
131 | ␊ |
132 | int initGUI();␊ |
133 | int startGUI();␊ |
134 | void drawBootGraphics(void);␊ |
135 | void drawBackground();␊ |
136 | void drawLogo();␊ |
137 | ␊ |
138 | void setupDeviceList(config_file_t *theme);␊ |
139 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
140 | void drawDeviceList(int start, int end, int selection);␊ |
141 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
142 | ␊ |
143 | void showInfoBox(char *title, char *text);␊ |
144 | ␊ |
145 | int dprintf( window_t * window, const char * fmt, ...);␊ |
146 | int gprintf( window_t * window, const char * fmt, ...);␊ |
147 | int␉ vprf(const char * fmt, va_list ap);␊ |
148 | ␊ |
149 | int drawInfoMenu();␊ |
150 | int updateInfoMenu(int key);␊ |
151 | void drawInfoMenuItems();␊ |
152 | ␊ |
153 | void showGraphicBootPrompt();␊ |
154 | void clearGraphicBootPrompt();␊ |
155 | void updateGraphicBootPrompt(int key);␊ |
156 | ␊ |
157 | void updateVRAM();␊ |
158 | ␊ |
159 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
160 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
161 | ␊ |
162 | #endif /* !__BOOT2_GUI_H */␊ |
163 | |