summaryrefslogtreecommitdiff
path: root/iup/srclua5/il.h
blob: 5ef6b863544897f0779a3bac4d31f9c155eaa87d (plain)
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
/** \file
 * \brief IUPLua5 internal Functions
 *
 * See Copyright Notice in "iup.h"
 */
 
#ifndef __IL_H 
#define __IL_H

#ifdef __cplusplus
extern "C" {
#endif

int iuplistlua_open (lua_State * L);
int iuplabellua_open (lua_State * L);
int iupitemlua_open (lua_State * L);
int iupimagelua_open (lua_State * L);
int iuphboxlua_open (lua_State * L);
int iupframelua_open (lua_State * L);
int iupfilllua_open (lua_State * L);
int iupfiledlglua_open (lua_State * L);
int iupdialoglua_open (lua_State * L);
int iupcanvaslua_open (lua_State * L);
int iupbuttonlua_open (lua_State * L);
int iupzboxlua_open (lua_State * L);
int iupvboxlua_open (lua_State * L);
int iuptogglelua_open (lua_State * L);
int iuptimerlua_open (lua_State * L);
int iuptextlua_open (lua_State * L);
int iupsubmenulua_open (lua_State * L);
int iupseparatorlua_open (lua_State * L);
int iupradiolua_open (lua_State * L);
int iupmultilinelua_open (lua_State * L);
int iupmenulua_open (lua_State * L);
int iupcboxlua_open (lua_State * L);
int iupspinboxlua_open (lua_State * L);
int iupspinlua_open (lua_State * L);
int iupsboxlua_open (lua_State * L);
int iupsplitlua_open (lua_State * L);
int iupgclua_open (lua_State * L);
int iupvallua_open (lua_State * L);
int iuptabslua_open (lua_State * L);
int iupfontdlglua_open(lua_State * L);
int iupmessagedlglua_open(lua_State * L);
int iupcolordlglua_open(lua_State * L);
int iupimagergbalua_open(lua_State * L);
int iupimagergblua_open(lua_State * L);
int iupprogressbarlua_open(lua_State * L);
int iupnormalizerlua_open(lua_State * L);
int iupuserlua_open(lua_State * L);
int iuptreelua_open(lua_State * L);
int iupclipboardlua_open(lua_State * L);

void iupgetparamlua_open (lua_State * L);

int iupluaScanf(lua_State *L);
void iupluaapi_open(lua_State * L);


            /*     Registration    */

/** Gets the global enviroment "iup".
    Used by secondary iuplua modules.
 */
void iuplua_get_env(lua_State *L);

/** Returns true if IupOpen was called from inside the IupLua initialization function (iuplua_open).
 * All the other C intialization functions are called from the respective IupLua initialization functions.
 */
int iuplua_opencall_internal(lua_State *L);

/** Register a function.
 */
void iuplua_register(lua_State *L, lua_CFunction func, const char* name);

/** Register a string.
 */
void iuplua_regstring(lua_State *L, const char* str, const char* name);


          /*              Callbacks             */

/** Stores the Lua State inside the IUP element,
 * so it can be retreived from inside a callback.
 * Used in the creation of the element.
 */
void iuplua_plugstate(lua_State *L, Ihandle *ih);

/** Retrieve the Lua State. Used inside a callback.
 */
lua_State* iuplua_getstate(Ihandle *ih);

/** First function called inside a callback. 
 * It prepares the stack for the call and returns the Lua state.
 */
lua_State * iuplua_call_start(Ihandle *ih, const char* name);

/** Called when a callback in Lua should be called. 
 * nargs is the number of arguments after the first Ihandle*.
 * Returns the callback return value. If nil returns IUP_DEFAULT.
 * At the end clears the Lua stack. 
 */
int iuplua_call(lua_State *L, int nargs);

/** Same as /ref iuplua_call, but returns a string.
 */
char* iuplua_call_rs(lua_State *L, int nargs);

/** Same as lua_pcall, but if an error occour then
 * _ERRORMESSAGE is called. 
 */
int iuplua_call_raw(lua_State* L, int nargs, int nresults);

/** Register the callback in the iup.callbaks table.
 * If type is not NULL, register in a sub table with the controls class name.
 */
void iuplua_register_cb(lua_State *L, const char* name, lua_CFunction func, const char* type);


            /*     Functions                     */

/** Pushes a raw Ihandle into the stack (an userdata).
 * Used by the control creation functions.
 */
void iuplua_pushihandle_raw(lua_State *L, Ihandle *h);

/** Returns an array of string stored in a Lua table.
 */
char** iuplua_checkstring_array(lua_State *L, int pos);

/** Returns an array of int stored in a Lua table.
 */
int* iuplua_checkint_array(lua_State *L, int pos);

/** Returns an array of unsigned char stored in a Lua table.
 * Must have count elements.
 */
unsigned char* iuplua_checkuchar_array(lua_State *L, int pos, int count);

/** Returns an array of ihandle stored in a Lua table.
 */
Ihandle** iuplua_checkihandle_array(lua_State *L, int pos);

/** Same as iuplua_checkihandle but also accepts nil.
 */
Ihandle *iuplua_checkihandleornil(lua_State *L, int pos);

/** Removes the references in the Lua registry.
 */
void iuplua_removeihandle(lua_State *L, Ihandle *ih);


#ifdef __cplusplus
}
#endif

#endif