Class: Fox::FXHeader
- Includes:
- Enumerable
- Defined in:
- rdoc-sources/FXHeader.rb,
lib/fox16/core.rb,
lib/fox16/iterators.rb
Overview
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 ifHEADER_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
Instance Attribute Summary collapse
-
#font ⇒ Object
Text font FXFont.
-
#headerStyle ⇒ Object
Header style options [Integer].
-
#helpText ⇒ Object
Status line help text for this header.
-
#numItems ⇒ Object
readonly
Number of items [Integer].
-
#position ⇒ Object
Current position [Integer].
-
#textColor ⇒ Object
Text color FXColor.
-
#totalSize ⇒ Object
readonly
Total size of all items [Integer].
Attributes inherited from FXFrame
#baseColor, #borderColor, #borderWidth, #frameStyle, #hiliteColor, #padBottom, #padLeft, #padRight, #padTop, #shadowColor
Attributes inherited from FXWindow
#accelTable, #backColor, #defaultCursor, #dragCursor, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y
Attributes inherited from FXDrawable
Attributes inherited from FXId
Instance Method Summary collapse
-
#appendItem(text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Append a new item with the specified text, icon, size and user data object, and return the index of the appended item.
-
#arrowDown?(index) ⇒ Boolean
Returns true if the specified header item’s arrow points down.
-
#arrowMaybe?(index) ⇒ Boolean
Returns true if the specified header item does not display any arrow.
-
#arrowUp?(index) ⇒ Boolean
Returns true if the specified header item’s arrow points up.
-
#clearItems(notify = false) ⇒ Object
Remove all items from this header.
-
#each ⇒ Object
Calls block once for each item in the list, passing a reference to that item as a parameter.
-
#extractItem(index, notify = false) ⇒ Object
Extract item from list and return a reference to the item.
-
#fillItems(strings, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Fill the header by appending items from an array of strings.
-
#first ⇒ Object
Override Enumerable#first with FXWindow#first for backwards compatibility.
-
#getArrowDir(index) ⇒ Object
Return sort direction for the item at index, one of
FALSE
,TRUE
orMAYBE
. -
#getItem(index) ⇒ Object
Return the item (a FXHeaderItem instance) at the given index.
-
#getItemAt(coord) ⇒ Object
Return the item-index given its coordinate offset.
-
#getItemData(index) ⇒ Object
Return user data for item at index.
-
#getItemIcon(index) ⇒ Object
Return icon of item at index.
-
#getItemIconPosition(index) ⇒ Object
Return relative icon and text position of the item at index, one of
ABOVE
,BELOW
,BEFORE
orAFTER
. -
#getItemJustify(index) ⇒ Object
Return item justification for the item at index, one of
LEFT
,RIGHT
,CENTER_X
,TOP
,BOTTOM
orCENTER_Y
. -
#getItemOffset(index) ⇒ Object
Return the offset (in pixels) of the left side of the item at index.
-
#getItemSize(index) ⇒ Object
Return size of item at index.
-
#getItemText(index) ⇒ Object
Get text of item at index.
-
#initialize(p, target = nil, selector = 0, opts = HEADER_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXHeader
constructor
Return an initialized FXHeader instance.
-
#insertItem(index, text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
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.
-
#isItemPressed(index) ⇒ Object
Return
true
if button item at specified index is pressed in. -
#makeItemVisible(index) ⇒ Object
Scroll to make the specified item visible.
-
#prependItem(text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Prepend a new item with the specified text, icon, size and user data object, and return the index of the appended item.
-
#removeItem(index, notify = false) ⇒ Object
Remove the item at the specified index from this header.
-
#setArrowDir(index, dir = MAYBE) ⇒ Object
Change arrow (sort) direction for item at index, where dir is either
FALSE
,TRUE
orMAYBE
. -
#setItem(index, text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
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.
-
#setItemData(index, ptr) ⇒ Object
Change user data object of item at index.
-
#setItemIcon(index, icon) ⇒ Object
Change icon of item at index.
-
#setItemIconPosition(index, mode) ⇒ Object
Change relative position of icon and text of item.
-
#setItemJustify(index, justify) ⇒ Object
Change item justification.
-
#setItemPressed(index, pressed = true) ⇒ Object
Changed button item’s pressed state.
-
#setItemSize(index, size) ⇒ Object
Change size of item at index.
-
#setItemText(index, text) ⇒ Object
Change text label for item at index.
-
#updateItem(index) ⇒ Object
Repaint header at index.
Methods inherited from FXWindow
#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, #after?, after?, #before?, before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=
Methods included from Responder2
Methods inherited from FXDrawable
Methods inherited from FXId
#create, #created?, #destroy, #detach, #runOnUiThread
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(p, target = nil, selector = 0, opts = HEADER_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXHeader
Return an initialized FXHeader instance.
164 165 |
# File 'rdoc-sources/FXHeader.rb', line 164 def initialize(p, target=nil, selector=0, opts=HEADER_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theHeader end |
Instance Attribute Details
#font ⇒ Object
Text font Fox::FXFont
150 151 152 |
# File 'rdoc-sources/FXHeader.rb', line 150 def font @font end |
#headerStyle ⇒ Object
Header style options [Integer]
156 157 158 |
# File 'rdoc-sources/FXHeader.rb', line 156 def headerStyle @headerStyle end |
#helpText ⇒ Object
Status line help text for this header
159 160 161 |
# File 'rdoc-sources/FXHeader.rb', line 159 def helpText @helpText end |
#numItems ⇒ Object (readonly)
Number of items [Integer]
141 142 143 |
# File 'rdoc-sources/FXHeader.rb', line 141 def numItems @numItems end |
#position ⇒ Object
Current position [Integer]
147 148 149 |
# File 'rdoc-sources/FXHeader.rb', line 147 def position @position end |
#textColor ⇒ Object
Text color Fox::FXColor
153 154 155 |
# File 'rdoc-sources/FXHeader.rb', line 153 def textColor @textColor end |
#totalSize ⇒ Object (readonly)
Total size of all items [Integer]
144 145 146 |
# File 'rdoc-sources/FXHeader.rb', line 144 def totalSize @totalSize end |
Instance Method Details
#appendItem(text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Append a new item with the specified text, icon, size and user data object, 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.
230 |
# File 'rdoc-sources/FXHeader.rb', line 230 def appendItem(item, notify=false); end |
#arrowDown?(index) ⇒ Boolean
Returns true if the specified header item’s arrow points down. Raises IndexError if index is out of bounds.
165 166 167 168 169 170 171 |
# File 'lib/fox16/core.rb', line 165 def arrowDown?(index) if index < 0 || index >= numItems raise IndexError, "header item index out of bounds" else getArrowDir(index) == Fox::FALSE end end |
#arrowMaybe?(index) ⇒ Boolean
Returns true if the specified header item does not display any arrow. Raises IndexError if index is out of bounds.
177 178 179 180 181 182 183 |
# File 'lib/fox16/core.rb', line 177 def arrowMaybe?(index) if index < 0 || index >= numItems raise IndexError, "header item index out of bounds" else getArrowDir(index) == Fox::MAYBE end end |
#arrowUp?(index) ⇒ Boolean
Returns true if the specified header item’s arrow points up. Raises IndexError if index is out of bounds.
153 154 155 156 157 158 159 |
# File 'lib/fox16/core.rb', line 153 def arrowUp?(index) if index < 0 || index >= numItems raise IndexError, "header item index out of bounds" else getArrowDir(index) == Fox::TRUE end end |
#clearItems(notify = false) ⇒ Object
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.
277 |
# File 'rdoc-sources/FXHeader.rb', line 277 def clearItems(notify=false); end |
#each ⇒ Object
Calls block once for each item in the list, passing a reference to that item as a parameter.
79 80 81 82 83 84 |
# File 'lib/fox16/iterators.rb', line 79 def each # :yields: aHeaderItem 0.upto(numItems - 1) do |i| yield getItem(i) end self end |
#extractItem(index, notify = false) ⇒ Object
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.
262 |
# File 'rdoc-sources/FXHeader.rb', line 262 def extractItem(index, notify=false); end |
#fillItems(strings, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Fill the header by appending items from an array of strings. Returns the number of items appended.
204 |
# File 'rdoc-sources/FXHeader.rb', line 204 def fillItems(strings, icon=nil, size=0, data=nil, notify=false); end |
#first ⇒ Object
Override Enumerable#first with FXWindow#first for backwards compatibility.
71 72 73 |
# File 'lib/fox16/iterators.rb', line 71 def first getFirst end |
#getArrowDir(index) ⇒ Object
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.
350 |
# File 'rdoc-sources/FXHeader.rb', line 350 def getArrowDir(index); end |
#getItem(index) ⇒ Object
Return the item (a FXHeaderItem instance) at the given index. Raises IndexError if index is out of bounds.
171 |
# File 'rdoc-sources/FXHeader.rb', line 171 def getItem(index); end |
#getItemAt(coord) ⇒ Object
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.
179 |
# File 'rdoc-sources/FXHeader.rb', line 179 def getItemAt(coord); end |
#getItemData(index) ⇒ Object
Return user data for item at index. Raises IndexError if index is out of bounds.
332 |
# File 'rdoc-sources/FXHeader.rb', line 332 def getItemData(index); end |
#getItemIcon(index) ⇒ Object
Return icon of item at index. Raises IndexError if index is out of bounds.
301 |
# File 'rdoc-sources/FXHeader.rb', line 301 def getItemIcon(index); end |
#getItemIconPosition(index) ⇒ Object
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.
384 |
# File 'rdoc-sources/FXHeader.rb', line 384 def getItemIconPosition(index); end |
#getItemJustify(index) ⇒ Object
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.
367 |
# File 'rdoc-sources/FXHeader.rb', line 367 def getItemJustify(index); end |
#getItemOffset(index) ⇒ Object
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.
320 |
# File 'rdoc-sources/FXHeader.rb', line 320 def getItemOffset(index); end |
#getItemSize(index) ⇒ Object
Return size of item at index. Raises IndexError if index is out of bounds.
313 |
# File 'rdoc-sources/FXHeader.rb', line 313 def getItemSize(index); end |
#getItemText(index) ⇒ Object
Get text of item at index. Raises IndexError if index is out of bounds.
289 |
# File 'rdoc-sources/FXHeader.rb', line 289 def getItemText(index); end |
#insertItem(index, text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
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. 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.
213 |
# File 'rdoc-sources/FXHeader.rb', line 213 def insertItem(index, item, notify=false); end |
#isItemPressed(index) ⇒ Object
Return true
if button item at specified index is pressed in. Raises IndexError if index is out of bounds.
396 |
# File 'rdoc-sources/FXHeader.rb', line 396 def isItemPressed(index); end |
#makeItemVisible(index) ⇒ Object
Scroll to make the specified item visible.
399 |
# File 'rdoc-sources/FXHeader.rb', line 399 def makeItemVisible(index); end |
#prependItem(text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
Prepend a new item with the specified text, icon, size and user data object, 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.
246 |
# File 'rdoc-sources/FXHeader.rb', line 246 def prependItem(item, notify=false); end |
#removeItem(index, notify = false) ⇒ Object
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.
270 |
# File 'rdoc-sources/FXHeader.rb', line 270 def removeItem(index, notify=false); end |
#setArrowDir(index, dir = MAYBE) ⇒ Object
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.
341 |
# File 'rdoc-sources/FXHeader.rb', line 341 def setArrowDir(index, dir=MAYBE); end |
#setItem(index, text, icon = nil, size = 0, data = nil, notify = false) ⇒ Object
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. 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.
188 |
# File 'rdoc-sources/FXHeader.rb', line 188 def setItem(index, item, notify=false); end |
#setItemData(index, ptr) ⇒ Object
Change user data object of item at index. Raises IndexError if index is out of bounds.
326 |
# File 'rdoc-sources/FXHeader.rb', line 326 def setItemData(index, ptr); end |
#setItemIcon(index, icon) ⇒ Object
Change icon of item at index. Raises IndexError if index is out of bounds.
295 |
# File 'rdoc-sources/FXHeader.rb', line 295 def setItemIcon(index, icon); end |
#setItemIconPosition(index, mode) ⇒ Object
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.
377 |
# File 'rdoc-sources/FXHeader.rb', line 377 def setItemIconPosition(index, mode); end |
#setItemJustify(index, justify) ⇒ Object
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.
360 |
# File 'rdoc-sources/FXHeader.rb', line 360 def setItemJustify(index, justify); end |
#setItemPressed(index, pressed = true) ⇒ Object
Changed button item’s pressed state. Raises IndexError if index is out of bounds.
390 |
# File 'rdoc-sources/FXHeader.rb', line 390 def setItemPressed(index, pressed=true); end |
#setItemSize(index, size) ⇒ Object
Change size of item at index. Raises IndexError if index is out of bounds.
307 |
# File 'rdoc-sources/FXHeader.rb', line 307 def setItemSize(index, size); end |
#setItemText(index, text) ⇒ Object
Change text label for item at index. Raises IndexError if index is out of bounds.
283 |
# File 'rdoc-sources/FXHeader.rb', line 283 def setItemText(index, text); end |
#updateItem(index) ⇒ Object
Repaint header at index. Raises IndexError if index is out of bounds.
405 |
# File 'rdoc-sources/FXHeader.rb', line 405 def updateItem(index); end |