Class: Fox::FXIconList

Inherits:
FXScrollArea show all
Includes:
Enumerable
Defined in:
rdoc-sources/FXIconList.rb,
lib/fox16/iterators.rb

Overview

A Icon List Widget displays a list of items, each with a text and optional icon. Icon List can display its items in essentially three different ways; in big-icon mode, the bigger of the two icons is used for each item, and the text is placed underneath the icon. In mini- icon mode, the icons are listed in rows and columns, with the smaller icon preceding the text. Finally, in detail mode the icons are listed in a single column, and all fields of the text are shown under a header control with one button for each subfield. When an item’s selected state changes, the icon list sends a SEL_SELECTED or SEL_DESELECTED message. A change of the current item is signified by the SEL_CHANGED message. The icon 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, replaced, or removed, the icon list sends messages of the type SEL_INSERTED, SEL_REPLACED, or SEL_DELETED. In each of these cases, the index to the item, if any, is passed in the 3rd argument of the message.

Events

The following messages are sent by FXIconList to its target:

SEL_CHANGED

sent when the current list item changes; the message data is an Integer indicating the index of the current item.

SEL_COMMAND

sent when the current list item changes; the message data is an Integer indicating the index of the current item.

SEL_KEYPRESS

sent when a key goes down; the message data is an FXEvent instance.

SEL_KEYRELEASE

sent when a key goes up; the message data is an FXEvent instance.

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_RIGHTBUTTONPRESS

sent when the right mouse button goes down; the message data is an FXEvent instance.

SEL_RIGHTBUTTONRELEASE

sent when the right mouse button goes up; the message data is an FXEvent instance.

SEL_CLICKED

sent when a list item is single-clicked; the message data is an Integer indicating the index of the current item.

SEL_DOUBLECLICKED

sent when a list item is double-clicked; the message data is an Integer indicating the index of the current item.

SEL_TRIPLECLICKED

sent when a list item is triple-clicked; the message data is an Integer indicating the index of the current item.

SEL_SELECTED

sent when a list item is selected; the message data is an Integer indicating the index of the selected item.

SEL_DESELECTED

sent when a list item is deselected; the message data is an Integer indicating the index of the deselected item.

SEL_REPLACED

sent when a list 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 list item is inserted; the message data is an Integer indicating the index of the item that was inserted.

SEL_DELETED

sent when a list item is about to be removed; the message data is an Integer indicating the index of the item to be removed.

Icon list styles

ICONLIST_EXTENDEDSELECT

Extended selection mode

ICONLIST_SINGLESELECT

At most one selected item

ICONLIST_BROWSESELECT

Always exactly one selected item

ICONLIST_MULTIPLESELECT

Multiple selection mode

ICONLIST_AUTOSIZE

Automatically size item spacing

ICONLIST_DETAILED

List mode

ICONLIST_MINI_ICONS

Mini Icon mode

ICONLIST_BIG_ICONS

Big Icon mode

ICONLIST_ROWS

Row-wise mode

ICONLIST_COLUMNS

Column-wise mode

ICONLIST_NORMAL

same as ICONLIST_EXTENDEDSELECT

Message identifiers

ID_SHOW_DETAILS

x

ID_SHOW_MINI_ICONS

x

ID_SHOW_BIG_ICONS

x

ID_ARRANGE_BY_ROWS

x

ID_ARRANGE_BY_COLUMNS

x

ID_HEADER_CHANGE

x

ID_TIPTIMER

x

ID_LOOKUPTIMER

x

ID_SELECT_ALL

x

ID_DESELECT_ALL

x

ID_SELECT_INVERSE

x

Direct Known Subclasses

FXFileList

Instance Attribute Summary collapse

Attributes inherited from FXScrollArea

#contentHeight, #contentWidth, #horizontalScrollBar, #scrollStyle, #verticalScrollBar, #viewportHeight, #viewportWidth, #xPosition, #yPosition

Attributes inherited from FXWindow

#accelTable, #backColor, #defaultCursor, #dragCursor, #first, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXScrollArea

#horizontalScrollable?, #position, #scrollCorner, #setPosition, #verticalScrollable?

Methods inherited from FXComposite

#maxChildHeight, #maxChildWidth

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?, #position, #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

#connect

Methods inherited from FXDrawable

#resize

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 = ICONLIST_NORMAL, x = 0, y = 0, width = 0, height = 0) ⇒ FXIconList

Construct icon list with no items in it initially



189
190
# File 'rdoc-sources/FXIconList.rb', line 189

def initialize(p, target=nil, selector=0, opts=ICONLIST_NORMAL, x=0, y=0, width=0, height=0) # :yields: theIconList
end

Instance Attribute Details

#anchorItemObject

Index of anchor item, or -1 if none [Integer]



162
163
164
# File 'rdoc-sources/FXIconList.rb', line 162

