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