Skip to content

Latest commit

 

History

History
128 lines (106 loc) · 4.01 KB

gui.h

File metadata and controls

128 lines (106 loc) · 4.01 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
25
26
27
28
29
30
31
32
#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
34
35
36
37
38
39
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
40
41
42
43
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);
44
45
};
Dec 7, 2006
Dec 7, 2006
46
47
typedef const MojoGui* (*MojoGuiEntryPoint)(int revision,
const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
49
50
51
#if !BUILDING_EXTERNAL_PLUGIN
extern const MojoGui *GGui;
const MojoGui *MojoGui_initGuiPlugin(void);
Mar 27, 2006
Mar 27, 2006
52
53
54
void MojoGui_deinitGuiPlugin(void);
#else
Dec 7, 2006
Dec 7, 2006
55
56
__EXPORT__ const MojoGui *MOJOGUI_ENTRY_POINT(int revision,
const MojoSetupEntryPoints *e);
Mar 27, 2006
Mar 27, 2006
57
Mar 25, 2006
Mar 25, 2006
58
59
60
61
62
/*
* 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
63
#define MOJOGUI_PLUGIN(module) \
Dec 7, 2006
Dec 7, 2006
64
65
66
67
68
69
70
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
71
72
73
74
75
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 7, 2006
Dec 7, 2006
76
const MojoGui *MojoGuiPlugin_##module(int rev, const MojoSetupEntryPoints *e) \
Mar 25, 2006
Mar 25, 2006
77
{ \
Dec 7, 2006
Dec 7, 2006
78
79
80
81
82
83
84
85
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
86
87
88
MojoGui_##module##_start, \
MojoGui_##module##_stop, \
MojoGui_##module##_readme, \
Dec 7, 2006
Dec 7, 2006
89
90
}; \
entry = e; \
Nov 29, 2006
Nov 29, 2006
91
92
93
return &retval; \
} \
return NULL; \
Mar 25, 2006
Mar 25, 2006
94
95
} \
Mar 27, 2006
Mar 27, 2006
96
#define CREATE_MOJOGUI_ENTRY_POINT(module) \
Dec 7, 2006
Dec 7, 2006
97
const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
Mar 27, 2006
Mar 27, 2006
98
{ \
Dec 7, 2006
Dec 7, 2006
99
return MojoGuiPlugin_##module(rev, e); \
Mar 27, 2006
Mar 27, 2006
100
101
} \
Mar 25, 2006
Mar 25, 2006
102
#endif
Mar 25, 2006
Mar 25, 2006
103
Nov 29, 2006
Nov 29, 2006
104
105
106
/*
* make some decisions about which GUI plugins to build...
Dec 7, 2006
Dec 7, 2006
107
108
* We list them all here, but some are built, some aren't. Some are DLLs,
* some aren't...
Nov 29, 2006
Nov 29, 2006
109
110
111
*/
// Probably want to support this always, unless explicitly overridden.
Dec 7, 2006
Dec 7, 2006
112
const MojoGui *MojoGuiPlugin_stdio(int rev, const MojoSetupEntryPoints *e);
Nov 29, 2006
Nov 29, 2006
113
// !!! FIXME (Windows code isn't actually written yet...)
Dec 7, 2006
Dec 7, 2006
114
const MojoGui *MojoGuiPlugin_windows(int rev, const MojoSetupEntryPoints *e);
Nov 29, 2006
Nov 29, 2006
115
// !!! FIXME (GTK+ code isn't actually written yet...)
Dec 7, 2006
Dec 7, 2006
116
117
const MojoGui *MojoGuiPlugin_gtkplus(int rev, const MojoSetupEntryPoints *e);
const MojoGui *MojoGuiPlugin_macosx(int rev, const MojoSetupEntryPoints *e);
Dec 1, 2006
Dec 1, 2006
118
Nov 29, 2006
Nov 29, 2006
119
120
// !!! FIXME: Qt? KDE? Gnome? Console? Cocoa?
121
122
123
124
125
126
#ifdef __cplusplus
}
#endif
#endif
Mar 25, 2006
Mar 25, 2006
127
// end of gui.h ...