Skip to content

Latest commit

 

History

History
167 lines (143 loc) · 5.56 KB

gui.h

File metadata and controls

167 lines (143 loc) · 5.56 KB
 
May 12, 2007
May 12, 2007
1
2
3
4
5
6
7
8
/**
* MojoSetup; a portable, flexible installation application.
*
* Please see the file LICENSE.txt in the source's root directory.
*
* This file written by Ryan C. Gordon.
*/
9
10
11
12
13
14
15
16
17
18
19
20
#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
21
MOJOGUI_PRIORITY_USER_REQUESTED,
22
23
MOJOGUI_PRIORITY_TRY_FIRST,
MOJOGUI_PRIORITY_TRY_NORMAL,
Mar 25, 2006
Mar 25, 2006
24
25
MOJOGUI_PRIORITY_TRY_LAST,
MOJOGUI_PRIORITY_TOTAL
26
27
} MojoGuiPluginPriority;
Nov 29, 2006
Nov 29, 2006
28
29
30
31
/*
* Abstract GUI interfaces.
*/
Nov 29, 2006
Nov 29, 2006
32
Dec 27, 2006
Dec 27, 2006
33
34
35
36
37
38
39
typedef struct MojoGuiSetupOptions MojoGuiSetupOptions;
struct MojoGuiSetupOptions
{
const char *description;
boolean value;
boolean is_group_parent;
uint64 size;
Dec 27, 2006
Dec 27, 2006
40
int opaque; // GUI drivers shouldn't touch this.
May 12, 2007
May 12, 2007
41
void *guiopaque; // For GUI drivers. App won't touch or free this.
Dec 27, 2006
Dec 27, 2006
42
43
44
45
MojoGuiSetupOptions *next_sibling;
MojoGuiSetupOptions *child;
};
Nov 29, 2006
Nov 29, 2006
46
47
48
49
50
51
52
53
#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
55
56
57
58
59
60
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
61
62
boolean (*start)(const char *title, const char *splash);
void (*stop)(void);
May 10, 2007
May 10, 2007
63
int (*readme)(const char *name, const uint8 *data, size_t len,
May 10, 2007
May 10, 2007
64
boolean can_back, boolean can_fwd);
May 10, 2007
May 10, 2007
65
int (*options)(MojoGuiSetupOptions *opts,
May 10, 2007
May 10, 2007
66
boolean can_back, boolean can_fwd);
May 10, 2007
May 10, 2007
67
68
char * (*destination)(const char **recommendations, int recnum,
int *command, boolean can_back, boolean can_fwd);
Apr 21, 2007
Apr 21, 2007
69
boolean (*insertmedia)(const char *medianame);
May 7, 2007
May 7, 2007
70
71
boolean (*progress)(const char *type, const char *component,
int percent, const char *item);
May 12, 2007
May 12, 2007
72
void (*final)(const char *msg);
73
74
};
Dec 7, 2006
Dec 7, 2006
75
76
typedef const MojoGui* (*MojoGuiEntryPoint)(int revision,
const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
78
79
80
#if !BUILDING_EXTERNAL_PLUGIN
extern const MojoGui *GGui;
const MojoGui *MojoGui_initGuiPlugin(void);
Mar 27, 2006
Mar 27, 2006
81
82
83
void MojoGui_deinitGuiPlugin(void);
#else
Dec 7, 2006
Dec 7, 2006
84
85
__EXPORT__ const MojoGui *MOJOGUI_ENTRY_POINT(int revision,
const MojoSetupEntryPoints *e);
Mar 27, 2006
Mar 27, 2006
86
Mar 25, 2006
Mar 25, 2006
87
88
89
90
91
/*
* 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
92
#define MOJOGUI_PLUGIN(module) \
Dec 7, 2006
Dec 7, 2006
93
94
95
96
97
98
99
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
100
101
static boolean MojoGui_##module##_start(const char *t, const char *s); \
static void MojoGui_##module##_stop(void); \
May 10, 2007
May 10, 2007
102
static int MojoGui_##module##_readme(const char *name, const uint8 *data, \
May 10, 2007
May 10, 2007
103
104
size_t len, boolean can_back, \
boolean can_fwd); \
May 10, 2007
May 10, 2007
105
static int MojoGui_##module##_options(MojoGuiSetupOptions *opts, \
May 10, 2007
May 10, 2007
106
boolean can_back, boolean can_fwd); \
May 10, 2007
May 10, 2007
107
108
static char *MojoGui_##module##_destination(const char **r, int recnum, \
int *command, boolean can_back, boolean can_fwd); \
Apr 21, 2007
Apr 21, 2007
109
static boolean MojoGui_##module##_insertmedia(const char *medianame); \
May 7, 2007
May 7, 2007
110
111
static boolean MojoGui_##module##_progress(const char *typ, const char *comp, \
int percent, const char *item); \
May 12, 2007
May 12, 2007
112
static void MojoGui_##module##_final(const char *msg); \
Dec 7, 2006
Dec 7, 2006
113
const MojoGui *MojoGuiPlugin_##module(int rev, const MojoSetupEntryPoints *e) \
Mar 25, 2006
Mar 25, 2006
114
{ \
Dec 7, 2006
Dec 7, 2006
115
116
117
118
119
120
121
122
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
123
124
125
MojoGui_##module##_start, \
MojoGui_##module##_stop, \
MojoGui_##module##_readme, \
Dec 27, 2006
Dec 27, 2006
126
MojoGui_##module##_options, \
Dec 28, 2006
Dec 28, 2006
127
MojoGui_##module##_destination, \
Apr 21, 2007
Apr 21, 2007
128
MojoGui_##module##_insertmedia, \
May 7, 2007
May 7, 2007
129
MojoGui_##module##_progress, \
May 12, 2007
May 12, 2007
130
MojoGui_##module##_final, \
Dec 7, 2006
Dec 7, 2006
131
132
}; \
entry = e; \
Nov 29, 2006
Nov 29, 2006
133
134
135
return &retval; \
} \
return NULL; \
Mar 25, 2006
Mar 25, 2006
136
137
} \
Mar 27, 2006
Mar 27, 2006
138
#define CREATE_MOJOGUI_ENTRY_POINT(module) \
Dec 7, 2006
Dec 7, 2006
139
const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
Mar 27, 2006
Mar 27, 2006
140
{ \
Dec 7, 2006
Dec 7, 2006
141
return MojoGuiPlugin_##module(rev, e); \
Mar 27, 2006
Mar 27, 2006
142
143
} \
Mar 25, 2006
Mar 25, 2006
144
#endif
Mar 25, 2006
Mar 25, 2006
145
Nov 29, 2006
Nov 29, 2006
146
147
148
/*
* make some decisions about which GUI plugins to build...
Dec 7, 2006
Dec 7, 2006
149
150
* We list them all here, but some are built, some aren't. Some are DLLs,
* some aren't...
Nov 29, 2006
Nov 29, 2006
151
152
153
*/
// Probably want to support this always, unless explicitly overridden.
Dec 7, 2006
Dec 7, 2006
154
const MojoGui *MojoGuiPlugin_stdio(int rev, const MojoSetupEntryPoints *e);
May 10, 2007
May 10, 2007
155
const MojoGui *MojoGuiPlugin_gtkplus2(int rev, const MojoSetupEntryPoints *e);
Dec 7, 2006
Dec 7, 2006
156
const MojoGui *MojoGuiPlugin_macosx(int rev, const MojoSetupEntryPoints *e);
Dec 1, 2006
Dec 1, 2006
157
Nov 29, 2006
Nov 29, 2006
158
159
// !!! FIXME: Qt? KDE? Gnome? Console? Cocoa?
160
161
162
163
164
165
#ifdef __cplusplus
}
#endif
#endif
Mar 25, 2006
Mar 25, 2006
166
// end of gui.h ...