2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #ifndef LUAAPI__OPTIONS_H
12 #define LUAAPI__OPTIONS_H
15 #include "luaapi/genericwrapper.h"
16 #include "luaapi/imaging.h"
20 //BEGIN Wrapper<OptList> -------------------------------------------------------
23 class Wrapper
<OptList
> : public GenericWrapperByValue
<OptList
> {
25 static const char* class_name();
26 static int to_string(lua_State
* l
);
27 static void create_index_table(lua_State
* l
);
28 static int constructor(lua_State
* l
);
29 static int newindex_event(lua_State
* l
);
30 static int index_event(lua_State
* l
);
33 //END Wrapper<OptList> ---------------------------------------------------------
35 //BEGIN Wrapper<BoolOptList> -------------------------------------------------------
38 class Wrapper
<BoolOptList
> : public GenericWrapperByValue
<BoolOptList
> {
40 static const char* class_name();
41 static int to_string(lua_State
* l
);
42 static void create_index_table(lua_State
* l
);
43 static int constructor(lua_State
* l
);
44 static int newindex_event(lua_State
* l
);
45 static int index_event(lua_State
* l
);
48 //END Wrapper<BoolOptList> ---------------------------------------------------------
50 //BEGIN Wrapper<BoolOptPtr> -------------------------------------------------------
53 class Wrapper
<BoolOptPtr
> : public GenericWrapperByValue
<BoolOptPtr
> {
55 PROPERTY_RO_QSTRING(name
, get()->name
)
56 PROPERTY_RO_QSTRING(label
, get()->label
)
57 PROPERTY_RO_CLASS(sub_options
, get()->subOptions
, OptList
)
58 PROPERTY_RW(value
, get()->value
, get()->setValue
, boolean
)
60 static const char* class_name();
61 static int to_string(lua_State
* l
);
62 static void create_index_table(lua_State
* l
);
63 static int constructor(lua_State
* l
);
66 //END Wrapper<BoolOptPtr> ---------------------------------------------------------
68 //BEGIN Wrapper<IntOptPtr> -------------------------------------------------------
71 class Wrapper
<IntOptPtr
> : public GenericWrapperByValue
<IntOptPtr
> {
73 PROPERTY_RO_QSTRING(name
, get()->name
)
74 PROPERTY_RO_QSTRING(label
, get()->label
)
75 PROPERTY_RO_TYPE(min
, get()->min
, number
, int)
76 PROPERTY_RO_TYPE(max
, get()->max
, number
, int)
77 PROPERTY_RW_TYPE(value
, get()->value
, get()->setValue
, number
, int)
78 static int get_visualization(lua_State
* l
) {
79 IntOpt::Visualization vis
= retrieve(l
, 1, DontCheck
)->get()->visualization();
82 lua_pushstring(l
, "spinbox");
85 lua_pushstring(l
, "slider");
91 static const char* class_name();
92 static int to_string(lua_State
* l
);
93 static void create_index_table(lua_State
* l
);
94 static int constructor(lua_State
* l
);
97 //END Wrapper<IntOptPtr> ---------------------------------------------------------
100 //BEGIN Wrapper<StringOptPtr> -------------------------------------------------------
103 class Wrapper
<StringOptPtr
> : public GenericWrapperByValue
<StringOptPtr
> {
105 PROPERTY_RO_QSTRING(name
, get()->name
)
106 PROPERTY_RO_QSTRING(label
, get()->label
)
107 PROPERTY_RW_QSTRING(value
, get()->value
, get()->setValue
)
109 static const char* class_name();
110 static int to_string(lua_State
* l
);
111 static void create_index_table(lua_State
* l
);
112 static int constructor(lua_State
* l
);
115 //END Wrapper<StringOptPtr> ---------------------------------------------------------
118 //BEGIN Wrapper<UrlOptPtr> -------------------------------------------------------
121 class Wrapper
<UrlOptPtr
> : public GenericWrapperByValue
<UrlOptPtr
> {
123 PROPERTY_RO_QSTRING(name
, get()->name
)
124 PROPERTY_RO_QSTRING(label
, get()->label
)
125 PROPERTY_RW_QSTRING(value
, get()->value
, get()->setValue
)
127 static const char* class_name();
128 static int to_string(lua_State
* l
);
129 static void create_index_table(lua_State
* l
);
130 static int constructor(lua_State
* l
);
133 //END Wrapper<UrlOptPtr> ---------------------------------------------------------
136 //BEGIN Wrapper<ColorOptPtr> -------------------------------------------------------
139 class Wrapper
<ColorOptPtr
> : public GenericWrapperByValue
<ColorOptPtr
> {
141 PROPERTY_RO_QSTRING(name
, get()->name
)
142 PROPERTY_RO_QSTRING(label
, get()->label
)
143 PROPERTY_RW_CLASS(value
, get()->value
, get()->setValue
, QColor
)
145 static const char* class_name();
146 static int to_string(lua_State
* l
);
147 static void create_index_table(lua_State
* l
);
148 static int constructor(lua_State
* l
);
151 //END Wrapper<ColorOptPtr> ---------------------------------------------------------
154 //BEGIN Wrapper<FontOptPtr> -------------------------------------------------------
157 class Wrapper
<FontOptPtr
> : public GenericWrapperByValue
<FontOptPtr
> {
159 PROPERTY_RO_QSTRING(name
, get()->name
)
160 PROPERTY_RO_QSTRING(label
, get()->label
)
161 PROPERTY_RW_CLASS(value
, get()->value
, get()->setValue
, QFont
)
163 static const char* class_name();
164 static int to_string(lua_State
* l
);
165 static void create_index_table(lua_State
* l
);
166 static int constructor(lua_State
* l
);
169 //END Wrapper<FontOptPtr> ---------------------------------------------------------
172 //BEGIN Wrapper<ComboOptPtr> -------------------------------------------------------
175 class Wrapper
<ComboOptPtr
> : public GenericWrapperByValue
<ComboOptPtr
> {
177 PROPERTY_RO_QSTRING(name
, get()->name
)
178 PROPERTY_RO_QSTRING(label
, get()->label
)
179 PROPERTY_RW_TYPE(selected
, get()->selected
, get()->setSelected
, number
, int)
181 static const char* class_name();
182 static int to_string(lua_State
* l
);
183 static void create_index_table(lua_State
* l
);
184 static int constructor(lua_State
* l
);
187 //END Wrapper<ComboOptPtr> ---------------------------------------------------------
190 //BEGIN Wrapper<SelectOptPtr> -------------------------------------------------------
193 class Wrapper
<SelectOptPtr
> : public GenericWrapperByValue
<SelectOptPtr
> {
195 PROPERTY_RO_QSTRING(name
, get()->name
)
196 PROPERTY_RO_QSTRING(label
, get()->label
)
197 PROPERTY_RO_CLASS(options
, get()->options
, BoolOptList
)
198 PROPERTY_RW_TYPE(selected
, get()->selected
, get()->setSelected
, number
, int)
200 static const char* class_name();
201 static int to_string(lua_State
* l
);
202 static void create_index_table(lua_State
* l
);
203 static int constructor(lua_State
* l
);
206 //END Wrapper<SelectOptPtr> ---------------------------------------------------------
208 } //end namespace luaapi
210 #endif //LUAAPI__OPTIONS_H