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