Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * T r e e L i s t B o x W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,2004 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXTreeListBox.h,v 1.27 2004/02/08 17:17:34 fox Exp $ * 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 /// Tree List Box styles 00035 enum { 00036 TREELISTBOX_NORMAL = 0 /// Normal style 00037 }; 00038 00039 00040 class FXButton; 00041 class FXMenuButton; 00042 class FXTreeList; 00043 class FXPopup; 00044 00045 00046 /// Tree List Box 00047 class FXAPI FXTreeListBox : public FXPacker { 00048 FXDECLARE(FXTreeListBox) 00049 protected: 00050 FXButton *field; 00051 FXMenuButton *button; 00052 FXTreeList *tree; 00053 FXPopup *pane; 00054 protected: 00055 FXTreeListBox(){} 00056 private: 00057 FXTreeListBox(const FXTreeListBox&); 00058 FXTreeListBox& operator=(const FXTreeListBox&); 00059 public: 00060 long onFocusUp(FXObject*,FXSelector,void*); 00061 long onFocusDown(FXObject*,FXSelector,void*); 00062 long onFocusSelf(FXObject*,FXSelector,void*); 00063 long onChanged(FXObject*,FXSelector,void*); 00064 long onCommand(FXObject*,FXSelector,void*); 00065 long onFieldButton(FXObject*,FXSelector,void*); 00066 long onTreeChanged(FXObject*,FXSelector,void*); 00067 long onTreeClicked(FXObject*,FXSelector,void*); 00068 long onUpdFmTree(FXObject*,FXSelector,void*); 00069 public: 00070 enum{ 00071 ID_TREE=FXPacker::ID_LAST, 00072 ID_FIELD, 00073 ID_LAST 00074 }; 00075 public: 00076 00077 /// Construct tree list box 00078 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); 00079 00080 /// Create server-side resources 00081 virtual void create(); 00082 00083 /// Detach server-side resources 00084 virtual void detach(); 00085 00086 /// Destroy server-side resources 00087 virtual void destroy(); 00088 00089 /// Perform layout 00090 virtual void layout(); 00091 00092 /// Enable widget 00093 virtual void enable(); 00094 00095 /// Disable widget 00096 virtual void disable(); 00097 00098 /// Return default with 00099 virtual FXint getDefaultWidth(); 00100 00101 /// Return default height 00102 virtual FXint getDefaultHeight(); 00103 00104 /// Return number of items 00105 FXint getNumItems() const; 00106 00107 /// Return number of visible items 00108 FXint getNumVisible() const; 00109 00110 /// Set number of visible items to determine default height 00111 void setNumVisible(FXint nvis); 00112 00113 /// Return first top-level item 00114 FXTreeItem* getFirstItem() const; 00115 00116 /// Return last top-level item 00117 FXTreeItem* getLastItem() const; 00118 00119 /// Add item as first child of parent p 00120 FXTreeItem* addItemFirst(FXTreeItem* p,FXTreeItem* item); 00121 00122 /// Add item as last child after parent p 00123 FXTreeItem* addItemLast(FXTreeItem* p,FXTreeItem* item); 00124 00125 /// Add item after other item 00126 FXTreeItem* addItemAfter(FXTreeItem* other,FXTreeItem* item); 00127 00128 /// Add item before other item 00129 FXTreeItem* addItemBefore(FXTreeItem* other,FXTreeItem* item); 00130 00131 /// Add item as first child of parent p 00132 FXTreeItem* addItemFirst(FXTreeItem* p,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL); 00133 00134 /// Add item as last child of parent p 00135 FXTreeItem* addItemLast(FXTreeItem* p,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL); 00136 00137 /// Add item after other item 00138 FXTreeItem* addItemAfter(FXTreeItem* other,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL); 00139 00140 /// Add item before other item 00141 FXTreeItem* addItemBefore(FXTreeItem* other,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL); 00142 00143 /// Remove item 00144 void removeItem(FXTreeItem* item); 00145 00146 /// Remove all items in range [fm...to] 00147 void removeItems(FXTreeItem* fm,FXTreeItem* to); 00148 00149 /// Remove all items from list 00150 void clearItems(); 00151 00152 /** 00153 * Search items for item by name, starting from start item; the 00154 * flags argument controls the search direction, and case sensitivity. 00155 */ 00156 FXTreeItem* findItem(const FXString& text,FXTreeItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const; 00157 00158 /// Return TRUE if item is the current item 00159 FXbool isItemCurrent(const FXTreeItem* item) const; 00160 00161 /// Return TRUE if item is leaf-item, i.e. has no children 00162 FXbool isItemLeaf(const FXTreeItem* item) const; 00163 00164 /// Sort the toplevel items with the sort function 00165 void sortRootItems(); 00166 00167 /// Sort all items recursively 00168 void sortItems(); 00169 00170 /// Sort child items of item 00171 void sortChildItems(FXTreeItem* item); 00172 00173 /// Change current item 00174 void setCurrentItem(FXTreeItem* item,FXbool notify=FALSE); 00175 00176 /// Return current item 00177 FXTreeItem* getCurrentItem() const; 00178 00179 /// Change item label 00180 void setItemText(FXTreeItem* item,const FXString& text); 00181 00182 /// Return item label 00183 FXString getItemText(const FXTreeItem* item) const; 00184 00185 /// Change item's open icon 00186 void setItemOpenIcon(FXTreeItem* item,FXIcon* icon); 00187 00188 /// Return item's open icon 00189 FXIcon* getItemOpenIcon(const FXTreeItem* item) const; 00190 00191 /// Change item's closed icon 00192 void setItemClosedIcon(FXTreeItem* item,FXIcon* icon); 00193 00194 /// Return item's closed icon 00195 FXIcon* getItemClosedIcon(const FXTreeItem* item) const; 00196 00197 /// Change item's user data 00198 void setItemData(FXTreeItem* item,void* ptr) const; 00199 00200 /// Return item's user data 00201 void* getItemData(const FXTreeItem* item) const; 00202 00203 /// Return item sort function 00204 FXTreeListSortFunc getSortFunc() const; 00205 00206 /// Change item sort function 00207 void setSortFunc(FXTreeListSortFunc func); 00208 00209 /// Is the pane shown 00210 FXbool isPaneShown() const; 00211 00212 /// Change font 00213 void setFont(FXFont* fnt); 00214 00215 /// Return font 00216 FXFont* getFont() const; 00217 00218 /// Return list style 00219 FXuint getListStyle() const; 00220 00221 /// Change list style 00222 void setListStyle(FXuint style); 00223 00224 /// Change help text 00225 void setHelpText(const FXString& txt); 00226 00227 /// Return help text 00228 FXString getHelpText() const; 00229 00230 /// Change tip text 00231 void setTipText(const FXString& txt); 00232 00233 /// Return tip text 00234 FXString getTipText() const; 00235 00236 /// Save object to a stream 00237 virtual void save(FXStream& store) const; 00238 00239 /// Load object from a stream 00240 virtual void load(FXStream& store); 00241 00242 /// Destructor 00243 virtual ~FXTreeListBox(); 00244 }; 00245 00246 } 00247 00248 #endif
Copyright © 1997-2004 Jeroen van der Zijp |