Skip to content

Latest commit

 

History

History
158 lines (135 loc) · 5.41 KB

gui.h

File metadata and controls

158 lines (135 loc) · 5.41 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
#ifndef _INCL_GUI_H_
#define _INCL_GUI_H_
#include "universal.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
MOJOGUI_PRIORITY_NEVER_TRY = 0,
Mar 27, 2006
Mar 27, 2006
13
MOJOGUI_PRIORITY_USER_REQUESTED,
14
15
MOJOGUI_PRIORITY_TRY_FIRST,
MOJOGUI_PRIORITY_TRY_NORMAL,
Mar 25, 2006
Mar 25, 2006
16
17
MOJOGUI_PRIORITY_TRY_LAST,
MOJOGUI_PRIORITY_TOTAL
18
19
} MojoGuiPluginPriority;
Nov 29, 2006
Nov 29, 2006
20
21
22
23
/*
* Abstract GUI interfaces.
*/
Nov 29, 2006
Nov 29, 2006
24
Dec 27, 2006
Dec 27, 2006
25
26
27
28
29
30
31
typedef struct MojoGuiSetupOptions MojoGuiSetupOptions;
struct MojoGuiSetupOptions
{
const char *description;
boolean value;
boolean is_group_parent;
uint64 size;
Dec 27, 2006
Dec 27, 2006
32
int opaque; // GUI drivers shouldn't touch this.
Dec 27, 2006
Dec 27, 2006
33
34
35
36
MojoGuiSetupOptions *next_sibling;
MojoGuiSetupOptions *child;
};
Nov 29, 2006
Nov 29, 2006
37
38
39
40
41
42
43
44
#define MOJOGUI_ENTRY_POINT MojoSetup_Gui_GetInterface
#define MOJOGUI_ENTRY_POINT_STR DEFINE_TO_STR(MOJOGUI_ENTRY_POINT)
// Increment this value when MojoGui's structure changes.
#define MOJOGUI_INTERFACE_REVISION 1
typedef struct MojoGui MojoGui;
struct MojoGui
Dec 7, 2006
Dec 7, 2006
46
47
48
49
50
51
uint8 (*priority)(void);
const char* (*name)(void);
boolean (*init)(void);
void (*deinit)(void);
void (*msgbox)(const char *title, const char *text);
boolean (*promptyn)(const char *title, const char *text);
Dec 20, 2006
Dec 20, 2006
52
53
54
55
boolean (*start)(const char *title, const char *splash);
void (*stop)(void);
boolean (*readme)(const char *name, const uint8 *data, size_t len,
boolean can_go_back, boolean can_go_forward);
Dec 27, 2006
Dec 27, 2006
56
57
boolean (*options)(MojoGuiSetupOptions *opts,
boolean can_go_back, boolean can_go_forward);
Dec 28, 2006
Dec 28, 2006
58
59
char * (*destination)(const char **recommendations, int reccount,
boolean can_go_back, boolean can_go_forward);
Apr 21, 2007
Apr 21, 2007
60
boolean (*insertmedia)(const char *medianame);
May 7, 2007
May 7, 2007
61
62
boolean (*progress)(const char *type, const char *component,
int percent, const char *item);
63
64
};
Dec 7, 2006
Dec 7, 2006
65
66
typedef const MojoGui* (*MojoGuiEntryPoint)(int revision,
const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
68
69
70
#if !BUILDING_EXTERNAL_PLUGIN
extern const MojoGui *GGui;
const MojoGui *MojoGui_initGuiPlugin(void);
Mar 27, 2006
Mar 27, 2006
71
72
73
void MojoGui_deinitGuiPlugin(void);
#else
Dec 7, 2006
Dec 7, 2006
74
75
__EXPORT__ const MojoGui *MOJOGUI_ENTRY_POINT(int revision,
const MojoSetupEntryPoints *e);
Mar 27, 2006
Mar 27, 2006
76
Mar 25, 2006
Mar 25, 2006
77
78
79
80
81
/*
* We do this as a macro so we only have to update one place, and it
* enforces some details in the plugins. Without effort, plugins don't
* support anything but the latest version of the interface.
*/
Mar 27, 2006
Mar 27, 2006
82
#define MOJOGUI_PLUGIN(module) \
Dec 7, 2006
Dec 7, 2006
83
84
85
86
87
88
89
static const MojoSetupEntryPoints *entry = NULL; \
static uint8 MojoGui_##module##_priority(void); \
static const char* MojoGui_##module##_name(void) { return #module; } \
static boolean MojoGui_##module##_init(void); \
static void MojoGui_##module##_deinit(void); \
static void MojoGui_##module##_msgbox(const char *title, const char *text); \
static boolean MojoGui_##module##_promptyn(const char *t1, const char *t2); \
Dec 20, 2006
Dec 20, 2006
90
91
92
93
94
static boolean MojoGui_##module##_start(const char *t, const char *s); \
static void MojoGui_##module##_stop(void); \
static boolean MojoGui_##module##_readme(const char *name, const uint8 *data, \
size_t len, boolean can_go_back, \
boolean can_go_forward); \
Dec 27, 2006
Dec 27, 2006
95
96
static boolean MojoGui_##module##_options(MojoGuiSetupOptions *opts, \
boolean can_go_back, boolean can_go_forward); \
Dec 28, 2006
Dec 28, 2006
97
98
static char *MojoGui_##module##_destination(const char **r, int reccount, \
boolean can_go_back, boolean can_go_forward); \
Apr 21, 2007
Apr 21, 2007
99
static boolean MojoGui_##module##_insertmedia(const char *medianame); \
May 7, 2007
May 7, 2007
100
101
static boolean MojoGui_##module##_progress(const char *typ, const char *comp, \
int percent, const char *item); \
Dec 7, 2006
Dec 7, 2006
102
const MojoGui *MojoGuiPlugin_##module(int rev, const MojoSetupEntryPoints *e) \
Mar 25, 2006
Mar 25, 2006
103
{ \
Dec 7, 2006
Dec 7, 2006
104
105
106
107
108
109
110
111
if (rev == MOJOGUI_INTERFACE_REVISION) { \
static const MojoGui retval = { \
MojoGui_##module##_priority, \
MojoGui_##module##_name, \
MojoGui_##module##_init, \
MojoGui_##module##_deinit, \
MojoGui_##module##_msgbox, \
MojoGui_##module##_promptyn, \
Dec 20, 2006
Dec 20, 2006
112
113
114
MojoGui_##module##_start, \
MojoGui_##module##_stop, \
MojoGui_##module##_readme, \
Dec 27, 2006
Dec 27, 2006
115
MojoGui_##module##_options, \
Dec 28, 2006
Dec 28, 2006
116
MojoGui_##module##_destination, \
Apr 21, 2007
Apr 21, 2007
117
MojoGui_##module##_insertmedia, \
May 7, 2007
May 7, 2007
118
MojoGui_##module##_progress, \
Dec 7, 2006
Dec 7, 2006
119
120
}; \
entry = e; \
Nov 29, 2006
Nov 29, 2006
121
122
123
return &retval; \
} \
return NULL; \
Mar 25, 2006
Mar 25, 2006
124
125
} \
Mar 27, 2006
Mar 27, 2006
126
#define CREATE_MOJOGUI_ENTRY_POINT(module) \
Dec 7, 2006
Dec 7, 2006
127
const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
Mar 27, 2006
Mar 27, 2006
128
{ \
Dec 7, 2006
Dec 7, 2006
129
return MojoGuiPlugin_##module(rev, e); \
Mar 27, 2006
Mar 27, 2006
130
131
} \
Mar 25, 2006
Mar 25, 2006
132
#endif
Mar 25, 2006
Mar 25, 2006
133
Nov 29, 2006
Nov 29, 2006
134
135
136
/*
* make some decisions about which GUI plugins to build...
Dec 7, 2006
Dec 7, 2006
137
138
* We list them all here, but some are built, some aren't. Some are DLLs,
* some aren't...
Nov 29, 2006
Nov 29, 2006
139
140
141
*/
// Probably want to support this always, unless explicitly overridden.
Dec 7, 2006
Dec 7, 2006
142
const MojoGui *MojoGuiPlugin_stdio(int rev, const MojoSetupEntryPoints *e);
Nov 29, 2006
Nov 29, 2006
143
// !!! FIXME (Windows code isn't actually written yet...)
Dec 7, 2006
Dec 7, 2006
144
const MojoGui *MojoGuiPlugin_windows(int rev, const MojoSetupEntryPoints *e);
Nov 29, 2006
Nov 29, 2006
145
// !!! FIXME (GTK+ code isn't actually written yet...)
Dec 7, 2006
Dec 7, 2006
146
147
const MojoGui *MojoGuiPlugin_gtkplus(int rev, const MojoSetupEntryPoints *e);
const MojoGui *MojoGuiPlugin_macosx(int rev, const MojoSetupEntryPoints *e);
Dec 1, 2006
Dec 1, 2006
148
Nov 29, 2006
Nov 29, 2006
149
150
// !!! FIXME: Qt? KDE? Gnome? Console? Cocoa?
151
152
153
154
155
156
#ifdef __cplusplus
}
#endif
#endif
Mar 25, 2006
Mar 25, 2006
157
// end of gui.h ...