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

FX::FXFoldingList Class Reference

A Folding List Widget resembles a Tree list except that it supports a header control to provide each item with multiple columns of text. More...

#include <FXFoldingList.h>

Inheritance diagram for FX::FXFoldingList:
FX::FXScrollArea FX::FXComposite FX::FXWindow FX::FXDrawable FX::FXId FX::FXObject

List of all members.

Public Types

enum  { ID_LOOKUPTIMER = FXScrollArea::ID_LAST, ID_HEADER, ID_LAST }

Public Member Functions

long onPaint (FXObject *, FXSelector, void *)
long onEnter (FXObject *, FXSelector, void *)
long onLeave (FXObject *, FXSelector, void *)
long onUngrabbed (FXObject *, FXSelector, void *)
long onMotion (FXObject *, FXSelector, void *)
long onKeyPress (FXObject *, FXSelector, void *)
long onKeyRelease (FXObject *, FXSelector, void *)
long onLeftBtnPress (FXObject *, FXSelector, void *)
long onLeftBtnRelease (FXObject *, FXSelector, void *)
long onRightBtnPress (FXObject *, FXSelector, void *)
long onRightBtnRelease (FXObject *, FXSelector, void *)
long onChgHeader (FXObject *, FXSelector, void *)
long onQueryTip (FXObject *, FXSelector, void *)
long onQueryHelp (FXObject *, FXSelector, void *)
long onTipTimer (FXObject *, FXSelector, void *)
long onFocusIn (FXObject *, FXSelector, void *)
long onFocusOut (FXObject *, FXSelector, void *)
long onAutoScroll (FXObject *, FXSelector, void *)
long onClicked (FXObject *, FXSelector, void *)
long onDoubleClicked (FXObject *, FXSelector, void *)
long onTripleClicked (FXObject *, FXSelector, void *)
long onCommand (FXObject *, FXSelector, void *)
long onLookupTimer (FXObject *, FXSelector, void *)
 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)
 Construct a folding list; the folding list is initially empty.
virtual void create ()
 Create server-side resources.
virtual void detach ()
 Detach server-side resources.
virtual void layout ()
 Perform layout.
virtual FXint getDefaultWidth ()
 Return default width.
virtual FXint getDefaultHeight ()
 Return default height.
virtual FXint getVisibleY () const
 Return visible scroll-area y position.
virtual FXint getVisibleHeight () const
 Return visible scroll-area height.
virtual FXint getContentWidth ()
 Compute and return content width.
virtual FXint getContentHeight ()
 Return content height.
virtual void recalc ()
 Recalculate layout.
virtual FXbool canFocus () const
 Tree list can receive focus.
virtual void setFocus ()
 Move the focus to this window.
virtual void killFocus ()
 Remove the focus from this window.
FXHeadergetHeader () const
 Return header control.
void setHeaders (const FXchar **strings, FXint size=1)
 Set headers from array of strings.
void setHeaders (const FXString &strings, FXint size=1)
 Set headers from newline separated strings.
void appendHeader (const FXString &text, FXIcon *icon=NULL, FXint size=1)
 Append header with given text and optional icon.
void removeHeader (FXint index)
 Remove header at index.
void setHeaderText (FXint index, const FXString &text)
 Change text of header at index.
FXString getHeaderText (FXint index) const
 Return text of header at index.
void setHeaderIcon (FXint index, FXIcon *icon)
 Change icon of header at index.
FXIcongetHeaderIcon (FXint index) const
 Return icon of header at index.
void setHeaderSize (FXint index, FXint size)
 Change size of header at index.
FXint getHeaderSize (FXint index) const
 Return width of header at index.
FXint getNumHeaders () const
 Return number of headers.
FXint getNumItems () const
 Return number of items.
FXint getNumVisible () const
 Return number of visible items.
void setNumVisible (FXint nvis)
 Change number of visible items.
