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 | #include "boot.h"␊ |
12 | #include "bootstruct.h"␊ |
13 | #include "graphics.h"␊ |
14 | #include "graphic_utils.h"␊ |
15 | #include "picopng.h"␊ |
16 | #include "options.h"␊ |
17 | ␊ |
18 | #ifndef __BOOT2_GUI_H␊ |
19 | #define __BOOT2_GUI_H␊ |
20 | ␊ |
21 | void showTextBuffer(char *buf, int size);␊ |
22 | int GUI_initGraphicsMode ();␊ |
23 | int GUI_countdown( const char * msg, int row, int timeout );␊ |
24 | #define CHARACTERS_COUNT␉223␊ |
25 | ␊ |
26 | #define BOOT_NORMAL␉␉0␊ |
27 | #define BOOT_VERBOSE␉␉1␊ |
28 | #define BOOT_IGNORECACHE␉2␊ |
29 | #define BOOT_SAFEMODE␉␉6␊ |
30 | #define BOOT_SINGLEUSER␉␉3␊ |
31 | #define DO_NOT_BOOT␉␉4␊ |
32 | #define CLOSE_INFO_MENU␉␉5␊ |
33 | ␊ |
34 | #define INFOMENU_NATIVEBOOT_START 1␊ |
35 | #define INFOMENU_NATIVEBOOT_END␉3␊ |
36 | ␊ |
37 | #define MENU_SHOW_MEMORY_INFO␉4␊ |
38 | #define MENU_SHOW_VIDEO_INFO␉5␊ |
39 | #define MENU_SHOW_HELP␉␉6␊ |
40 | ␊ |
41 | enum {␊ |
42 | ␉HorizontalLayout␉= 0,␊ |
43 | ␉VerticalLayout␉␉= 1,␊ |
44 | };␊ |
45 | ␊ |
46 | ␊ |
47 | /*␊ |
48 | * Menu item structure.␊ |
49 | */␊ |
50 | ␊ |
51 | typedef struct {␊ |
52 | ␉position_t␉pos;␊ |
53 | ␉char␉␉*text;␊ |
54 | ␉bool␉␉enabled;␊ |
55 | ␉bool␉␉expandable;␊ |
56 | } menuitem_t;␊ |
57 | ␊ |
58 | /*␊ |
59 | * Image structure.␊ |
60 | */␊ |
61 | typedef struct {␊ |
62 | ␉pixmap_t␉*image;␊ |
63 | ␉char␉␉name[32];␊ |
64 | } image_t;␊ |
65 | ␊ |
66 | /*␊ |
67 | * Font structure.␊ |
68 | */␊ |
69 | typedef struct {␊ |
70 | ␉uint16_t␉height;␉␉␉// Font Height ␊ |
71 | ␉uint16_t␉width;␉␉␉// Font Width for monospace font only␊ |
72 | ␉pixmap_t␉*chars[CHARACTERS_COUNT];␊ |
73 | } font_t;␊ |
74 | ␊ |
75 | /*␊ |
76 | * Window structure.␊ |
77 | */␊ |
78 | typedef struct␊ |
79 | {␊ |
80 | ␉position_t␉pos;␉␉␉// X,Y Position of window on screen␊ |
81 | ␉pixmap_t␉*pixmap;␉␉// Buffer␊ |
82 | ␉uint16_t␉width;␉␉␉// Width␊ |
83 | ␉uint16_t␉height;␉␉␉// Height␊ |
84 | ␉uint16_t␉hborder;␉␉// Horizontal border␊ |
85 | ␉uint16_t␉vborder;␉␉// Vertical border␊ |
86 | ␉uint16_t␉iconspacing;␉␉// Icon spacing␊ |
87 | ␉position_t␉cursor;␉␉␉// Text Cursor X,Y Position will be multiples of font width & height␊ |
88 | ␉uint32_t␉bgcolor;␉␉// Background color AARRGGBB␊ |
89 | ␉uint32_t␉fgcolor;␉␉// Foreground color AARRGGBB␊ |
90 | ␉uint32_t␉font_small_color;␉// Color for small font AARRGGBB␊ |
91 | ␉uint32_t␉font_console_color;␉// Color for consle font AARRGGBB␊ |
92 | ␉bool␉␉draw;␉␉␉// Draw flag␊ |
93 | } window_t;␊ |
94 | ␉␊ |
95 | /*␊ |
96 | * gui structure␊ |
97 | */␊ |
98 | typedef struct␊ |
99 | {␊ |
100 | ␉uint8_t␉␉maxdevices;␉␉//␊ |
101 | ␉uint8_t␉␉layout;␉␉␉// Horizontal or Vertical layout␊ |
102 | ␉␊ |
103 | ␉pixmap_t␉*backbuffer;␉␉// Off screen buffer␊ |
104 | ␊ |
105 | ␉window_t␉screen;␉␉␉// ␊ |
106 | ␉window_t␉background;␉␉// Position of background graphic within screen␊ |
107 | ␉window_t␉logo;␉␉␉// Logo␊ |
108 | ␉window_t␉bootprompt;␉␉// Bootprompt Window␊ |
109 | ␉window_t␉devicelist;␉␉// Devicelist Window␊ |
110 | ␉window_t␉infobox;␉␉// Infobox Window␊ |
111 | ␉window_t␉menu;␉␉␉// Menu␊ |
112 | ␊ |
113 | ␉window_t␉progressbar;␉␉// Progress bar␊ |
114 | ␉window_t␉countdown;␉␉// Countdown text␊ |
115 | ␉␊ |
116 | ␉window_t␉debug;␉␉␉// Debug␊ |
117 | ␊ |
118 | ␉bool␉␉initialised;␉␉// Initialised␊ |
119 | ␉bool␉␉redraw;␉␉␉// Redraw flag␊ |
120 | } gui_t;␊ |
121 | ␊ |
122 | ␊ |
123 | extern gui_t gui;␉␉␉␉␉// gui structure␊ |
124 | ␊ |
125 | ␊ |
126 | int initGUI();␊ |
127 | void drawBootGraphics(void);␊ |
128 | void drawBackground();␊ |
129 | ␊ |
130 | void setupDeviceList(config_file_t *theme);␊ |
131 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
132 | void drawDeviceList(int start, int end, int selection);␊ |
133 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
134 | ␊ |
135 | void showInfoBox(char *title, char *text);␊ |
136 | ␊ |
137 | int dprintf( window_t * window, const char * fmt, ...);␊ |
138 | int gprintf( window_t * window, const char * fmt, ...);␊ |
139 | int␉ vprf(const char * fmt, va_list ap);␊ |
140 | ␊ |
141 | int drawInfoMenu();␊ |
142 | int updateInfoMenu(int key);␊ |
143 | void drawInfoMenuItems();␊ |
144 | ␊ |
145 | void showGraphicBootPrompt();␊ |
146 | void clearGraphicBootPrompt();␊ |
147 | void updateGraphicBootPrompt(int key);␊ |
148 | ␊ |
149 | void updateVRAM();␊ |
150 | ␊ |
151 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
152 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
153 | ␊ |
154 | #endif /* !__BOOT2_GUI_H */␊ |
155 | |