def anchorItem
  @anchorItem
end

#currentItemObject

Index of current item, or -1 if none [Integer]



159
160
161
# File 'rdoc-sources/FXIconList.rb', line 159

def currentItem
  @currentItem
end

#cursorItemObject (readonly)

Index of item under the cursor, or -1 if none [Integer]



165
166
167
# File 'rdoc-sources/FXIconList.rb', line 165

def cursorItem
  @cursorItem
end

#fontObject

Text font Fox::FXFont



168
169
170
# File 'rdoc-sources/FXIconList.rb', line 168

def font
  @font
end

#headerObject (readonly)

The header control Fox::FXHeader



147
148
149
# File 'rdoc-sources/FXIconList.rb', line 147

def header
  @header
end

#helpTextObject

Status line help text [String]



186
187
188
# File 'rdoc-sources/FXIconList.rb', line 186

def helpText
  @helpText
end

#itemHeightObject (readonly)

Item height [Integer]



156
157
158
# File 'rdoc-sources/FXIconList.rb', line 156

def itemHeight
  @itemHeight
end

#itemSpaceObject

Maximum item space (in pixels) for each item [Integer]



180
181
182
# File 'rdoc-sources/FXIconList.rb', line 180

def itemSpace
  @itemSpace
end

#itemWidthObject (readonly)

Item width [Integer]



153
154
155
# File 'rdoc-sources/FXIconList.rb', line 153

def itemWidth
  @itemWidth
end

#listStyleObject

Icon list style [Integer]



183
184
185
# File 'rdoc-sources/FXIconList.rb', line 183

def listStyle
  @listStyle
end

#numColsObject (readonly)

Number of columns [Integer]



144
145
146
# File 'rdoc-sources/FXIconList.rb', line 144

def numCols
  @numCols
end

#numHeadersObject (readonly)

The number of header items in the header control [Integer]



150
151
152
# File 'rdoc-sources/FXIconList.rb', line 150

def numHeaders
  @numHeaders
end

#numItemsObject (readonly)

Number of items [Integer]



138
139
140
# File 'rdoc-sources/FXIconList.rb', line 138

def numItems
  @numItems
end

#numRowsObject (readonly)

Number of rows [Integer]



141
142
143
# File 'rdoc-sources/FXIconList.rb', line 141

def numRows
  @numRows
end

#selBackColorObject

Background color for selected item(s) Fox::FXColor



174
175
176
# File 'rdoc-sources/FXIconList.rb', line 174

def selBackColor
  @selBackColor
end

#selTextColorObject

Text color for selected item(s) Fox::FXColor



177
178
179
# File 'rdoc-sources/FXIconList.rb', line 177

def selTextColor
  @selTextColor
end

#textColorObject

Normal text color Fox::FXColor



171
172
173
# File 'rdoc-sources/FXIconList.rb', line 171

def textColor
  @textColor
end

Instance Method Details

#appendHeader(text, icon = nil, size = 1) ⇒ Object

Append header with given text and optional icon.



196
# File 'rdoc-sources/FXIconList.rb', line 196

def appendHeader(text, icon=nil, size=1); end

#appendItem(text, bigIcon = nil, miniIcon = nil, data = nil, notify = false) ⇒ Object Also known as: <<

Append a new item with given text and optional bigIcon, miniIcon and user data. If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is appended.



263
# File 'rdoc-sources/FXIconList.rb', line 263

def appendItem(item, notify=false); end

#clearItems(notify = false) ⇒ Object

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



309
# File 'rdoc-sources/FXIconList.rb', line 309

def clearItems(notify=false); end

#deselectItem(index, notify = false) ⇒ Object

Deselect item at index. If notify is true, a SEL_DESELECTED message is sent to the list’s message target after the item is deselected. Raises IndexError if index is out of bounds.



422
# File 'rdoc-sources/FXIconList.rb', line 422

def deselectItem(index, notify=false); end

#disableItem(index) ⇒ Object

Disable item at index. Raises IndexError if index is out of bounds.



410
# File 'rdoc-sources/FXIconList.rb', line 410

def disableItem(index); end

#eachObject

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



95
96
97
98
99
100
# File 'lib/fox16/iterators.rb', line 95

def each # :yields: anIconItem
  0.upto(numItems - 1) do |i|
    yield getItem(i)
  end
  self
end

#enableItem(index) ⇒ Object

Enable item at index. Raises IndexError if index is out of bounds.



406
# File 'rdoc-sources/FXIconList.rb', line 406

def enableItem(index); end

#extendSelection(index, notify = false) ⇒ Object

Extend selection from anchor index to index. If notify is true, a series of SEL_SELECTED and SEL_DESELECTED messages are sent to the list’s message target as the selected-state of different items changes. Raises IndexError if index is out of bounds.



