00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXTREELISTBOX_H
00025 #define FXTREELISTBOX_H
00026
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00034
00035 enum {
00036 TREELISTBOX_NORMAL = 0
00037 };
00038
00039
00040 class FXButton;
00041 class FXMenuButton;
00042 class FXTreeList;
00043 class FXPopup;
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class FXAPI FXTreeListBox : public FXPacker {
00054 FXDECLARE(FXTreeListBox)
00055 protected:
00056 FXButton *field;
00057 FXMenuButton *button;
00058 FXTreeList *tree;
00059 FXPopup *pane;
00060 protected:
00061 FXTreeListBox(){}
00062 private:
00063 FXTreeListBox(const FXTreeListBox&);
00064 FXTreeListBox& operator=(const FXTreeListBox&);
00065 public:
00066 long onFocusUp(FXObject*,FXSelector,void*);
00067 long onFocusDown(FXObject*,FXSelector,void*);
00068 long onFocusSelf(FXObject*,FXSelector,void*);
00069 long onMouseWheel(FXObject*,FXSelector,void*);
00070 long onFieldButton(FXObject*,FXSelector,void*);
00071 long onTreeUpdate(FXObject*,FXSelector,void*);
00072 long onTreeChanged(FXObject*,FXSelector,void*);
00073 long onTreeClicked(FXObject*,FXSelector,void*);
00074 public:
00075 enum{
00076 ID_TREE=FXPacker::ID_LAST,
00077 ID_FIELD,
00078 ID_LAST
00079 };
00080 public:
00081
00082
00083 FXTreeListBox(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00084
00085
00086 virtual void create();
00087
00088
00089 virtual void detach();
00090
00091
00092 virtual void destroy();
00093
00094
00095 virtual void layout();
00096
00097
00098 virtual void enable();
00099
00100
00101 virtual void disable();
00102
00103
00104 virtual FXint getDefaultWidth();
00105
00106
00107 virtual FXint getDefaultHeight();
00108
00109
00110 FXint getNumItems() const;
00111
00112
00113 FXint getNumVisible() const;
00114
00115
00116 void setNumVisible(FXint nvis);
00117
00118
00119 FXTreeItem* getFirstItem() const;
00120
00121
00122 FXTreeItem* getLastItem() const;
00123
00124
00125 FXint fillItems(FXTreeItem* father,const FXchar** strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL);
00126
00127
00128 FXint fillItems(FXTreeItem* father,const FXString& strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL);
00129
00130
00131 FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item);
00132
00133
00134 FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL);
00135
00136
00137 FXTreeItem* appendItem(FXTreeItem* father,FXTreeItem* item);
00138
00139
00140 FXTreeItem* appendItem(FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL);
00141
00142
00143 FXTreeItem* prependItem(FXTreeItem* father,FXTreeItem* item);
00144
00145
00146 FXTreeItem* prependItem(FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL);
00147
00148
00149 FXTreeItem *moveItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item);
00150
00151
00152 FXTreeItem* extractItem(FXTreeItem* item);
00153
00154
00155 void removeItem(FXTreeItem* item);
00156
00157
00158 void removeItems(FXTreeItem* fm,FXTreeItem* to);
00159
00160
00161 void clearItems();
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 FXTreeItem* findItem(const FXString& text,FXTreeItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00174
00175
00176
00177
00178
00179
00180
00181
00182 FXTreeItem* findItemByData(const void *ptr,FXTreeItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00183
00184
00185 FXbool isItemCurrent(const FXTreeItem* item) const;
00186
00187
00188 FXbool isItemLeaf(const FXTreeItem* item) const;
00189
00190
00191 void sortRootItems();
00192
00193
00194 void sortItems();
00195
00196
00197 void sortChildItems(FXTreeItem* item);
00198
00199
00200 virtual void setCurrentItem(FXTreeItem* item,FXbool notify=FALSE);
00201
00202
00203 FXTreeItem* getCurrentItem() const;
00204
00205
00206 void setItemText(FXTreeItem* item,const FXString& text);
00207
00208
00209 FXString getItemText(const FXTreeItem* item) const;
00210
00211
00212 void setItemOpenIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=FALSE);
00213
00214
00215 FXIcon* getItemOpenIcon(const FXTreeItem* item) const;
00216
00217
00218 void setItemClosedIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=FALSE);
00219
00220
00221 FXIcon* getItemClosedIcon(const FXTreeItem* item) const;
00222
00223
00224 void setItemData(FXTreeItem* item,void* ptr) const;
00225
00226
00227 void* getItemData(const FXTreeItem* item) const;
00228
00229
00230 FXTreeListSortFunc getSortFunc() const;
00231
00232
00233 void setSortFunc(FXTreeListSortFunc func);
00234
00235
00236 FXbool isPaneShown() const;
00237
00238
00239 void setFont(FXFont* fnt);
00240
00241
00242 FXFont* getFont() const;
00243
00244
00245 FXuint getListStyle() const;
00246
00247
00248 void setListStyle(FXuint style);
00249
00250
00251 void setHelpText(const FXString& txt);
00252
00253
00254 const FXString& getHelpText() const;
00255
00256
00257 void setTipText(const FXString& txt);
00258
00259
00260 const FXString& getTipText() const;
00261
00262
00263 virtual void save(FXStream& store) const;
00264
00265
00266 virtual void load(FXStream& store);
00267
00268
00269 virtual ~FXTreeListBox();
00270 };
00271
00272 }
00273
00274 #endif