Class Fox::FXHeader
In: FXHeader.rb
../lib/fox/core.rb
../lib/fox/iterators.rb
Parent: FXFrame

An FXHeader control may be placed over a table of other widgets to provide a caption and icon. Each caption comprises a label and an optional icon; in addition, an arrow may be shown to indicate whether the items in that column are sorted, and if so, whether they are sorted in increasing or decreasing order.

Events

The following messages are sent by FXHeader to its target:

SEL_CHANGED:sent continuously while a header item is being resized, if the HEADER_TRACKING option was specified, or at the end of the resize if HEADER_TRACKING was not specfied. The message data is an integer indicating the index of the item being resized.
SEL_COMMAND:sent when a header item is clicked; the message data is an integer indicating the index of the current item.
SEL_LEFTBUTTONPRESS:sent when the left mouse button goes down; the message data is an FXEvent instance.
SEL_LEFTBUTTONRELEASE:sent when the left mouse button goes up; the message data is an FXEvent instance.
SEL_REPLACED:sent when a header item is about to be replaced; the message data is an Integer indicating the index of the item to be replaced.
SEL_INSERTED:sent after a header item is inserted; the message data is an Integer indicating the index of the item that was inserted.
SEL_DELETED:sent when a header item is about to be removed; the message data is an Integer indicating the index of the item to be removed.

Header style options

HEADER_BUTTON:Button style can be clicked
HEADER_HORIZONTAL:Horizontal header control (default)
HEADER_VERTICAL:Vertical header control
HEADER_TRACKING:Tracks continuously while moving
HEADER_NORMAL:Normal options, same as HEADER_HORIZONTAL|FRAME_NORMAL

Message identifiers

ID_TIPTIMER:x
Methods
appendItem    appendItem    arrowDown?    arrowMaybe?    arrowUp?    clearItems    each    getArrowDir    getItemAt    getItemData    getItemIcon    getItemOffset    getItemSize    getItemText    insertItem    insertItem    new    prependItem    prependItem    removeItem    replaceItem    replaceItem    retrieveItem    setArrowDir    setItemData    setItemIcon    setItemSize    setItemText   
Attributes
font  [RW] 

Text font [FXFont]

headerStyle  [RW] 

Header style options [Integer]

helpText  [RW] 

Status line help text for this header

numItems  [R] 

Number of items [Integer]

textColor  [RW] 

Text color [FXColor]

Included modules
Enumerable
Public Class methods
new(p, tgt=nil, sel=0, opts=HEADER_NORMAL, x=0, y=0, w=0, h=0, pl=DEFAULT_PAD, pr=DEFAULT_PAD, pt=DEFAULT_PAD, pb=DEFAULT_PAD) {|theHeader| ...}

Construct new header control

Public Instance methods
retrieveItem(index)

Return the item (a FXHeaderItem instance) at the given index. Raises IndexError if index is out of bounds.

replaceItem(index, item, notify=false)

Replace the item at index with a (possibly subclassed) item and return the index of the replaced item. If notify is true, a SEL_REPLACED message is sent to the header’s message target before the item is replaced. Raises IndexError if index is out of bounds.

replaceItem(index, text, icon=nil, size=0, data=nil, notify=false)

Replace the item at index with a new item with the specified text, icon, size and user data object, and return the index of the replaced item. The new item is created by calling the FXHeader#createItem method. If notify is true, a SEL_REPLACED message is sent to the header’s message target before the item is replaced. Raises IndexError if index is out of bounds.

insertItem(index, item, notify=false)

Insert a new (possibly subclassed) item at the specified index and return the index of the inserted item. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is inserted. Raises IndexError if index is out of bounds.

insertItem(index, text, icon=nil, size=0, data=nil, notify=false)

Insert a new item at the specified index with the specified text, icon, size and user data object, and return the index of the inserted item. The new item is created by calling the FXHeader#createItem method. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is inserted. Raises IndexError if index is out of bounds.

appendItem(item, notify=false)

Append a (possibly subclassed) item to the list and return the index of the appended item. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is appended.

appendItem(text, icon=nil, size=0, data=nil, notify=false)

Append a new item with the specified text, icon, size and user data object, and return the index of the appended item. The new item is created by calling the FXHeader#createItem method. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is appended.

prependItem(item, notify=false)

Prepend a (possibly subclassed) item to the list and return the index of the prepended item. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is appended.

prependItem(text, icon=nil, size=0, data=nil, notify=false)

Prepend a new item with the specified text, icon, size and user data object, and return the index of the appended item. The new item is created by calling the FXHeader#createItem method. If notify is true, a SEL_INSERTED message is sent to the header’s message target after the item is appended.

removeItem(index, notify=false)

Remove the item at the specified index from this header. If notify is true, a SEL_DELETED message is sent to the header’s message target before the item is removed. Raises IndexError if index is out of bounds.

clearItems(notify=false)

Remove all items from this header. If notify is true, a SEL_DELETED message is sent to the header’s message target before each item is removed.

getItemAt(offset)

Return the index of the item at the given pixel-offset from the left (or top, if it’s a vertical header). Returns -1 if the specified offset is out of bounds.

setItemText(index, text)

Change text label for item at index. Raises IndexError if index is out of bounds.

getItemText(index)

Get text of item at index. Raises IndexError if index is out of bounds.

setItemIcon(index, icon)

Change icon of item at index. Raises IndexError if index is out of bounds.

getItemIcon(index)

Return icon of item at index. Raises IndexError if index is out of bounds.

setItemSize(index, size)

Change size of item at index. Raises IndexError if index is out of bounds.

getItemSize(index)

Return size of item at index. Raises IndexError if index is out of bounds.

getItemOffset(index)

Return the offset (in pixels) of the left side of the item at index. (If it’s a vertical header, return the offset of the top side of the item). Raises IndexError if index is out of bounds.

setItemData(index, ptr)

Change user data object of item at index. Raises IndexError if index is out of bounds.

getItemData(index)

Return user data for item at index. Raises IndexError if index is out of bounds.

setArrowDir(index, dir=MAYBE)

Change arrow (sort) direction for item at index, where dir is either FALSE, TRUE or MAYBE. If dir is TRUE, the arrow will point up; if dir is FALSE, the arrow points down; and if dir is MAYBE, no arrow is drawn. Raises IndexError if index is out of bounds.

getArrowDir(index)

Return sort direction for the item at index, one of FALSE, TRUE or MAYBE. If dir is TRUE, the arrow will point up; if dir is FALSE, the arrow points down; and if dir is MAYBE, no arrow is drawn. Raises IndexError if index is out of bounds.

arrowUp?(index)

Returns true if the specified header item’s arrow points up. Raises IndexError if index is out of bounds.

arrowDown?(index)

Returns true if the specified header item’s arrow points down. Raises IndexError if index is out of bounds.

arrowMaybe?(index)

Returns true if the specified header item does not display any arrow. Raises IndexError if index is out of bounds.

each() {|aHeaderItem| ...}

Calls block once for each item in the list, passing a reference to that item as a parameter.