441
# File 'rdoc-sources/FXIconList.rb', line 441

def extendSelection(index, notify=false); 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 list’s message target before the item is extracted from the list. Raises IndexError if index is out of bounds.



298
# File 'rdoc-sources/FXIconList.rb', line 298

def extractItem(index, notify=false); end

#fillItems(strings, big = nil, mini = nil, data = nil, notify = false) ⇒ Object

Fill list by appending items from array of strings, and return the number of items appended.



246
# File 'rdoc-sources/FXIconList.rb', line 246

def fillItems(strings, big=nil, mini=nil, data=nil, notify=false); end

#findItem(text, start = -1,, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object

Search items by text, beginning from item start. If the start item is -1 the search will start at the first 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 -1 if no matching item is found.



324
# File 'rdoc-sources/FXIconList.rb', line 324

def findItem(text, start=-1, flags=SEARCH_FORWARD|SEARCH_WRAP); end

#findItemByData(data, start = -1,, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object

Search items by associated user data, beginning from item start. If the start item is -1 the search will start at the first 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.



333
# File 'rdoc-sources/FXIconList.rb', line 333

def findItemByData(data, start=-1, flags=SEARCH_FORWARD|SEARCH_WRAP); end

#getHeaderIcon(headerIndex) ⇒ Object

Return icon of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



216
# File 'rdoc-sources/FXIconList.rb', line 216

def getHeaderIcon(headerIndex); end

#getHeaderSize(headerIndex) ⇒ Object

Return size of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



224
# File 'rdoc-sources/FXIconList.rb', line 224

def getHeaderSize(headerIndex); end

#getHeaderText(headerIndex) ⇒ Object

Return text of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



208
# File 'rdoc-sources/FXIconList.rb', line 208

def getHeaderText(headerIndex); end

#getItem(itemIndex) ⇒ Object

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



228
# File 'rdoc-sources/FXIconList.rb', line 228

def getItem(itemIndex); end

#getItemAt(x, y) ⇒ Object

Return index of item at (x, y), or -1 if none



312
# File 'rdoc-sources/FXIconList.rb', line 312

def getItemAt(x, y); end

#getItemBigIcon(index) ⇒ Object

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



357
# File 'rdoc-sources/FXIconList.rb', line 357

def getItemBigIcon(index); end

#getItemData(index) ⇒ Object

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



373
# File 'rdoc-sources/FXIconList.rb', line 373

def getItemData(index); end

#getItemMiniIcon(index) ⇒ Object

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



365
# File 'rdoc-sources/FXIconList.rb', line 365

def getItemMiniIcon(index); end

#getItemText(index) ⇒ Object

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



349
# File 'rdoc-sources/FXIconList.rb', line 349

def getItemText(index); end

#hitItem(index, x, y, ww = 1, hh = 1) ⇒ Object

Return item hit code: 0 outside, 1 icon, 2 text. Raises IndexError if index is out of bounds.



393
# File 'rdoc-sources/FXIconList.rb', line 393

def hitItem(index, x, y, ww=1, hh=1); end

#insertItem(index, text, bigIcon = nil, miniIcon = nil, data = nil, notify = false) ⇒ Object

Insert item at index with given text, bigIcon, miniIcon and user data. If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is inserted. Raises IndexError if index is out of bounds.



252
# File 'rdoc-sources/FXIconList.rb', line 252

def insertItem(index, item, notify=false); end

#itemCurrent?(index) ⇒ Boolean

Return true if item at index is the current item. Raises IndexError if index is out of bounds.

Returns:

  • (Boolean)


381
# File 'rdoc-sources/FXIconList.rb', line 381

def itemCurrent?(index); end

#itemEnabled?(index) ⇒ Boolean

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

Returns:

  • (Boolean)


389
# File 'rdoc-sources/FXIconList.rb', line 389

def itemEnabled?(index); end

#itemSelected?(index) ⇒ Boolean

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

Returns:

  • (Boolean)


377
# File 'rdoc-sources/FXIconList.rb', line 377

def itemSelected?(index); end

#itemVisible?(index) ⇒ Boolean

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

Returns:

  • (Boolean)


385
# File 'rdoc-sources/FXIconList.rb', line 385

def itemVisible?(index); end

#killSelection(notify = false) ⇒ Object

Deselect all items. If notify is true, a SEL_DESELECTED message is sent to the list’s message target for all the items that were selected before killSelection was called.



446
# File 'rdoc-sources/FXIconList.rb', line 446

def killSelection(notify=false); end

#makeItemVisible(itemOrIndex) ⇒ Object

Scroll to bring item into view. The argument is either a reference to an FXIconItem instance, or the integer index of an item in the list. For the latter case, #makeItemVisible raises IndexError if the index is out of bounds.



341
# File 'rdoc-sources/FXIconList.rb', line 341

