Documentation‎ > ‎Containers‎ > ‎

gnocl::iconView

A widget that allow a collection of graphics items to be displayed as a grid of icons within a scrollable container.

Synopsis

gnocl::iconView [-option value...]

Screenshot 

Options

-baseFont string  (type: FONT)

Set default font for the text widget.The value passed to the option is a list of attributes in the following format:

typeface  size attributes: either bold | italic

-baseColor string

type: color

Set default colour for the text widget.
-columnSpacing integer  (default: 1)

Specifies the space which is inserted between the columns of the icon view.

-columns integer  (default: 1)

The number of the columns in which the items should be displayed. If it is -1, the number of columns will be chosen automatically to fill the available area.

-iconSize  integer  (default: 1)

Description to be added.

-itemPadding integer  (default: 1)

The padding around each of the icon view's item.

-itemWidth integer  (default: 1)

The width to use for each item. If it is set to -1, the icon view will automatically determine a suitable item size.

-margin integer  (default: 1)

The space which is inserted at the edges of the icon view.

-markupColumn integer  (default: 1)

The number of the model column containing markup information to be displayed. The markup column must be of type string. If this property and the text-column property are both set to column numbers, it overrides the text column. If both are set to -1, no texts are displayed.

-model integer  (default: 1)

The model for the icon view.

-orientation string  (default: vertical)

Specifies how the cells (i.e. the icon and the text) of the item are positioned relative to each other.

-pixbufColumn integer  (default: 1)

Tthe number of the model column containing the pixbufs which are displayed. The pixbuf column must be of type pixBuf.  Setting this property to -1 turns off the display of pixbufs.

-reorderable integer  (default: 1)

Specifies if the items can be reordered by DND.

-rowSpacing integer  (default: 1)

Specifies the space which is inserted between the rows of the icon view.

-selectionMode string  (default: single)

Specifies the selection mode of icon view. If the mode is multiple then rubberband selection is enabled, for the other modes, only keyboard selection is possible.

-spacing integer  (default: 1)

Specifies the space which is inserted between the cells (i.e. the icon and the text) of an item.

-textColumn integer  (default: 1)

Specifies the number of the model column containing the texts which are displayed. The text column must be of type string. If this property and the markup-column property are both set to -1, no text is displayed.

-tooltipColumn integer  (default: 1)

The column in the model containing the tooltip texts for the items.

Signals

-onActivateCursorItem string  (default: "")
Tcl script which is exectuted when the user activates the currently focused item. The default bindings for this signal are Space, Return and Enter.

%w    widget name
-onItemActivated string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onMoveCursor string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onSelectAll string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onSelectCursorItem string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onSelectionChanged string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onSetScrollAdjustments string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onToggleCursorItem string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name
-onUnselectAll string  (default: "")
Tcl script which is executed if the button is clicked. Before evaluation the following percent strings are substituted:

%w    widget name

Description

This widget provides an alternative view on a list model. It displays the model as a grid of icons with labels. An iconview widget allows the selection of one or multiple items. In addition to selection with the arrow keys, this widget supports rubberband selection, which is controlled by dragging the pointer.

Commands

id delete
Deletes the widget and the associated Tcl command.
id add string  [-option value...]
Adds the graphics named by string to the display.

Options

    -label string  (default: "")

Text to be displayed alongside the item added.

id class

Returns the class of this object, i.e. "iconview".

id cget option

Returns the value for one option. The option may have any of the values accepted by configure.

id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.

Example

#---------------
# Author: William J Giddings
# Date: 30/01/11
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl

set iv [gnocl::iconView \
-columnSpacing 0 \
-margin 1 \
-spacing 0 \
-columns 4 \
-rowSpacing 1 \
-pixbufColumn 0 \
-textColumn 1 \
-onItemActivated {puts WHEEE} \
-itemPadding 0 \
-itemWidth 50 \
-iconWidth 75 ]


set pb1 [gnocl::pixBuf load -file ./georgie.png"]

puts $pb1

for {set i 0 } {$i < 4} {incr i} {
$iv add "%/./georgie.png" -label "GiGi $i"
$iv add "%/./wjg.png" -label "WiGi $i"
$iv add "%/./gnocl.png" -label "NEW $i"
}

gnocl::window \
-child $iv \
-title gnocl::iconView \
-widthRequest 200 \
-heightRequest 200


gnocl::mainLoop


Comments