Newer
Older
/***********************************************************************
* FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
* Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact the author by e-mail
* at "lyle@lylejohnson.name".
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
***********************************************************************/
/***********************************************************************
* $Id: FXRbFoldingList.h 2190 2005-08-24 07:58:47Z lyle $
***********************************************************************/
#ifndef FXRBFOLDINGLIST_H
#define FXRBFOLDINGLIST_H
#define DECLARE_FXFOLDINGITEM_STUBS(klass) \
inline void klass ## _setText(klass* self,const FXString& text){ \
self->klass::setText(text); \
} \
inline void klass ## _setOpenIcon(klass* self,FXIcon* icn,FXbool owned){ \
self->klass::setOpenIcon(icn,owned); \
} \
inline void klass ## _setClosedIcon(klass* self,FXIcon* icn,FXbool owned){ \
self->klass::setClosedIcon(icn,owned); \
} \
inline void klass ## _setFocus(klass* self,FXbool focus){ \
self->klass::setFocus(focus); \
} \
inline void klass ## _setSelected(klass* self,FXbool selected){ \
self->klass::setSelected(selected); \
} \
inline void klass ## _setOpened(klass* self,FXbool opened){ \
self->klass::setOpened(opened); \
} \
inline void klass ## _setExpanded(klass* self,FXbool expanded){ \
self->klass::setExpanded(expanded); \
} \
inline void klass ## _setEnabled(klass* self,FXbool enabled){ \
self->klass::setEnabled(enabled); \
} \
inline void klass ## _setDraggable(klass* self,FXbool draggable){ \
self->klass::setDraggable(draggable); \
} \
inline FXint klass ## _getWidth(const klass* self,const FXFoldingList* list){ \
return self->klass::getWidth(list); \
} \
inline FXint klass ## _getHeight(const klass* self,const FXFoldingList* list){ \
return self->klass::getHeight(list); \
} \
inline void klass ## _create(klass* self){ \
self->klass::create(); \
} \
inline void klass ## _detach(klass* self){ \
self->klass::detach(); \
} \
inline void klass ## _destroy(klass* self){ \
self->klass::destroy(); \
}
#define IMPLEMENT_FXFOLDINGITEM_STUBS(cls) \
void cls::setText(const FXString& txt){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setText",txt); \
} \
void cls::setOpenIcon(FXIcon* icn,FXbool owned){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setOpenIcon",icn,owned); \
} \
void cls::setClosedIcon(FXIcon* icn,FXbool owned){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setClosedIcon",icn,owned); \
} \
void cls::setFocus(FXbool focus){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setFocus",focus); \
} \
void cls::setSelected(FXbool selected){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setSelected",selected); \
} \
void cls::setOpened(FXbool opened){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setOpened",opened); \
} \
void cls::setExpanded(FXbool expanded){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setExpanded",expanded); \
} \
void cls::setEnabled(FXbool enabled){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setEnabled",enabled); \
} \
void cls::setDraggable(FXbool draggable){ \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setDraggable",draggable); \
} \
FXint cls::getWidth(const FXFoldingList* list) const { \
Lars Kanis
committed
return FXRbCallIntMethod(this,"getWidth",list); \
} \
FXint cls::getHeight(const FXFoldingList* list) const { \
Lars Kanis
committed
return FXRbCallIntMethod(this,"getHeight",list); \
Lars Kanis
committed
FXRbCallVoidMethod(this,"create"); \
Lars Kanis
committed
FXRbCallVoidMethod(this,"detach"); \
Lars Kanis
committed
FXRbCallVoidMethod(this,"destroy"); \
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
}
class FXRbFoldingItem : public FXFoldingItem {
FXDECLARE(FXRbFoldingItem)
protected:
FXRbFoldingItem(){}
#include "FXRbObjectVirtuals.h"
#include "FXRbFoldingItemVirtuals.h"
public:
// Is this tree item owned by an FXFoldingList yet?
FXbool owned;
public:
// Constructor
FXRbFoldingItem(const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL) : FXFoldingItem(text,oi,ci,ptr),owned(FALSE){}
// Mark dependencies for the GC
static void markfunc(FXFoldingItem* self);
// Destroy this object if it's not owned
static void freefunc(FXFoldingItem* self);
// Destructor
virtual ~FXRbFoldingItem(){
FXRbUnregisterRubyObj(this);
}
};
#define DECLARE_FXFOLDINGLIST_STUBS(klass) \
inline FXFoldingItem * klass ## _getItemAt(const klass* self,FXint x,FXint y){ \
return self->klass::getItemAt(x,y); \
} \
inline void klass ## _makeItemVisible(klass *self,FXFoldingItem *item){ \
self->klass::makeItemVisible(item); \
} \
inline FXbool klass ## _enableItem(klass *self,FXFoldingItem *item){ \
return self->klass::enableItem(item); \
} \
inline FXbool klass ## _disableItem(klass *self,FXFoldingItem *item){ \
return self->klass::disableItem(item); \
} \
inline FXbool klass ## _selectItem(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::selectItem(item,notify); \
} \
inline FXbool klass ## _deselectItem(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::deselectItem(item,notify); \
} \
inline FXbool klass ## _toggleItem(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::toggleItem(item,notify); \
} \
inline FXbool klass ## _extendSelection(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::extendSelection(item,notify); \
} \
inline FXbool klass ## _killSelection(klass *self,FXbool notify){ \
return self->klass::killSelection(notify); \
} \
inline FXbool klass ## _openItem(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::openItem(item,notify); \
} \
inline FXbool klass ## _closeItem(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::closeItem(item,notify); \
} \
inline FXbool klass ## _collapseTree(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::collapseTree(item,notify); \
} \
inline FXbool klass ## _expandTree(klass *self,FXFoldingItem *item,FXbool notify){ \
return self->klass::expandTree(item,notify); \
} \
inline void klass ## _setCurrentItem(klass *self,FXFoldingItem *item,FXbool notify){ \
self->klass::setCurrentItem(item,notify); \
}
#define IMPLEMENT_FXFOLDINGLIST_STUBS(cls) \
FXFoldingItem * cls::getItemAt(FXint x,FXint y) const { \
Lars Kanis
committed
return FXRbCallFoldingItemMethod(this,"getItemAt",x,y); \
} \
void cls::makeItemVisible(FXFoldingItem *item) { \
Lars Kanis
committed
FXRbCallVoidMethod(this,"makeItemVisible",item); \
} \
FXbool cls::enableItem(FXFoldingItem *item) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"enableItem",item); \
} \
FXbool cls::disableItem(FXFoldingItem *item) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"disableItem",item); \
} \
FXbool cls::selectItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"selectItem",item,notify); \
} \
FXbool cls::deselectItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"deselectItem",item,notify); \
} \
FXbool cls::toggleItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"toggleItem",item,notify); \
} \
FXbool cls::extendSelection(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"extendSelection",item,notify); \
} \
FXbool cls::killSelection(FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"killSelection",notify); \
} \
FXbool cls::openItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"openItem",item,notify); \
} \
FXbool cls::closeItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"closeItem",item,notify); \
} \
FXbool cls::collapseTree(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"collapseTree",item,notify); \
} \
FXbool cls::expandTree(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
return FXRbCallBoolMethod(this,"expandTree",item,notify); \
} \
void cls::setCurrentItem(FXFoldingItem *item,FXbool notify) { \
Lars Kanis
committed
FXRbCallVoidMethod(this,"setCurrentItem",item,notify); \
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
}
class FXRbFoldingList : public FXFoldingList {
FXDECLARE(FXRbFoldingList)
protected:
FXRbFoldingList(){}
#include "FXRbObjectVirtuals.h"
#include "FXRbIdVirtuals.h"
#include "FXRbDrawableVirtuals.h"
#include "FXRbWindowVirtuals.h"
#include "FXRbScrollAreaVirtuals.h"
#include "FXRbFoldingListVirtuals.h"
public:
/// Construct a folding tree list with nvis visible items; the list is initially empty
FXRbFoldingList(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FOLDINGLIST_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0) : FXFoldingList(p,tgt,sel,opts,x,y,w,h){
setSortFunc(FXRbFoldingList::sortFunc);
}
// Sort function stand-in
static FXint sortFunc(const FXFoldingItem* a,const FXFoldingItem* b);
// Mark dependencies for the GC
static void markfunc(FXFoldingList* self);
// Unregister objects that this folding list owns and is about to destroy
static void unregisterOwnedObjects(FXFoldingList *pFoldingList);
// Enumerate items
static void enumerateItem(FXFoldingItem* item,FXObjectListOf<FXFoldingItem>& items);
static void enumerateItems(FXFoldingItem* fm,FXFoldingItem* to,FXObjectListOf<FXFoldingItem>& items);
// Destructor
virtual ~FXRbFoldingList(){
FXRbFoldingList::unregisterOwnedObjects(this);
FXRbUnregisterRubyObj(this);
}
};
#endif