def makeItemVisible(itemOrIndex); end

#moveItem(newIndex, oldIndex, notify = false) ⇒ Object

Move item from oldIndex to newIndex and return the new index of the item.. If notify is true and this move causes the current item to change, a SEL_CHANGED message is sent to the list’s message target to indicate this change in the current item. Raises IndexError if either oldIndex or newIndex is out of bounds.



290
# File 'rdoc-sources/FXIconList.rb', line 290

def moveItem(newIndex, oldIndex, notify=false); end

#prependItem(text, bigIcon = nil, miniIcon = nil, data = nil, notify = false) ⇒ Object

Prepend a new item with given text and optional bigIcon, miniIcon and user data. If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is prepended.



275
# File 'rdoc-sources/FXIconList.rb', line 275

def prependItem(item, notify=false); end

#removeHeader(headerIndex) ⇒ Object

Remove header at headerIndex. Raises IndexError if headerIndex is out of bounds.



200
# File 'rdoc-sources/FXIconList.rb', line 200

def removeHeader(headerIndex); end

#removeItem(index, notify = false) ⇒ Object

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



304
# File 'rdoc-sources/FXIconList.rb', line 304

def removeItem(index, notify=false); end

#selectInRectangle(x, y, w, h, notify = false) ⇒ Object

Select items in rectangle. If notify is true, a SEL_SELECTED message is sent to the list’s message target after each previously unselected item is selected.



402
# File 'rdoc-sources/FXIconList.rb', line 402

def selectInRectangle(x, y, w, h, notify=false); end

#selectItem(index, notify = false) ⇒ Object

Select item at index. If notify is true, a SEL_SELECTED message is sent to the list’s message target after the item is selected. Raises IndexError if index is out of bounds.



416
# File 'rdoc-sources/FXIconList.rb', line 416

def selectItem(index, notify=false); end

#setCurrentItem(index, notify = false) ⇒ Object

Change current item index. If notify is true, a SEL_CHANGED message is sent to the list’s message target after the current item changes. Raises IndexError if index is out of bounds.



435
# File 'rdoc-sources/FXIconList.rb', line 435

def setCurrentItem(index, notify=false); end

#setHeaderIcon(headerIndex, icon) ⇒ Object

Change icon of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



212
# File 'rdoc-sources/FXIconList.rb', line 212

def setHeaderIcon(headerIndex, icon); end

#setHeaders(strings, size = 1) ⇒ Object

Set headers from an array of strings.



193
# File 'rdoc-sources/FXIconList.rb', line 193

def setHeaders(strings, size=1); end

#setHeaderSize(headerIndex, size) ⇒ Object

Change size of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



220
# File 'rdoc-sources/FXIconList.rb', line 220

def setHeaderSize(headerIndex, size); end

#setHeaderText(headerIndex, text) ⇒ Object

Change text of header at headerIndex. Raises IndexError if headerIndex is out of bounds.



204
# File 'rdoc-sources/FXIconList.rb', line 204

def setHeaderText(headerIndex, text); end

#setItem(index, text, bigIcon = nil, miniIcon = nil, data = nil, notify = false) ⇒ Object

Replace item text, bigIcon, miniIcon and user data for the item at index. If notify is true, a SEL_REPLACED message is sent to the list’s message target before the item is replaced. Raises IndexError if index is out of bounds.



234
# File 'rdoc-sources/FXIconList.rb', line 234

def setItem(index, item, notify=false); end

#setItemBigIcon(index, bigIcon, owned = false) ⇒ Object

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



353
# File 'rdoc-sources/FXIconList.rb', line 353

def setItemBigIcon(index, bigIcon, owned=false); end

#setItemData(index, data) ⇒ Object

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



369
# File 'rdoc-sources/FXIconList.rb', line 369

def setItemData(index, data); end

#setItemMiniIcon(index, miniIcon, owned = false) ⇒ Object

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



361
# File 'rdoc-sources/FXIconList.rb', line 361

def setItemMiniIcon(index, miniIcon, owned=false); end

#setItemText(index, text) ⇒ Object

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



345
# File 'rdoc-sources/FXIconList.rb', line 345

def setItemText(index, text); end

#sortItemsObject

Sort items



449
# File 'rdoc-sources/FXIconList.rb', line 449

def sortItems(); end

#toggleItem(index, notify = false) ⇒ Object

Toggle item at index. If notify is true, either a SEL_SELECTED or SEL_DESELECTED message is sent to the list’s message target to indicate the item’s new state. Raises IndexError if index is out of bounds.



429
# File 'rdoc-sources/FXIconList.rb', line 429

def toggleItem(index, notify=false); end

#updateItem(index) ⇒ Object

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



397
# File 'rdoc-sources/FXIconList.rb', line 397

def updateItem(index); end