Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2743