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
|
/** \file
* \brief Ihandle Object Definition
*
* See Copyright Notice in "iup.h"
*/
#ifndef __IUP_OBJECT_H
#define __IUP_OBJECT_H
#include <stdarg.h>
#include "iup_class.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup object Ihandle Object
* \par
* Object handle for all the elements.
* \par
* See \ref iup_object.h
* \ingroup cpi */
/* SIZE to RASTERSIZE
* \ingroup object */
#define iupWIDTH2RASTER(_w, _cw) ((int)((_w * _cw)/4.0 + 0.5))
/* SIZE to RASTERSIZE
* \ingroup object */
#define iupHEIGHT2RASTER(_h, _ch) ((int)((_h * _ch)/8.0 + 0.5))
/* RASTERSIZE to SIZE
* \ingroup object */
#define iupRASTER2WIDTH(_w, _cw) ((int)((_w * 4.0)/_cw + 0.5))
/* RASTERSIZE to SIZE
* \ingroup object */
#define iupRASTER2HEIGHT(_h, _ch) ((int)((_h * 8.0)/_ch + 0.5))
/** Expand configuration
* \ingroup object */
enum Iexpand {
IUP_EXPAND_NONE = 0x00,
IUP_EXPAND_H0 = 0x01, /* only set by IupFill */
IUP_EXPAND_H1 = 0x02,
IUP_EXPAND_W0 = 0x04, /* only set by IupFill */
IUP_EXPAND_W1 = 0x08
};
/** Expand configuration
* \ingroup object */
#define IUP_EXPAND_WIDTH (IUP_EXPAND_W1 | IUP_EXPAND_W0)
/** Expand configuration
* \ingroup object */
#define IUP_EXPAND_HEIGHT (IUP_EXPAND_H1 | IUP_EXPAND_H0)
/** Expand configuration
* \ingroup object */
#define IUP_EXPAND_BOTH (IUP_EXPAND_WIDTH | IUP_EXPAND_HEIGHT)
/** A simple definition that do not depends on the native system,
but helps a lot when writing native code. See \ref iup_object.h for definitions.
* \ingroup object */
#if defined(GTK_MAJOR_VERSION)
typedef struct _GtkWidget InativeHandle;
#elif defined(XmVERSION)
typedef struct _WidgetRec InativeHandle;
#elif defined(WINVER)
typedef struct HWND__ InativeHandle;
#else
typedef struct _InativeHandle InativeHandle;
#endif
/** Each control may define its own structure in its private module.
* \ingroup object */
typedef struct _IcontrolData IcontrolData;
/** IcontrolData allocation utility.
* \ingroup object */
#define iupALLOCCTRLDATA() ((IcontrolData*)calloc(1, sizeof(IcontrolData)))
/** Structure used by all the elements.
* \ingroup object */
struct Ihandle_
{
char sig[4]; /**< IUP Signature, initialized with "IUP", cleared on destroy */
Iclass* iclass; /**< Ihandle Class */
Itable* attrib; /**< attributes table */
int serial; /**< serial number used for controls that need a numeric id, initialized with -1 */
InativeHandle* handle; /**< native handle. initialized when mapped. InativeHandle definition is system dependent. */
int expand; /**< expand configuration, a combination of \ref Iexpand, for containers is a combination of the children expand's */
int is_floating; /**< floating attribute */
int x, y; /**< upper-left corner relative to the native parent. always 0 for the dialog. */
int userwidth, userheight; /**< user defined size for the control using SIZE or RASTERSIZE */
int naturalwidth, naturalheight; /**< the calculated size based in the control contents and the user size */
int currentwidth, currentheight; /**< actual size of the control in pixels (window size, including decorations and margins). */
int has_maxsize, has_minsize; /**< indicates that the control has the attributes MAXSIZE and/or MINSIZE */
Ihandle* parent; /**< previous control in the hierarchy tree */
Ihandle* firstchild; /**< first child control in the hierarchy tree */
Ihandle* brother; /**< next control inside parent */
IcontrolData* data; /**< private control data. automatically freed if not NULL in destroy */
};
/* Creates an object. initializes iclass and nativetype.
* Called only from IupCreate and IupLoad. */
Ihandle* iupObjectCreate(Iclass* ic, void** params);
/** Utility that returns an array of parameters. Must call free for the returned value after usage.
* Used by the creation functions of objects that receives a NULL terminated array of parameters.
* \ingroup object */
void** iupObjectGetParamList(void* first, va_list arglist);
/** Checks if the handle is still valid based on the signature.
* But if the handle was destroyed still can access invalid memory.
* \ingroup object */
int iupObjectCheck(Ihandle* ih);
/* Other functions declared in <iup.h> and implemented here.
IupCreate
IupCreatev
IupCreatep
IupDestroy
*/
#ifdef __cplusplus
}
#endif
#endif
|