FXFoldingItemgetFirstItem () const
 Return first root item.
FXFoldingItemgetLastItem () const
 Return last root item.
FXint fillItems (FXFoldingItem *father, const FXchar **strings, FXIcon *oi=NULL, FXIcon *ci=NULL, void *ptr=NULL, FXbool notify=false)
 Fill list by appending items from array of strings.
FXint fillItems (FXFoldingItem *father, const FXString &strings, FXIcon *oi=NULL, FXIcon *ci=NULL, void *ptr=NULL, FXbool notify=false)
 Fill list by appending items from newline separated strings.
FXFoldingIteminsertItem (FXFoldingItem *other, FXFoldingItem *father, FXFoldingItem *item, FXbool notify=false)
 Insert [possibly subclassed] item under father before other item.
FXFoldingIteminsertItem (FXFoldingItem *other, FXFoldingItem *father, const FXString &text, FXIcon *oi=NULL, FXIcon *ci=NULL, void *ptr=NULL, FXbool notify=false)
 Insert item with given text and optional icons, and user-data pointer under father before other item.
FXFoldingItemappendItem (FXFoldingItem *father, FXFoldingItem *item, FXbool notify=false)
 Append [possibly subclassed] item as last child of father.
FXFoldingItemappendItem (FXFoldingItem *father, const FXString &text, FXIcon *oi=NULL, FXIcon *ci=NULL, void *ptr=NULL, FXbool notify=false)
 Append item with given text and optional icons, and user-data pointer as last child of father.
FXFoldingItemprependItem (FXFoldingItem *father, FXFoldingItem *item, FXbool notify=false)
 Prepend [possibly subclassed] item as first child of father.
FXFoldingItemprependItem (FXFoldingItem *father, const FXString &text, FXIcon *oi=NULL, FXIcon *ci=NULL, void *ptr=NULL, FXbool notify=false)
 Prepend item with given text and optional icons, and user-data pointer as first child of father.
FXFoldingItemmoveItem (FXFoldingItem *other, FXFoldingItem *father, FXFoldingItem *item)
 Move item under father before other item.
FXFoldingItemextractItem (FXFoldingItem *item, FXbool notify=false)
 Extract item.
void removeItem (FXFoldingItem *item, FXbool notify=false)
 Remove item.
void removeItems (FXFoldingItem *fm, FXFoldingItem *to, FXbool notify=false)
 Remove items in range [fm, to] inclusively.
void clearItems (FXbool notify=false)
 Remove all items from list.
FXint getItemWidth (const FXFoldingItem *item) const
 Return item width.
FXint getItemHeight (const FXFoldingItem *item) const
 Return item height.
virtual FXFoldingItemgetItemAt (FXint x, FXint y) const
 Get item at x,y, if any.
