Class Fox::FXHeader
In: rdoc-sources/FXHeader.rb
Parent: FXFrame

Header control may be placed over a table or list to provide a resizable captions above a number of columns. 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. Each caption can be interactively resized. During the resizing, if the HEADER_TRACKING was specified, the header control sends a SEL_CHANGED message to its target, with the message data set to the caption number being resized, of the type FXint. If the HEADER_TRACKING was not specified the SEL_CHANGED message is sent at the end of the resizing operation. Clicking on a caption causes a message of type SEL_COMMAND to be sent to the target, with the message data set to the caption number being clicked. A single click on a split causes a message of type SEL_CLICKED to be sent to the target; a typical response to this message would be to adjust the size of the split to fit the contents displayed underneath it. The contents may be scrolled by calling setPosition().

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_CLICKED: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_RESIZE:Allow resizing sections
HEADER_NORMAL:Normal options, same as HEADER_HORIZONTAL|FRAME_NORMAL

Message identifiers

ID_TIPTIMER:x

Methods

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]
position  [RW]  Current position [Integer]
textColor  [RW]  Text color [FXColor]
totalSize  [R]  Total size of all items [Integer]

Public Class methods

Public Instance methods

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.

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.

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.

Extract item from list and return a reference to the item. If notify is true, a SEL_DELETED message is sent to the header‘s message target before the item is extracted from the list. Raises IndexError if index is out of bounds.

Fill the header by appending items from an array of strings. Returns the number of items appended.

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.

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

Return the item-index given its coordinate offset. Returns -1 if the specified coordinate is before the first item in the header, or numItems if the coordinate is after the last item in the header.

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

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

Return relative icon and text position of the item at index, one of ABOVE, BELOW, BEFORE or AFTER. Raises IndexError if index is out of bounds.

Return item justification for the item at index, one of LEFT, RIGHT, CENTER_X, TOP, BOTTOM or CENTER_Y. Raises IndexError if index is out of bounds.

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.

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

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

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.

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.

Return true if button item at specified index is pressed in. Raises IndexError if index is out of bounds.

Scroll to make the specified item visible.

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.

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.

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.

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.

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.

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.

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

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

Change relative position of icon and text of item. Passing FXHeaderItem::BEFORE or FXHeaderItem::AFTER places the icon before or after the text, and passing FXHeaderItem::ABOVE or FXHeaderItem::BELOW places it above or below the text, respectively. The default of FXHeaderItem::BEFORE places the icon in front of the text. Raises IndexError if index is out of bounds.

Change item justification. Horizontal justification is controlled by passing FXHeaderItem::RIGHT, FXHeaderItem::LEFT, or FXHeaderItem::CENTER_X. Vertical justification is controlled by FXHeaderItem::TOP, FXHeaderItem::BOTTOM, or FXHeaderItem::CENTER_Y. The default is a combination of FXHeaderItem::LEFT and FXHeaderItem::CENTER_Y. Raises IndexError if index is out of bounds.

Changed button item‘s pressed state. Raises IndexError if index is out of bounds.

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

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

Repaint header at index. Raises IndexError if index is out of bounds.

[Validate]