Chameleon

Chameleon Svn Source Tree

Root/branches/zenith432/i386/boot2/gui.h

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_COUNT223
21
22#define BOOT_NORMAL0
23#define BOOT_VERBOSE1
24#define BOOT_IGNORECACHE2
25#define BOOT_SINGLEUSER3
26#define DO_NOT_BOOT4
27#define CLOSE_INFO_MENU5
28
29#define INFOMENU_NATIVEBOOT_START1
30#define INFOMENU_NATIVEBOOT_END3
31
32#define MENU_SHOW_MEMORY_INFO4
33#define MENU_SHOW_VIDEO_INFO5
34#define MENU_SHOW_HELP6
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
47enum {
48HorizontalLayout= 0,
49VerticalLayout= 1,
50};
51
52// ====================================================================
53
54/*
55 * Menu item structure.
56 */
57
58typedef struct {
59position_tpos;
60char*text;
61boolenabled;
62boolexpandable;
63} menuitem_t;
64
65// ====================================================================
66
67/*
68 * Image structure.
69 */
70typedef struct {
71pixmap_t*image;
72charname[32];
73} image_t;
74
75// ====================================================================
76
77/*
78 * Font structure.
79 */
80typedef struct {
81uint16_theight;// Font Height
82uint16_twidth;// Font Width for monospace font only
83pixmap_t*chars[CHARACTERS_COUNT];
84uint16_tcount;// Number of chars in font
85} font_t;
86
87// ====================================================================
88
89/*
90 * Window structure.
91 */
92typedef struct
93{
94position_tpos;// X,Y Position of window on screen
95pixmap_t*pixmap;// Buffer
96uint16_twidth;// Width
97uint16_theight;// Height
98uint16_thborder;// Horizontal border
99uint16_tvborder;// Vertical border
100uint16_ticonspacing;// Icon spacing
101position_tcursor;// Text Cursor X,Y Position will be multiples of font width & height
102uint32_tbgcolor;// Background color AARRGGBB
103uint32_tfgcolor;// Foreground color AARRGGBB
104uint32_tfont_small_color;// Color for small font AARRGGBB
105uint32_tfont_console_color;// Color for consle font AARRGGBB
106booldraw;// Draw flag
107} window_t;
108
109// ====================================================================
110
111/*
112 * gui structure
113 */
114typedef struct
115{
116uint8_tmaxdevices;//
117uint8_tlayout;// Horizontal or Vertical layout
118
119pixmap_t*backbuffer;// Off screen buffer
120
121window_tscreen;//
122window_tbackground;// Position of background graphic within screen
123window_tlogo;// Logo
124window_tbootprompt;// Bootprompt Window
125window_tdevicelist;// Devicelist Window
126window_tinfobox;// Infobox Window
127window_tmenu;// Menu
128
129window_tprogressbar;// Progress bar
130window_tcountdown;// Countdown text
131
132window_tdebug;// Debug
133
134boolinitialised;// Initialised
135boolredraw;// Redraw flag
136} gui_t;
137
138
139gui_t gui;// gui structure
140
141font_t font_small;
142font_t font_console;
143
144int initGUI();
145void drawBackground();
146
147void setupDeviceList(config_file_t *theme);
148bool is_image_loaded(int i);
149void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);
150void drawDeviceList(int start, int end, int selection);
151void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);
152
153void showInfoBox(char *title, char *text);
154
155int dprintf( window_t * window, const char * fmt, ...) __attribute__((format(printf,2,3)));
156int gprintf( window_t * window, const char * fmt, ...) __attribute__((format(printf,2,3)));
157int vprf(const char * fmt, va_list ap);
158
159int drawInfoMenu();
160int updateInfoMenu(int key);
161void drawInfoMenuItems();
162
163void showGraphicBootPrompt();
164void clearGraphicBootPrompt();
165void updateGraphicBootPrompt();
166
167void updateVRAM();
168
169position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p);
170void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);
171void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);
172
173void chooseLogoMode();
174
175#endif /* !__BOOT2_GUI_H */
176

Archive Download this file

Revision: 2877