Skip to content

Latest commit

 

History

History
148 lines (117 loc) · 3.51 KB

gui.h

File metadata and controls

148 lines (117 loc) · 3.51 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
Mar 25, 2006
Mar 25, 2006
34
// public
Nov 29, 2006
Nov 29, 2006
35
36
37
38
39
40
uint8 (*priority)(MojoGui *gui);
const char* (*name)(MojoGui *gui);
boolean (*init)(MojoGui *gui);
void (*deinit)(MojoGui *gui);
void (*msgbox)(MojoGui *gui, const char *title, const char *text);
boolean (*promptyn)(MojoGui *gui, const char *title, const char *text);
Mar 25, 2006
Mar 25, 2006
42
// private
43
44
45
46
void *opaque;
};
Nov 29, 2006
Nov 29, 2006
47
typedef MojoGui* (*MojoGuiEntryPoint)(int revision);
Mar 25, 2006
Mar 25, 2006
48
Mar 27, 2006
Mar 27, 2006
49
50
51
52
53
54
#ifndef BUILDING_EXTERNAL_PLUGIN
extern MojoGui *GGui;
MojoGui *MojoGui_initGuiPlugin(void);
void MojoGui_deinitGuiPlugin(void);
#else
Nov 29, 2006
Nov 29, 2006
55
__EXPORT__ MojoGui *MOJOGUI_ENTRY_POINT(int revision);
Mar 27, 2006
Mar 27, 2006
56
Mar 25, 2006
Mar 25, 2006
57
58
59
60
61
/*
* 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
62
#define MOJOGUI_PLUGIN(module) \
Nov 29, 2006
Nov 29, 2006
63
MojoGui *MojoGuiPlugin_##module(int revision) \
Mar 25, 2006
Mar 25, 2006
64
{ \
Nov 29, 2006
Nov 29, 2006
65
66
67
68
69
70
71
72
73
74
75
76
if (revision == MOJOGUI_INTERFACE_REVISION) { \
static MojoGui retval; \
retval.priority = MojoGui_##module##_priority; \
retval.name = MojoGui_##module##_name; \
retval.init = MojoGui_##module##_init; \
retval.deinit = MojoGui_##module##_deinit; \
retval.msgbox = MojoGui_##module##_msgbox; \
retval.promptyn = MojoGui_##module##_promptyn; \
retval.opaque = NULL; \
return &retval; \
} \
return NULL; \
Mar 25, 2006
Mar 25, 2006
77
78
} \
Mar 27, 2006
Mar 27, 2006
79
#define CREATE_MOJOGUI_ENTRY_POINT(module) \
Nov 29, 2006
Nov 29, 2006
80
MojoGui *MOJOGUI_ENTRY_POINT(int revision) \
Mar 27, 2006
Mar 27, 2006
81
{ \
Nov 29, 2006
Nov 29, 2006
82
return MojoGuiPlugin_##module(revision); \
Mar 27, 2006
Mar 27, 2006
83
84
} \
Mar 25, 2006
Mar 25, 2006
85
#endif
Mar 25, 2006
Mar 25, 2006
86
Nov 29, 2006
Nov 29, 2006
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* make some decisions about which GUI plugins to build...
*/
// Probably want to support this always, unless explicitly overridden.
MojoGui *MojoGuiPlugin_stdio(int revision);
#ifndef SUPPORT_GUI_STDIO
#define SUPPORT_GUI_STDIO 1
#endif
// Probably want to statically link it, too.
#if SUPPORT_GUI_STDIO
# ifndef GUI_STATIC_LINK_STDIO
# define GUI_STATIC_LINK_STDIO 1
# endif
#endif
// !!! FIXME (Windows code isn't actually written yet...)
// Want to support this always on Windows, unless explicitly overridden.
MojoGui *MojoGuiPlugin_windows(int revision);
#ifndef SUPPORT_GUI_WINDOWS
# if PLATFORM_WINDOWS
# define SUPPORT_GUI_WINDOWS 1
# endif
#endif
// Probably want to statically link it, too.
#if SUPPORT_GUI_WINDOWS
# ifndef GUI_STATIC_LINK_WINDOWS
# define GUI_STATIC_LINK_WINDOWS 1
# endif
#endif
// !!! FIXME (GTK+ code isn't actually written yet...)
// Want to support this always on non-Mac Unix, unless explicitly overridden.
MojoGui *MojoGuiPlugin_gtkplus(int revision);
#ifndef SUPPORT_GUI_GTK_PLUS
# if ((PLATFORM_UNIX) && (!PLATFORM_MACOSX))
# define SUPPORT_GUI_GTK_PLUS 1
# endif
#endif
// Probably DON'T want to statically link it.
#if SUPPORT_GUI_GTK_PLUS
# ifndef GUI_STATIC_LINK_GTK_PLUS
# define GUI_STATIC_LINK_GTK_PLUS 0
# endif
#endif
// !!! FIXME: Qt? KDE? Gnome? Console? Cocoa?
141
142
143
144
145
146
#ifdef __cplusplus
}
#endif
#endif
Mar 25, 2006
Mar 25, 2006
147
// end of gui.h ...