Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXFoldingList.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                    F o l d i n g   L i s t   W i d g e t                      *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2006 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: FXFoldingList.h,v 1.34 2006/01/22 17:58:02 fox Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXFOLDINGLIST_H
00025 #define FXFOLDINGLIST_H
00026 
00027 #ifndef FXSCROLLAREA_H
00028 #include "FXScrollArea.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXIcon;
00035 class FXFont;
00036 class FXHeader;
00037 class FXFoldingList;
00038 
00039 
00040 /// Folding list styles
00041 enum {
00042   FOLDINGLIST_EXTENDEDSELECT = 0,            /// Extended selection mode allows for drag-selection of ranges of items
00043   FOLDINGLIST_SINGLESELECT   = 0x00100000,   /// Single selection mode allows up to one item to be selected
00044   FOLDINGLIST_BROWSESELECT   = 0x00200000,   /// Browse selection mode enforces one single item to be selected at all times
00045   FOLDINGLIST_MULTIPLESELECT = 0x00300000,   /// Multiple selection mode is used for selection of individual items
00046   FOLDINGLIST_AUTOSELECT     = 0x00400000,   /// Automatically select under cursor
00047   FOLDINGLIST_SHOWS_LINES    = 0x00800000,   /// Lines shown
00048   FOLDINGLIST_SHOWS_BOXES    = 0x01000000,   /// Boxes to expand shown
00049   FOLDINGLIST_ROOT_BOXES     = 0x02000000,   /// Display root boxes also
00050   FOLDINGLIST_NORMAL         = FOLDINGLIST_EXTENDEDSELECT
00051   };
00052 
00053 
00054 /// Tree list Item
00055 class FXAPI FXFoldingItem : public FXObject {
00056   FXDECLARE(FXFoldingItem)
00057   friend class FXFoldingList;
00058   friend class FXDirList;
00059 protected:
00060   FXFoldingItem *parent;
00061   FXFoldingItem *prev;
00062   FXFoldingItem *next;
00063   FXFoldingItem *first;
00064   FXFoldingItem *last;
00065   FXString       label;
00066   FXIcon        *openIcon;
00067   FXIcon        *closedIcon;
00068   void          *data;
00069   FXuint         state;
00070   FXint          x,y;
00071 private:
00072   FXFoldingItem(const FXFoldingItem&);
00073   FXFoldingItem& operator=(const FXFoldingItem&);
00074 protected:
00075   FXFoldingItem():parent(NULL),prev(NULL),next(NULL),first(NULL),last(NULL),openIcon(NULL),closedIcon(NULL),data(NULL),state(0),x(0),y(0){}
00076   virtual void draw(const FXFoldingList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
00077   virtual FXint hitItem(const FXFoldingList* list,FXint x,FXint y) const;
00078 public:
00079   enum{
00080     SELECTED        = 1,        /// Selected
00081     FOCUS           = 2,        /// Focus
00082     DISABLED        = 4,        /// Disabled
00083     OPENED          = 8,        /// Opened
00084     EXPANDED        = 16,       /// Expanded
00085     HASITEMS        = 32,       /// Has virtual subitems
00086     DRAGGABLE       = 64,       /// Draggable
00087     OPENICONOWNED   = 128,      /// Open icon owned by item
00088     CLOSEDICONOWNED = 256       /// Close icon owned by item
00089     };
00090 public:
00091 
00092   /// Constructor
00093   FXFoldingItem(const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL):parent(NULL),prev(NULL),next(NULL),first(NULL),last(NULL),label(text),openIcon(oi),closedIcon(ci),data(ptr),state(0),x(0),y(0){}
00094 
00095   /// Get parent item
00096   FXFoldingItem* getParent() const { return parent; }
00097 
00098   /// Get next sibling item
00099   FXFoldingItem* getNext() const { return next; }
00100 
00101   /// Get previous sibling item
00102   FXFoldingItem* getPrev() const { return prev; }
00103 
00104   /// Get first child item
00105   FXFoldingItem* getFirst() const { return first; }
00106 
00107   /// Get las child item
00108   FXFoldingItem* getLast() const { return last; }
00109 
00110   /// Get item below this one in list
00111   FXFoldingItem* getBelow() const;
00112 
00113   /// Get item above this one in list
00114   FXFoldingItem* getAbove() const;
00115 
00116   /// Get number of children of item
00117   FXint getNumChildren() const;
00118 
00119   /// Change item label
00120   virtual void setText(const FXString& txt);
00121 
00122   /// Get item label
00123   const FXString& getText() const { return label; }
00124 
00125   /// Change open icon, deleting old icon if it was owned
00126   virtual void setOpenIcon(FXIcon* icn,FXbool owned=FALSE);
00127 
00128   /// Get open icon
00129   FXIcon* getOpenIcon() const { return openIcon; }
00130 
00131   /// Change closed icon, deleting old icon if it was owned
00132   virtual void setClosedIcon(FXIcon* icn,FXbool owned=FALSE);
00133 
00134   /// Get closed icon
00135   FXIcon* getClosedIcon() const { return closedIcon; }
00136 
00137   /// Change item user data
00138   void setData(void* ptr){ data=ptr; }
00139 
00140   /// Get item user data
00141   void* getData() const { return data; }
00142 
00143   /// Make item draw as focused
00144   virtual void setFocus(FXbool focus);
00145 
00146   /// Return true if item has focus
00147   FXbool hasFocus() const { return (state&FOCUS)!=0; }
00148 
00149   /// Select item
00150   virtual void setSelected(FXbool selected);
00151 
00152   /// Return true if this item is selected
00153   FXbool isSelected() const { return (state&SELECTED)!=0; }
00154 
00155   /// Make item show as open
00156   virtual void setOpened(FXbool opened);
00157 
00158   /// Return true if this item is open
00159   FXbool isOpened() const { return (state&OPENED)!=0; }
00160 
00161   /// Expand or collapse item
00162   virtual void setExpanded(FXbool expanded);
00163 
00164   /// Return true if this item is expanded into sub items
00165   FXbool isExpanded() const { return (state&EXPANDED)!=0; }
00166 
00167   /// Enable or disable item
00168   virtual void setEnabled(FXbool enabled);
00169 
00170   /// Return true if this item is enabled
00171   FXbool isEnabled() const { return (state&DISABLED)==0; }
00172 
00173   /// Make item draggable
00174   virtual void setDraggable(FXbool draggable);
00175 
00176   /// Return true if this item is draggable
00177   FXbool isDraggable() const { return (state&DRAGGABLE)!=0; }
00178 
00179   /// Return TRUE if subitems, real or imagined
00180   FXbool hasItems() const { return (state&HASITEMS)!=0; }
00181 
00182   /// Change has items flag
00183   void setHasItems(FXbool flag);
00184 
00185   /// Return true if descendent of parent item
00186   FXbool isChildOf(const FXFoldingItem* item) const;
00187 
00188   /// Return true if ancestor of child item
00189   FXbool isParentOf(const FXFoldingItem* item) const;
00190 
00191   /// Return width of item as drawn in list
00192   virtual FXint getWidth(const FXFoldingList* list) const;
00193 
00194   /// Return height of item as drawn in list
00195   virtual FXint getHeight(const FXFoldingList* list) const;
00196 
00197   /// Create server-side resources
00198   virtual void create();
00199 
00200   /// Detach server-side resources
00201   virtual void detach();
00202 
00203   /// Destroy server-side resources
00204   virtual void destroy();
00205 
00206   /// Save to stream
00207   virtual void save(FXStream& store) const;
00208 
00209   /// Load from stream
00210   virtual void load(FXStream& store);
00211 
00212   /// Destroy item and free icons if owned
00213   virtual ~FXFoldingItem();
00214   };
00215 
00216 
00217 
00218 /// Folding item collate function
00219 typedef FXint (*FXFoldingListSortFunc)(const FXFoldingItem*,const FXFoldingItem*);
00220 
00221 
00222 
00223 /**
00224 * A Folding List Widget resembles a Tree list except that it supports a
00225 * header control to provide each item with multiple columns of text.
00226 * Subtrees can be collapsed or expanded by double-clicking on an item
00227 * or by clicking on the optional plus button in front of the item.
00228 * Each item may have a text and optional open-icon as well as a closed-icon.
00229 * The items may be connected by optional lines to show the hierarchical
00230 * relationship.
00231 * When an item's selected state changes, the folding list emits a SEL_SELECTED
00232 * or SEL_DESELECTED message.  If an item is opened or closed, a message
00233 * of type SEL_OPENED or SEL_CLOSED is sent.  When the subtree under an
00234 * item is expanded, a SEL_EXPANDED or SEL_COLLAPSED message is issued.
00235 * A change of the current item is signified by the SEL_CHANGED message.
00236 * In addition, the folding list sends SEL_COMMAND messages when the user
00237 * clicks on an item, and SEL_CLICKED, SEL_DOUBLECLICKED, and SEL_TRIPLECLICKED
00238 * when the user clicks once, twice, or thrice, respectively.
00239 * When items are added or removed, the folding list sends messages of the
00240 * type SEL_INSERTED or SEL_DELETED.
00241 * In each of these cases, a pointer to the item, if any, is passed in the
00242 * 3rd argument of the message.
00243 */
00244 class FXAPI FXFoldingList : public FXScrollArea {
00245   FXDECLARE(FXFoldingList)
00246 protected:
00247   FXHeader          *header;            // Tree header
00248   FXFoldingItem     *firstitem;         // First root item
00249   FXFoldingItem     *lastitem;          // Last root item
00250   FXFoldingItem     *anchoritem;        // Selection anchor item
00251   FXFoldingItem     *currentitem;       // Current item
00252   FXFoldingItem     *extentitem;        // Selection extent
00253   FXFoldingItem     *cursoritem;        // Item under cursor
00254   FXFoldingItem     *viewableitem;      // Viewable item
00255   FXFont            *font;              // Font
00256   FXFoldingListSortFunc sortfunc;       // Item sort function
00257   FXColor            textColor;         // Text color
00258   FXColor            selbackColor;      // Selected background color
00259   FXColor            seltextColor;      // Selected text color
00260   FXColor            lineColor;         // Line color
00261   FXint              treeWidth;         // Tree width
00262   FXint              treeHeight;        // Tree height
00263   FXint              visible;           // Number of visible items
00264   FXint              indent;            // Parent to child indentation
00265   FXint              grabx;             // Grab point x
00266   FXint              graby;             // Grab point y
00267   FXString           lookup;            // Lookup string
00268   FXString           help;              // Help string
00269   FXbool             state;             // State of item
00270 protected:
00271   FXFoldingList();
00272   void recompute();
00273   void mergesort(FXFoldingItem*& list);
00274   void sort(FXFoldingItem*& f1,FXFoldingItem*& t1,FXFoldingItem*& f2,FXFoldingItem*& t2,int n);
00275   virtual void moveContents(FXint x,FXint y);
00276   virtual FXFoldingItem* createItem(const FXString& text,FXIcon* oi,FXIcon* ci,void* ptr);
00277   static FXint compareSection(const FXchar *p,const FXchar* q,FXint s);
00278   static FXint compareSectionCase(const FXchar *p,const FXchar* q,FXint s);
00279 private:
00280   FXFoldingList(const FXFoldingList&);
00281   FXFoldingList& operator=(const FXFoldingList&);
00282 public:
00283   long onPaint(FXObject*,FXSelector,void*);
00284   long onEnter(FXObject*,FXSelector,void*);
00285   long onLeave(FXObject*,FXSelector,void*);
00286   long onUngrabbed(FXObject*,FXSelector,void*);
00287   long onMotion(FXObject*,FXSelector,void*);
00288   long onKeyPress(FXObject*,FXSelector,void*);
00289   long onKeyRelease(FXObject*,FXSelector,void*);
00290   long onLeftBtnPress(FXObject*,FXSelector,void*);
00291   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00292   long onRightBtnPress(FXObject*,FXSelector,void*);
00293   long onRightBtnRelease(FXObject*,FXSelector,void*);
00294   long onHeaderChanged(FXObject*,FXSelector,void*);
00295   long onQueryTip(FXObject*,FXSelector,void*);
00296   long onQueryHelp(FXObject*,FXSelector,void*);
00297   long onTipTimer(FXObject*,FXSelector,void*);
00298   long onFocusIn(FXObject*,FXSelector,void*);
00299   long onFocusOut(FXObject*,FXSelector,void*);
00300   long onAutoScroll(FXObject*,FXSelector,void*);
00301   long onClicked(FXObject*,FXSelector,void*);
00302   long onDoubleClicked(FXObject*,FXSelector,void*);
00303   long onTripleClicked(FXObject*,FXSelector,void*);
00304   long onCommand(FXObject*,FXSelector,void*);
00305   long onLookupTimer(FXObject*,FXSelector,void*);
00306 public:
00307   static FXint ascending(const FXFoldingItem*,const FXFoldingItem*);
00308   static FXint descending(const FXFoldingItem*,const FXFoldingItem*);
00309   static FXint ascendingCase(const FXFoldingItem*,const FXFoldingItem*);
00310   static FXint descendingCase(const FXFoldingItem*,const FXFoldingItem*);
00311 public:
00312   enum {
00313     ID_LOOKUPTIMER=FXScrollArea::ID_LAST,
00314     ID_HEADER_CHANGE,
00315     ID_LAST
00316     };
00317 public:
00318 
00319   /// Construct a folding list; the folding list is initially empty
00320   FXFoldingList(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FOLDINGLIST_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00321 
00322   /// Create server-side resources
00323   virtual void create();
00324 
00325   /// Detach server-side resources
00326   virtual void detach();
00327 
00328   /// Perform layout
00329   virtual void layout();
00330 
00331   /// Return default width
00332   virtual FXint getDefaultWidth();
00333 
00334   /// Return default height
00335   virtual FXint getDefaultHeight();
00336 
00337   /// Compute and return content width
00338   virtual FXint getContentWidth();
00339 
00340   /// Return content height
00341   virtual FXint getContentHeight();
00342 
00343   /// Recalculate layout
00344   virtual void recalc();
00345 
00346   /// Tree list can receive focus
00347   virtual bool canFocus() const;
00348 
00349   /// Move the focus to this window
00350   virtual void setFocus();
00351 
00352   /// Remove the focus from this window
00353   virtual void killFocus();
00354 
00355   /// Return header control
00356   FXHeader* getHeader() const { return header; }
00357 
00358   /// Set headers from array of strings
00359   void setHeaders(const FXchar** strings,FXint size=1);
00360 
00361   /// Set headers from newline separated strings
00362   void setHeaders(const FXString& strings,FXint size=1);
00363 
00364   /// Append header with given text and optional icon
00365   void appendHeader(const FXString& text,FXIcon *icon=NULL,FXint size=1);
00366 
00367   /// Remove header at index
00368   void removeHeader(FXint index);
00369 
00370   /// Change text of header at index
00371   void setHeaderText(FXint index,const FXString& text);
00372 
00373   /// Return text of header at index
00374   FXString getHeaderText(FXint index) const;
00375 
00376   /// Change icon of header at index
00377   void setHeaderIcon(FXint index,FXIcon *icon);
00378 
00379   /// Return icon of header at index
00380   FXIcon* getHeaderIcon(FXint index) const;
00381 
00382   /// Change size of header at index
00383   void setHeaderSize(FXint index,FXint size);
00384 
00385   /// Return width of header at index
00386   FXint getHeaderSize(FXint index) const;
00387 
00388   /// Return number of headers
00389   FXint getNumHeaders() const;
00390 
00391   /// Return number of items
00392   FXint getNumItems() const;
00393 
00394   /// Return number of visible items
00395   FXint getNumVisible() const { return visible; }
00396 
00397   /// Change number of visible items
00398   void setNumVisible(FXint nvis);
00399 
00400   /// Return first root item
00401   FXFoldingItem* getFirstItem() const { return firstitem; }
00402 
00403   /// Return last root item
00404   FXFoldingItem* getLastItem() const { return lastitem; }
00405 
00406   /// Fill list by appending items from array of strings
00407   FXint fillItems(FXFoldingItem* father,const FXchar** strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=FALSE);
00408 
00409   /// Fill list by appending items from newline separated strings
00410   FXint fillItems(FXFoldingItem* father,const FXString& strings,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=FALSE);
00411 
00412   /// Insert [possibly subclassed] item under father before other item
00413   FXFoldingItem* insertItem(FXFoldingItem* other,FXFoldingItem* father,FXFoldingItem* item,FXbool notify=FALSE);
00414 
00415   /// Insert item with given text and optional icons, and user-data pointer under father before other item
00416   FXFoldingItem* insertItem(FXFoldingItem* other,FXFoldingItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=FALSE);
00417 
00418   /// Append [possibly subclassed] item as last child of father
00419   FXFoldingItem* appendItem(FXFoldingItem* father,FXFoldingItem* item,FXbool notify=FALSE);
00420 
00421   /// Append item with given text and optional icons, and user-data pointer as last child of father
00422   FXFoldingItem* appendItem(FXFoldingItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=FALSE);
00423 
00424   /// Prepend [possibly subclassed] item as first child of father
00425   FXFoldingItem* prependItem(FXFoldingItem* father,FXFoldingItem* item,FXbool notify=FALSE);
00426 
00427   /// Prepend item with given text and optional icons, and user-data pointer as first child of father
00428   FXFoldingItem* prependItem(FXFoldingItem* father,const FXString& text,FXIcon* oi=NULL,FXIcon* ci=NULL,void* ptr=NULL,FXbool notify=FALSE);
00429 
00430   /// Move item under father before other item
00431   FXFoldingItem *moveItem(FXFoldingItem* other,FXFoldingItem* father,FXFoldingItem* item);
00432 
00433   /// Extract item
00434   FXFoldingItem* extractItem(FXFoldingItem* item,FXbool notify=FALSE);
00435 
00436   /// Remove item
00437   void removeItem(FXFoldingItem* item,FXbool notify=FALSE);
00438 
00439   /// Remove items in range [fm, to] inclusively
00440   void removeItems(FXFoldingItem* fm,FXFoldingItem* to,FXbool notify=FALSE);
00441 
00442   /// Remove all items from list
00443   void clearItems(FXbool notify=FALSE);
00444 
00445   /// Return item width
00446   FXint getItemWidth(const FXFoldingItem* item) const { return item->getWidth(this); }
00447 
00448   /// Return item height
00449   FXint getItemHeight(const FXFoldingItem* item) const { return item->getHeight(this); }
00450 
00451   /// Get item at x,y, if any
00452   virtual FXFoldingItem* getItemAt(FXint x,FXint y) const;
00453 
00454   /**
00455   * Search items by name, beginning from item start.  If the start item
00456   * is NULL the search will start at the first, top-most item in the list.
00457   * Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search
00458   * direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP
00459   * to control whether the search wraps at the start or end of the list.
00460   * The option SEARCH_IGNORECASE causes a case-insensitive match.  Finally,
00461   * passing SEARCH_PREFIX causes searching for a prefix of the item name.
00462   * Return NULL if no matching item is found.
00463   */
00464   FXFoldingItem* findItem(const FXString& text,FXFoldingItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00465 
00466   /**
00467   * Search items by associated user data, beginning from item start. If the
00468   * start item is NULL the search will start at the first, top-most item
00469   * in the list.  Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control
00470   * the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP
00471   * to control whether the search wraps at the start or end of the list.
00472   */
00473   FXFoldingItem* findItemByData(const void *ptr,FXFoldingItem* start=NULL,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00474 
00475   /// Scroll to make item visible
00476   virtual void makeItemVisible(FXFoldingItem* item);
00477 
00478   /// Change item's text
00479   void setItemText(FXFoldingItem* item,const FXString& text);
00480 
00481   /// Return item's text
00482   FXString getItemText(const FXFoldingItem* item) const;
00483 
00484   /// Change item's open icon, deleting old icon if it was owned
00485   void setItemOpenIcon(FXFoldingItem* item,FXIcon* icon,FXbool owned=FALSE);
00486 
00487   /// Return item's open icon
00488   FXIcon* getItemOpenIcon(const FXFoldingItem* item) const;
00489 
00490   /// Chance item's closed icon, deleting old icon if it was owned
00491   void setItemClosedIcon(FXFoldingItem* item,FXIcon* icon,FXbool owned=FALSE);
00492 
00493   /// Return item's closed icon
00494   FXIcon* getItemClosedIcon(const FXFoldingItem* item) const;
00495 
00496   /// Change item user-data pointer
00497   void setItemData(FXFoldingItem* item,void* ptr) const;
00498 
00499   /// Return item user-data pointer
00500   void* getItemData(const FXFoldingItem* item) const;
00501 
00502   /// Return TRUE if item is selected
00503   FXbool isItemSelected(const FXFoldingItem* item) const;
00504 
00505   /// Return TRUE if item is current
00506   FXbool isItemCurrent(const FXFoldingItem* item) const;
00507 
00508   /// Return TRUE if item is visible
00509   FXbool isItemVisible(const FXFoldingItem* item) const;
00510 
00511   /// Return TRUE if item opened
00512   FXbool isItemOpened(const FXFoldingItem* item) const;
00513 
00514   /// Return TRUE if item expanded
00515   FXbool isItemExpanded(const FXFoldingItem* item) const;
00516 
00517   /// Return TRUE if item is a leaf-item, i.e. has no children
00518   FXbool isItemLeaf(const FXFoldingItem* item) const;
00519 
00520   /// Return TRUE if item is enabled
00521   FXbool isItemEnabled(const FXFoldingItem* item) const;
00522 
00523   /// Return item hit code: 0 outside, 1 icon, 2 text, 3 box
00524   FXint hitItem(const FXFoldingItem* item,FXint x,FXint y) const;
00525 
00526   /// Repaint item
00527   void updateItem(FXFoldingItem* item);
00528 
00529   /// Enable item
00530   virtual FXbool enableItem(FXFoldingItem* item);
00531 
00532   /// Disable item
00533   virtual FXbool disableItem(FXFoldingItem* item);
00534 
00535   /// Select item
00536   virtual FXbool selectItem(FXFoldingItem* item,FXbool notify=FALSE);
00537 
00538   /// Deselect item
00539   virtual FXbool deselectItem(FXFoldingItem* item,FXbool notify=FALSE);
00540 
00541   /// Toggle item selection
00542   virtual FXbool toggleItem(FXFoldingItem* item,FXbool notify=FALSE);
00543 
00544   /// Extend selection from anchor item to item
00545   virtual FXbool extendSelection(FXFoldingItem* item,FXbool notify=FALSE);
00546 
00547   /// Deselect all items
00548   virtual FXbool killSelection(FXbool notify=FALSE);
00549 
00550   /// Open item
00551   virtual FXbool openItem(FXFoldingItem* item,FXbool notify=FALSE);
00552 
00553   /// Close item
00554   virtual FXbool closeItem(FXFoldingItem* item,FXbool notify=FALSE);
00555 
00556   /// Collapse tree
00557   virtual FXbool collapseTree(FXFoldingItem* tree,FXbool notify=FALSE);
00558 
00559   /// Expand tree
00560   virtual FXbool expandTree(FXFoldingItem* tree,FXbool notify=FALSE);
00561 
00562   /// Change current item
00563   virtual void setCurrentItem(FXFoldingItem* item,FXbool notify=FALSE);
00564 
00565   /// Return current item, if any
00566   FXFoldingItem* getCurrentItem() const { return currentitem; }
00567 
00568   /// Change anchor item
00569   void setAnchorItem(FXFoldingItem* item);
00570 
00571   /// Return anchor item, if any
00572   FXFoldingItem* getAnchorItem() const { return anchoritem; }
00573 
00574   /// Return item under cursor, if any
00575   FXFoldingItem* getCursorItem() const { return cursoritem; }
00576 
00577   /// Sort all items recursively
00578   void sortItems();
00579 
00580   /// Sort root items
00581   void sortRootItems();
00582 
00583   /// Sort children of item
00584   void sortChildItems(FXFoldingItem* item);
00585 
00586   /// Return sort function
00587   FXFoldingListSortFunc getSortFunc() const { return sortfunc; }
00588 
00589   /// Change sort function
00590   void setSortFunc(FXFoldingListSortFunc func){ sortfunc=func; }
00591 
00592   /// Change text font
00593   void setFont(FXFont* fnt);
00594 
00595   /// Return text font
00596   FXFont* getFont() const { return font; }
00597 
00598   /// Change parent-child indent amount
00599   void setIndent(FXint in);
00600 
00601   /// Return parent-child indent amount
00602   FXint getIndent() const { return indent; }
00603 
00604   /// Return normal text color
00605   FXColor getTextColor() const { return textColor; }
00606 
00607   /// Change normal text color
00608   void setTextColor(FXColor clr);
00609 
00610   /// Return selected text background
00611   FXColor getSelBackColor() const { return selbackColor; }
00612 
00613   /// Change selected text background
00614   void setSelBackColor(FXColor clr);
00615 
00616   /// Return selected text color
00617   FXColor getSelTextColor() const { return seltextColor; }
00618 
00619   /// Change selected text color
00620   void setSelTextColor(FXColor clr);
00621 
00622   /// Return line color
00623   FXColor getLineColor() const { return lineColor; }
00624 
00625   /// Change line color
00626   void setLineColor(FXColor clr);
00627 
00628   /// Return list style
00629   FXuint getListStyle() const;
00630 
00631   /// Change list style
00632   void setListStyle(FXuint style);
00633 
00634   /// Set the status line help text for this list
00635   void setHelpText(const FXString& text);
00636 
00637   /// Get the status line help text for this list
00638   const FXString& getHelpText() const { return help; }
00639 
00640   /// Save object to a stream
00641   virtual void save(FXStream& store) const;
00642 
00643   /// Load object from a stream
00644   virtual void load(FXStream& store);
00645 
00646   /// Destructor
00647   virtual ~FXFoldingList();
00648   };
00649 
00650 }
00651 
00652 
00653 #endif

Copyright © 1997-2005 Jeroen van der Zijp