1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
/** \file
* \brief User API
* IUP - A Portable User Interface Toolkit
* Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
* http://www.tecgraf.puc-rio.br/iup mailto:iup@tecgraf.puc-rio.br
*
* See Copyright Notice at the end of this file
*/
#ifndef __IUP_H
#define __IUP_H
#include <iupkey.h>
#include <iupdef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define IUP_NAME "IUP - Portable User Interface"
#define IUP_COPYRIGHT "Copyright (C) 1994-2010 Tecgraf, PUC-Rio."
#define IUP_DESCRIPTION "Portable toolkit for building graphical user interfaces."
#define IUP_VERSION "3.2" /* bug fixes are reported only by IupVersion functions */
#define IUP_VERSION_NUMBER 302000
#define IUP_VERSION_DATE "2010/06/26" /* does not include bug fix releases */
typedef struct Ihandle_ Ihandle;
typedef int (*Icallback)(Ihandle*);
/************************************************************************/
/* Main API */
/************************************************************************/
int IupOpen (int *argc, char ***argv);
void IupClose (void);
void IupImageLibOpen (void);
int IupMainLoop (void);
int IupLoopStep (void);
int IupLoopStepWait (void);
int IupMainLoopLevel (void);
void IupFlush (void);
void IupExitLoop (void);
void IupUpdate (Ihandle* ih);
void IupUpdateChildren(Ihandle* ih);
void IupRedraw (Ihandle* ih, int children);
void IupRefresh (Ihandle* ih);
char* IupMapFont (const char *iupfont);
char* IupUnMapFont (const char *driverfont);
int IupHelp (const char* url);
char* IupLoad (const char *filename);
char* IupLoadBuffer (const char *buffer);
char* IupVersion (void);
char* IupVersionDate (void);
int IupVersionNumber (void);
void IupSetLanguage (const char *lng);
char* IupGetLanguage (void);
void IupDestroy (Ihandle* ih);
void IupDetach (Ihandle* child);
Ihandle* IupAppend (Ihandle* ih, Ihandle* child);
Ihandle* IupInsert (Ihandle* ih, Ihandle* ref_child, Ihandle* child);
Ihandle* IupGetChild (Ihandle* ih, int pos);
int IupGetChildPos (Ihandle* ih, Ihandle* child);
int IupGetChildCount(Ihandle* ih);
Ihandle* IupGetNextChild (Ihandle* ih, Ihandle* child);
Ihandle* IupGetBrother (Ihandle* ih);
Ihandle* IupGetParent (Ihandle* ih);
Ihandle* IupGetDialog (Ihandle* ih);
Ihandle* IupGetDialogChild(Ihandle* ih, const char* name);
int IupReparent (Ihandle* ih, Ihandle* new_parent);
int IupPopup (Ihandle* ih, int x, int y);
int IupShow (Ihandle* ih);
int IupShowXY (Ihandle* ih, int x, int y);
int IupHide (Ihandle* ih);
int IupMap (Ihandle* ih);
void IupUnmap (Ihandle *ih);
void IupSetAttribute (Ihandle* ih, const char* name, const char* value);
void IupStoreAttribute(Ihandle* ih, const char* name, const char* value);
Ihandle* IupSetAttributes (Ihandle* ih, const char *str);
char* IupGetAttribute (Ihandle* ih, const char* name);
char* IupGetAttributes (Ihandle* ih);
int IupGetInt (Ihandle* ih, const char* name);
int IupGetInt2 (Ihandle* ih, const char* name);
int IupGetIntInt (Ihandle *ih, const char* name, int *i1, int *i2);
float IupGetFloat (Ihandle* ih, const char* name);
void IupSetfAttribute (Ihandle* ih, const char* name, const char* format, ...);
void IupResetAttribute(Ihandle *ih, const char* name);
int IupGetAllAttributes(Ihandle* ih, char** names, int n);
Ihandle* IupSetAtt(const char* handle_name, Ihandle* ih, const char* name, ...);
void IupSetGlobal (const char* name, const char* value);
void IupStoreGlobal (const char* name, const char* value);
char* IupGetGlobal (const char* name);
Ihandle* IupSetFocus (Ihandle* ih);
Ihandle* IupGetFocus (void);
Ihandle* IupPreviousField (Ihandle* ih);
Ihandle* IupNextField (Ihandle* ih);
Icallback IupGetCallback(Ihandle* ih, const char *name);
Icallback IupSetCallback(Ihandle* ih, const char *name, Icallback func);
Ihandle* IupSetCallbacks(Ihandle* ih, const char *name, Icallback func, ...);
Icallback IupGetFunction (const char *name);
Icallback IupSetFunction (const char *name, Icallback func);
const char* IupGetActionName (void);
Ihandle* IupGetHandle (const char *name);
Ihandle* IupSetHandle (const char *name, Ihandle* ih);
int IupGetAllNames (char** names, int n);
int IupGetAllDialogs (char** names, int n);
char* IupGetName (Ihandle* ih);
void IupSetAttributeHandle(Ihandle* ih, const char* name, Ihandle* ih_named);
Ihandle* IupGetAttributeHandle(Ihandle* ih, const char* name);
char* IupGetClassName(Ihandle* ih);
char* IupGetClassType(Ihandle* ih);
int IupGetClassAttributes(const char* classname, char** names, int n);
void IupSaveClassAttributes(Ihandle* ih);
void IupSetClassDefaultAttribute(const char* classname, const char *name, const char* value);
Ihandle* IupCreate (const char *classname);
Ihandle* IupCreatev(const char *classname, void* *params);
Ihandle* IupCreatep(const char *classname, void *first, ...);
/************************************************************************/
/* Elements */
/************************************************************************/
Ihandle* IupFill (void);
Ihandle* IupRadio (Ihandle* child);
Ihandle* IupVbox (Ihandle* child, ...);
Ihandle* IupVboxv (Ihandle* *children);
Ihandle* IupZbox (Ihandle* child, ...);
Ihandle* IupZboxv (Ihandle* *children);
Ihandle* IupHbox (Ihandle* child,...);
Ihandle* IupHboxv (Ihandle* *children);
Ihandle* IupNormalizer (Ihandle* ih_first, ...);
Ihandle* IupNormalizerv(Ihandle* *ih_list);
Ihandle* IupCbox (Ihandle* child, ...);
Ihandle* IupCboxv (Ihandle* *children);
Ihandle* IupSbox (Ihandle *child);
Ihandle* IupSplit (Ihandle* child1, Ihandle* child2);
Ihandle* IupFrame (Ihandle* child);
Ihandle* IupImage (int width, int height, const unsigned char *pixmap);
Ihandle* IupImageRGB (int width, int height, const unsigned char *pixmap);
Ihandle* IupImageRGBA (int width, int height, const unsigned char *pixmap);
Ihandle* IupItem (const char* title, const char* action);
Ihandle* IupSubmenu (const char* title, Ihandle* child);
Ihandle* IupSeparator (void);
Ihandle* IupMenu (Ihandle* child,...);
Ihandle* IupMenuv (Ihandle* *children);
Ihandle* IupButton (const char* title, const char* action);
Ihandle* IupCanvas (const char* action);
Ihandle* IupDialog (Ihandle* child);
Ihandle* IupUser (void);
Ihandle* IupLabel (const char* title);
Ihandle* IupList (const char* action);
Ihandle* IupText (const char* action);
Ihandle* IupMultiLine (const char* action);
Ihandle* IupToggle (const char* title, const char* action);
Ihandle* IupTimer (void);
Ihandle* IupClipboard (void);
Ihandle* IupProgressBar(void);
Ihandle* IupVal (const char *type);
Ihandle* IupTabs (Ihandle* child, ...);
Ihandle* IupTabsv (Ihandle* *children);
Ihandle* IupTree (void);
Ihandle* IupSpin (void);
Ihandle* IupSpinbox (Ihandle* child);
/* IupImage utility */
int IupSaveImageAsText(Ihandle* ih, const char* file_name, const char* format, const char* name);
/* IupText utilities */
void IupTextConvertLinColToPos(Ihandle* ih, int lin, int col, int *pos);
void IupTextConvertPosToLinCol(Ihandle* ih, int pos, int *lin, int *col);
/* IupText, IupList and IupTree utility */
int IupConvertXYToPos(Ihandle* ih, int x, int y);
/* IupTree utilities */
int IupTreeSetUserId(Ihandle* ih, int id, void* userid);
void* IupTreeGetUserId(Ihandle* ih, int id);
int IupTreeGetId(Ihandle* ih, void *userid);
void IupTreeSetAttribute (Ihandle* ih, const char* name, int id, const char* value);
void IupTreeStoreAttribute(Ihandle* ih, const char* name, int id, const char* value);
char* IupTreeGetAttribute (Ihandle* ih, const char* name, int id);
int IupTreeGetInt (Ihandle* ih, const char* name, int id);
float IupTreeGetFloat (Ihandle* ih, const char* name, int id);
void IupTreeSetfAttribute (Ihandle* ih, const char* name, int id, const char* format, ...);
void IupTreeSetAttributeHandle(Ihandle* ih, const char* a, int id, Ihandle* ih_named);
/************************************************************************/
/* Pre-definided dialogs */
/************************************************************************/
Ihandle* IupFileDlg(void);
Ihandle* IupMessageDlg(void);
Ihandle* IupColorDlg(void);
Ihandle* IupFontDlg(void);
int IupGetFile(char *arq);
void IupMessage(const char *title, const char *msg);
void IupMessagef(const char *title, const char *format, ...);
int IupAlarm(const char *title, const char *msg, const char *b1, const char *b2, const char *b3);
int IupScanf(const char *format, ...);
int IupListDialog(int type, const char *title, int size, const char** list,
int op, int max_col, int max_lin, int* marks);
int IupGetText(const char* title, char* text);
int IupGetColor(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
typedef int (*Iparamcb)(Ihandle* dialog, int param_index, void* user_data);
int IupGetParam(const char* title, Iparamcb action, void* user_data, const char* format,...);
int IupGetParamv(const char* title, Iparamcb action, void* user_data, const char* format, int param_count, int param_extra, void** param_data);
#ifdef __cplusplus
}
#endif
/************************************************************************/
/* Common Return Values */
/************************************************************************/
#define IUP_ERROR 1
#define IUP_NOERROR 0
#define IUP_OPENED -1
#define IUP_INVALID -1
/************************************************************************/
/* Callback Return Values */
/************************************************************************/
#define IUP_IGNORE -1
#define IUP_DEFAULT -2
#define IUP_CLOSE -3
#define IUP_CONTINUE -4
/************************************************************************/
/* IupPopup and IupShowXY Parameter Values */
/************************************************************************/
#define IUP_CENTER 0xFFFF /* 65535 */
#define IUP_LEFT 0xFFFE /* 65534 */
#define IUP_RIGHT 0xFFFD /* 65533 */
#define IUP_MOUSEPOS 0xFFFC /* 65532 */
#define IUP_CURRENT 0xFFFB /* 65531 */
#define IUP_CENTERPARENT 0xFFFA /* 65530 */
#define IUP_TOP IUP_LEFT
#define IUP_BOTTOM IUP_RIGHT
/************************************************************************/
/* SHOW_CB Callback Values */
/************************************************************************/
enum{IUP_SHOW, IUP_RESTORE, IUP_MINIMIZE, IUP_MAXIMIZE, IUP_HIDE};
/************************************************************************/
/* SCROLL_CB Callback Values */
/************************************************************************/
enum{IUP_SBUP, IUP_SBDN, IUP_SBPGUP, IUP_SBPGDN, IUP_SBPOSV, IUP_SBDRAGV,
IUP_SBLEFT, IUP_SBRIGHT, IUP_SBPGLEFT, IUP_SBPGRIGHT, IUP_SBPOSH, IUP_SBDRAGH};
/************************************************************************/
/* Mouse Button Values and Macros */
/************************************************************************/
#define IUP_BUTTON1 '1'
#define IUP_BUTTON2 '2'
#define IUP_BUTTON3 '3'
#define IUP_BUTTON4 '4'
#define IUP_BUTTON5 '5'
#define iup_isshift(_s) (_s[0]=='S')
#define iup_iscontrol(_s) (_s[1]=='C')
#define iup_isbutton1(_s) (_s[2]=='1')
#define iup_isbutton2(_s) (_s[3]=='2')
#define iup_isbutton3(_s) (_s[4]=='3')
#define iup_isdouble(_s) (_s[5]=='D')
#define iup_isalt(_s) (_s[6]=='A')
#define iup_issys(_s) (_s[7]=='Y')
#define iup_isbutton4(_s) (_s[8]=='4')
#define iup_isbutton5(_s) (_s[9]=='5')
/* Old definitions for backward compatibility */
#define isshift iup_isshift
#define iscontrol iup_iscontrol
#define isbutton1 iup_isbutton1
#define isbutton2 iup_isbutton2
#define isbutton3 iup_isbutton3
#define isdouble iup_isdouble
#define isalt iup_isalt
#define issys iup_issys
#define isbutton4 iup_isbutton4
#define isbutton5 iup_isbutton5
/************************************************************************/
/* Pre-Defined Masks */
/************************************************************************/
#define IUP_MASK_FLOAT "[+/-]?(/d+/.?/d*|/./d+)"
#define IUP_MASK_UFLOAT "(/d+/.?/d*|/./d+)"
#define IUP_MASK_EFLOAT "[+/-]?(/d+/.?/d*|/./d+)([eE][+/-]?/d+)?"
#define IUP_MASK_INT "[+/-]?/d+"
#define IUP_MASK_UINT "/d+"
/* Old definitions for backward compatibility */
#define IUPMASK_FLOAT IUP_MASK_FLOAT
#define IUPMASK_UFLOAT IUP_MASK_UFLOAT
#define IUPMASK_EFLOAT IUP_MASK_EFLOAT
#define IUPMASK_INT IUP_MASK_INT
#define IUPMASK_UINT IUP_MASK_UINT
/************************************************************************/
/* Replacement for the WinMain in Windows, */
/* this allows the application to start from "main". */
/* Used only for Watcom. */
/************************************************************************/
#if defined (__WATCOMC__)
#ifdef __cplusplus
extern "C" {
int IupMain (int argc, char** argv); /* In C++ we have to declare the prototype */
}
#endif
#define main IupMain /* this is the trick for Watcom and MetroWerks */
#endif
/******************************************************************************
* Copyright (C) 1994-2010 Tecgraf, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#endif
|