Skip to content

Latest commit

 

History

History
156 lines (133 loc) · 5.25 KB

gui.h

File metadata and controls

156 lines (133 loc) · 5.25 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.
May 12, 2007
May 12, 2007
33
void *guiopaque; // For GUI drivers. App won't touch or free this.
Dec 27, 2006
Dec 27, 2006
34
35
36
37
MojoGuiSetupOptions *next_sibling;
MojoGuiSetupOptions *child;
};
Nov 29, 2006
Nov 29, 2006
38
39
40
41
42
43
44
45
#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
47
48
49
50
51
52
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
53
54
boolean (*start)(const char *title, const char *splash);
void (*stop)(void);
May 10, 2007
May 10, 2007
55
int (*readme)(const char *name, const uint8 *data, size_t len,
May 10, 2007
May 10, 2007
56
boolean can_back, boolean can_fwd);
May 10, 2007
May 10, 2007
57
int (*options)(MojoGuiSetupOptions *opts,
May 10, 2007
May 10, 2007
58
boolean can_back, boolean can_fwd);
May 10, 2007
May 10, 2007
59
60
char * (*destination)(const char **recommendations, int recnum,
int *command, boolean can_back, boolean can_fwd);
Apr 21, 2007
Apr 21, 2007
61
boolean (*insertmedia)(const char *medianame);
May 7, 2007
May 7, 2007
62
63
boolean (*progress)(const char *type, const char *component,
int percent, const char *item);
64
65
};
Dec 7, 2006
Dec 7, 2006
66
67
typedef const MojoGui* (*MojoGuiEntryPoint)(int revision,
const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
69
70
71
#if !BUILDING_EXTERNAL_PLUGIN
extern const MojoGui *GGui;
const MojoGui *MojoGui_initGuiPlugin(void);
Mar 27, 2006
Mar 27, 2006
72
73
74
void MojoGui_deinitGuiPlugin(void);
#else
Dec 7, 2006
Dec 7, 2006
75
76
__EXPORT__ const MojoGui *MOJOGUI_ENTRY_POINT(int revision,
const MojoSetupEntryPoints *e);
Mar 27, 2006
Mar 27, 2006
77
Mar 25, 2006
Mar 25, 2006
78
79
80
81
82
/*
* 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
83
#define MOJOGUI_PLUGIN(module) \
Dec 7, 2006
Dec 7, 2006
84
85
86
87
88
89
90
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
91
92
static boolean MojoGui_##module##_start(const char *t, const char *s); \
static void MojoGui_##module##_stop(void); \
May 10, 2007
May 10, 2007
93
static int MojoGui_##module##_readme(const char *name, const uint8 *data, \
May 10, 2007
May 10, 2007
94
95
size_t len, boolean can_back, \
boolean can_fwd); \
May 10, 2007
May 10, 2007
96
static int MojoGui_##module##_options(MojoGuiSetupOptions *opts, \
May 10, 2007
May 10, 2007
97
boolean can_back, boolean can_fwd); \
May 10, 2007
May 10, 2007
98
99
static char *MojoGui_##module##_destination(const char **r, int recnum, \
int *command, boolean can_back, boolean can_fwd); \
Apr 21, 2007
Apr 21, 2007
100
static boolean MojoGui_##module##_insertmedia(const char *medianame); \
May 7, 2007
May 7, 2007
101
102
static boolean MojoGui_##module##_progress(const char *typ, const char *comp, \
int percent, const char *item); \
Dec 7, 2006
Dec 7, 2006
103
const MojoGui *MojoGuiPlugin_##module(int rev, const MojoSetupEntryPoints *e) \
Mar 25, 2006
Mar 25, 2006
104
{ \
Dec 7, 2006
Dec 7, 2006
105
106
107
108
109
110
111
112
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
113
114
115
MojoGui_##module##_start, \
MojoGui_##module##_stop, \
MojoGui_##module##_readme, \
Dec 27, 2006
Dec 27, 2006
116
MojoGui_##module##_options, \
Dec 28, 2006
Dec 28, 2006
117
MojoGui_##module##_destination, \
Apr 21, 2007
Apr 21, 2007
118
MojoGui_##module##_insertmedia, \
May 7, 2007
May 7, 2007
119
MojoGui_##module##_progress, \
Dec 7, 2006
Dec 7, 2006
120
121
}; \
entry = e; \
Nov 29, 2006
Nov 29, 2006
122
123
124
return &retval; \
} \
return NULL; \
Mar 25, 2006
Mar 25, 2006
125
126
} \
Mar 27, 2006
Mar 27, 2006
127
#define CREATE_MOJOGUI_ENTRY_POINT(module) \
Dec 7, 2006
Dec 7, 2006
128
const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
Mar 27, 2006
Mar 27, 2006
129
{ \
Dec 7, 2006
Dec 7, 2006
130
return MojoGuiPlugin_##module(rev, e); \
Mar 27, 2006
Mar 27, 2006
131
132
} \
Mar 25, 2006
Mar 25, 2006
133
#endif
Mar 25, 2006
Mar 25, 2006
134
Nov 29, 2006
Nov 29, 2006
135
136
137
/*
* make some decisions about which GUI plugins to build...
Dec 7, 2006
Dec 7, 2006
138
139
* We list them all here, but some are built, some aren't. Some are DLLs,
* some aren't...
Nov 29, 2006
Nov 29, 2006
140
141
142
*/
// Probably want to support this always, unless explicitly overridden.
Dec 7, 2006
Dec 7, 2006
143
const MojoGui *MojoGuiPlugin_stdio(int rev, const MojoSetupEntryPoints *e);
May 10, 2007
May 10, 2007
144
const MojoGui *MojoGuiPlugin_gtkplus2(int rev, const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
145
const MojoGui *MojoGuiPlugin_macosx(int rev, const MojoSetupEntryPoints *e);
Dec 1, 2006
Dec 1, 2006
146
Nov 29, 2006
Nov 29, 2006
147
148
// !!! FIXME: Qt? KDE? Gnome? Console? Cocoa?
149
150
151
152
153
154
#ifdef __cplusplus
}
#endif
#endif
Mar 25, 2006
Mar 25, 2006
155
// end of gui.h ...