FXFoldingItemfindItem (const FXString &text, FXFoldingItem *start=NULL, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
 Search items by name, beginning from item start.
FXFoldingItemfindItemByData (const void *ptr, FXFoldingItem *start=NULL, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
 Search items by associated user data, beginning from item start.
virtual void makeItemVisible (FXFoldingItem *item)
 Scroll to make item visible.
void setItemText (FXFoldingItem *item, const FXString &text)
 Change item's text.
FXString getItemText (const FXFoldingItem *item) const
 Return item's text.
void setItemOpenIcon (FXFoldingItem *item, FXIcon *icon, FXbool owned=false)
 Change item's open icon, deleting old icon if it was owned.
FXIcongetItemOpenIcon (const FXFoldingItem *item) const
 Return item's open icon.
void setItemClosedIcon (FXFoldingItem *item, FXIcon *icon, FXbool owned=false)
 Chance item's closed icon, deleting old icon if it was owned.
FXIcongetItemClosedIcon (const FXFoldingItem *item) const
 Return item's closed icon.
void setItemData (FXFoldingItem *item, void *ptr) const
 Change item user-data pointer.
void * getItemData (const FXFoldingItem *item) const
 Return item user-data pointer.
FXbool isItemSelected (const FXFoldingItem *item) const
 Return true if item is selected.
FXbool isItemCurrent (const FXFoldingItem *item) const
 Return true if item is current.
FXbool isItemVisible (const FXFoldingItem *item) const
 Return true if item is visible.
FXbool isItemOpened (const FXFoldingItem *item) const
 Return true if item opened.
FXbool isItemExpanded (const FXFoldingItem *item) const
 Return true if item expanded.
FXbool isItemLeaf (const FXFoldingItem *item) const
 Return true if item is a leaf-item, i.e. has no children.
FXbool isItemEnabled (const FXFoldingItem *item) const
 Return true if item is enabled.
FXint hitItem (const FXFoldingItem *item, FXint x, FXint y) const
 Return item hit code: 0 outside, 1 icon, 2 text, 3 box.
void updateItem (FXFoldingItem *item)
 Repaint item.
virtual FXbool enableItem (FXFoldingItem *item)
 Enable item.
virtual FXbool disableItem (FXFoldingItem *item)
 Disable item.
virtual FXbool selectItem (FXFoldingItem *item, FXbool notify=false)
 Select item.
virtual FXbool deselectItem (FXFoldingItem *item, FXbool notify=false)
 Deselect item.
virtual FXbool toggleItem (FXFoldingItem *item, FXbool notify=false)
 Toggle item selection.
virtual FXbool extendSelection (FXFoldingItem *item, FXbool notify=false)
 Extend selection from anchor item to item.
virtual FXbool killSelection (FXbool notify=false)
 Deselect all items.
virtual FXbool openItem (FXFoldingItem *item, FXbool notify=false)
 Open item.
virtual FXbool closeItem (FXFoldingItem *item, FXbool notify=false)
 Close item.
virtual FXbool collapseTree (FXFoldingItem *tree, FXbool notify=false)
 Collapse tree.
virtual FXbool expandTree (FXFoldingItem *tree, FXbool notify=false)
 Expand tree.
virtual void setCurrentItem (FXFoldingItem *item, FXbool notify=false)
 Change current item.
FXFoldingItemgetCurrentItem () const
 Return current item, if any.
void setAnchorItem (FXFoldingItem *item)
 Change anchor item.
FXFoldingItemgetAnchorItem () const
 Return anchor item, if any.
void sortItems ()
 Sort all items recursively.
void sortRootItems ()
 Sort root items.
void sortChildItems (FXFoldingItem *item)
 Sort children of item.
FXFoldingListSortFunc getSortFunc () const
 Return sort function.
void setSortFunc (FXFoldingListSortFunc func)
 Change sort function.
void setFont (FXFont *fnt)
 Change text font.
FXFontgetFont () const
 Return text font.
void setIndent (FXint in)
 Change parent-child indent amount.
FXint getIndent () const
 Return parent-child indent amount.
FXColor getTextColor () const
 Return normal text color.
void setTextColor (FXColor clr)
 Change normal text color.
FXColor getSelBackColor () const
 Return selected text background.
void setSelBackColor (FXColor clr)
 Change selected text background.
FXColor getSelTextColor () const
 Return selected text color.
void setSelTextColor (FXColor clr)
 Change selected text color.
FXColor getLineColor () const
 Return line color.
void setLineColor (FXColor clr)
 Change line color.
FXuint getListStyle () const
 Return list style.
void setListStyle (FXuint style)
 Change list style.
void setHelpText (const FXString &text)
 Set the status line help text for this list.
const FXStringgetHelpText () const
 Get the status line help text for this list.
virtual void save (FXStream &store) const
 Save object to a stream.
virtual void load (FXStream &store)
 Load object from a stream.
virtual ~FXFoldingList ()
 Destructor.

Static Public Member Functions

static FXint ascending (const FXFoldingItem *, const FXFoldingItem *)
static FXint descending (const FXFoldingItem *, const FXFoldingItem *)
static FXint ascendingCase (const FXFoldingItem *, const FXFoldingItem *)
static FXint descendingCase (const FXFoldingItem *, const FXFoldingItem *)

Protected Member Functions

void recompute ()
void mergesort (FXFoldingItem *&list)
void sort (FXFoldingItem *&f1, FXFoldingItem *&t1, FXFoldingItem *&f2, FXFoldingItem *&t2, int n)
virtual void moveContents (FXint x, FXint y)
virtual FXFoldingItemcreateItem (const FXString &text, FXIcon *oi, FXIcon *ci, void *ptr)

Static Protected Member Functions

static FXint compareSection (const FXchar *p, const FXchar *q, FXint s)
static FXint compareSectionCase (const FXchar *p, const FXchar *q, FXint s)

Protected Attributes

FXHeaderheader
FXFoldingItemfirstitem
FXFoldingItemlastitem
FXFoldingItemanchoritem
FXFoldingItemcurrentitem
FXFoldingItemextentitem
FXFoldingItemviewableitem
FXFontfont
FXFoldingListSortFunc sortfunc
FXColor textColor
FXColor selbackColor
FXColor seltextColor
FXColor lineColor
FXint treeWidth
FXint treeHeight
FXint visible
FXint indent
FXint grabx
FXint graby
FXString lookup
FXString help
FXbool state

Detailed Description

A Folding List Widget resembles a Tree list except that it supports a header control to provide each item with multiple columns of text.

Subtrees can be collapsed or expanded by double-clicking on an item or by clicking on the optional plus button in front of the item. Each item may have a text and optional open-icon as well as a closed-icon. The items may be connected by optional lines to show the hierarchical relationship. When an item's selected state changes, the folding list emits a SEL_SELECTED or SEL_DESELECTED message. If an item is opened or closed, a message of type SEL_OPENED or SEL_CLOSED is sent. When the subtree under an item is expanded, a SEL_EXPANDED or SEL_COLLAPSED message is issued. A change of the current item is signified by the SEL_CHANGED message. In addition, the folding list sends SEL_COMMAND messages when the user clicks on an item, and SEL_CLICKED, SEL_DOUBLECLICKED, and SEL_TRIPLECLICKED when the user clicks once, twice, or thrice, respectively. When items are added or removed, the folding list sends messages of the type SEL_INSERTED or SEL_DELETED. In each of these cases, a pointer to the item, if any, is passed in the 3rd argument of the message. The text in each item is a string separated by tabs for each column; in mini- or big-icon mode, only the text before the first tab is shown. In detail-mode, the text before the first tab is shown in the first column, the text between the first and second tab is shown in the second column, and so on.


Member Function Documentation

FXFoldingItem* FX::FXFoldingList::findItem ( const FXString text,
FXFoldingItem start = NULL,
FXuint  flags = SEARCH_FORWARD|SEARCH_WRAP 
) const

Search items by name, beginning from item start.

If the start item is NULL the search will start at the first, top-most item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list. The option SEARCH_IGNORECASE causes a case-insensitive match. Finally, passing SEARCH_PREFIX causes searching for a prefix of the item name. Return NULL if no matching item is found.

FXFoldingItem* FX::FXFoldingList::findItemByData ( const void *  ptr,
FXFoldingItem start = NULL,
FXuint  flags = SEARCH_FORWARD|SEARCH_WRAP 
) const

Search items by associated user data, beginning from item start.

If the start item is NULL the search will start at the first, top-most item in the list. Flags may be SEARCH_FORWARD or SEARCH_BACKWARD to control the search direction; this can be combined with SEARCH_NOWRAP or SEARCH_WRAP to control whether the search wraps at the start or end of the list.


The documentation for this class was generated from the following file:

Copyright © 1997-2011 Jeroen van der Zijp