00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXTREELISTBOX_H
00022 #define FXTREELISTBOX_H
00023
00024 #ifndef FXPACKER_H
00025 #include "FXPacker.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00032 enum {
00033 TREELISTBOX_NORMAL = 0
00034 };
00035
00036
00037 class FXButton;
00038 class FXMenuButton;
00039 class FXTreeList;
00040 class FXPopup;
00041
00042
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 onTreeForward(FXObject*,FXSelector,void*);
00073 long onTreeClicked(FXObject*,FXSelector,void*);
00074 long onTreeCommand(FXObject*,FXSelector,void*);
00075 public:
00076 enum{
00077 ID_TREE=FXPacker::ID_LAST,
00078 ID_FIELD,
00079 ID_LAST
00080 };
00081 public:
00082
00084 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);
00085
00087 virtual void create();
00088
00090 virtual void detach();
00091
00093 virtual void destroy();
00094
00096 virtual void layout();
00097
00099 virtual void enable();
00100
00102 virtual void disable();
00103
00105 virtual FXint getDefaultWidth();
00106
00108 virtual FXint getDefaultHeight();
00109
00111 FXint getNumItems() const;
00112
00114 FXint getNumVisible() const;
00115
00117 void setNumVisible(FXint nvis);
00118
00120 FXTreeItem* getFirstItem() const;
00121
00123 FXTreeItem* getLastItem() const;
00124
00126 FXbool isItemCurrent(const FXTreeItem* item) const;
00127
00129 virtual void setCurrentItem(FXTreeItem* item,FXbool notify=false);
00130
00132 FXTreeItem* getCurrentItem() const;
00133
00135 FXint fillItems(FXTreeItem* father,const FXchar** strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=false);
00136
00138 FXint fillItems(FXTreeItem* father,const FXString& strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=false);
00139
00141 FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
00142
00144 FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=false);
00145
00147 FXTreeItem* appendItem(FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
00148
00150 FXTreeItem* appendItem(FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=false);
00151
00153 FXTreeItem* prependItem(FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
00154
00156 FXTreeItem* prependItem(FXTreeItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=false);
00157
00159 FXTreeItem *moveItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item);
00160
00162 FXTreeItem* extractItem(FXTreeItem* item,FXbool notify=false);
00163
00165 void removeItem(FXTreeItem* item,FXbool notify=false);
00166
00168 void removeItems(FXTreeItem* fm,FXTreeItem* to,FXbool notify=false);
00169
00171 void clearItems(FXbool notify=false);
00172
00183 FXTreeItem* findItem(const FXString& text,FXTreeItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00184
00192 FXTreeItem* findItemByData(const void *ptr,FXTreeItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00193
00195 FXbool isItemLeaf(const FXTreeItem* item) const;
00196
00198 void sortRootItems();
00199
00201 void sortItems();
00202
00204 void sortChildItems(FXTreeItem* item);
00205
00207 void setItemText(FXTreeItem* item,const FXString& text);
00208
00210 FXString getItemText(const FXTreeItem* item) const;
00211
00213 void setItemOpenIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=false);
00214
00216 FXIcon* getItemOpenIcon(const FXTreeItem* item) const;
00217
00219 void setItemClosedIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=false);
00220
00222 FXIcon* getItemClosedIcon(const FXTreeItem* item) const;
00223
00225 void setItemData(FXTreeItem* item,void* ptr) const;
00226
00228 void* getItemData(const FXTreeItem* item) const;
00229
00231 FXTreeListSortFunc getSortFunc() const;
00232
00234 void setSortFunc(FXTreeListSortFunc func);
00235
00237 void showMenu(FXbool shw);
00238
00240 FXbool isMenuShown() const;
00241
00243 void setFont(FXFont* fnt);
00244
00246 FXFont* getFont() const;
00247
00249 void setListStyle(FXuint style);
00250
00252 FXuint getListStyle() const;
00253
00255 void setShrinkWrap(FXbool flag);
00256
00258 FXbool getShrinkWrap() const;
00259
00261 void setHelpText(const FXString& txt);
00262
00264 const FXString& getHelpText() const;
00265
00267 void setTipText(const FXString& txt);
00268
00270 const FXString& getTipText() const;
00271
00273 virtual void save(FXStream& store) const;
00274
00276 virtual void load(FXStream& store);
00277
00279 virtual ~FXTreeListBox();
00280 };
00281
00282 }
00283
00284 #endif