Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2633