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

Copyright © 1997-2009 Jeroen van der Zijp