=head1 NAME Tk::DItem - Tix Display Items =for category Tix Extensions =head1 SYNOPSIS =head1 DESCRIPTION The Tix B and B are devised to solve a general problem: many Tix widgets (both existing and planned ones) display many items of many types simultaneously. For example, a hierarchical listbox widget (see L) can display items of images, plain text and subwindows in the form of a hierarchy. Another widget, the tabular listbox widget (see L) also displays items of the same types, although it arranges the items in a tabular form. Yet another widget, the spreadsheet widget (see L), also displays similar types items, but in yet another format. In these examples, the display items in different widgets are only different in how they are arranged by the B. In Tix, display items are clearly separated from the host widgets. The advantage is two-fold: first, the creation and configuration of display items become uniform across different host widgets. Second, new display item types can be added without the need to modify the existing host widgets. In a way, Tix display items are similar to the items inside Tk the canvas widget. However, unlike the Tix display items, the canvas items are not independent of the canvas widget; this makes it impossible to use the canvas items inside other types of TK widgets. The appearance of a display item is controlled by a set of I. It is observed that each the attributes usually fall into one of two categroies: ``I'' or ``I''. For example, the text items inside a HList widget may all display a different text string; however, in most cases, the text items share the same color, font and spacing. Instead of keeping a duplicated version of the same attributes inside each display item, it will be advantageous to put the collective attributes in a special object called a B. First, there is the space concern: a host widget may have many thousands of items; keeping dupilcated attributes will be very wasteful. Second, when it becomes necessary to change a collective attribute, such as changing all the text items' foreground color to red, it will be more efficient to change only the display style object than to modify all the text items one by one. The attributes of the a display item are thus stored in two places: it has a set of B to store its individual attributes. Each display item is also associated with a I, which specifies the collective attributes of all items associated with itself. The division between the individual and collective attributes are fixed and cannot be changed. Thus, when it becomes necessary for some items to differ in their collective attributes, two or more B can be used. For example, suppose you want to display two columns of text items inside an HList widget, one column in red and the other in blue. You can create a TextStyle object called ``$red'' which defines a red foreground, and another called ``$blue'', which defines a blue foreground. You can then associate all text items of the first column to ``$red'' and the second column to ``$blue'' =head1 DISPLAY ITEM TYPES AND OPTIONS Currently there are three types of display items: B, B and I. =head1 IMAGETEXT ITEMS Display items of the type B are used to display an image together with a text string. Imagetext items support the following options: =head2 Imagetext Item Options =over 4 =item Name: B =item Class: B =item Switch: B<-bitmap> Specifies the bitmap to display in the item. =item Name: B =item Class: B =item Switch: B<-image> Specifies the image to display in the item. When both the B<-bitmap> and B<-image> options are specified, only the image will be displayed. =item Name: B =item Class: B =item Switch: B<-style> Specifies the display style to use for this item. Must be the name of a B display style that has already be created with B. =item Name: B =item Class: B =item Switch: B<-showimage> A Boolean value that specifies whether the image/bitmap should be displayed. =item Name: B =item Class: B =item Switch: B<-showtext> A Boolean value that specifies whether the text string should be displayed. =item Name: B =item Class: B =item Switch: B<-text> Specifies the text string to display in the item. =item Name: B =item Class: B =item Switch: B<-underline> Specifies the integer index of a character to underline in the text string in the item. 0 corresponds to the first character of the text displayed in the widget, 1 to the next character, and so on. =back =head2 Imagetext Style Options The style information of B items are stored in the B display style. The following options are supported: B B<-activebackground> B<-activeforeground> B<-anchor> B<-background> B<-disabledbackground> B<-disabledforeground> B<-foreground> B<-font> B<-justify> B<-padx> B<-pady> B<-selectbackground> B<-selectforeground> B<-wraplength> See L for details of the standard options. B =over 4 =item Name: B =item Class: B =item Switch: B<-gap> Specifies the distance between the bitmap/image and the text string, in number of pixels. =item Name: B =item Class: B =item Switch: B<-textanchor> The anchor position on the image to which text part is attached. This is a perl/Tk addition. Defaults to B for compatibility with standard Tix. The interesting cases are =over 8 =item B Text is centred above the image. =item B Text is centred below the image =item B Text is centred to right of the image. =item B Text is centred to left of the image. =item B Text is centred over the image. =back The B, B, B, and b cases look rather odd. To get items to line up correctly it will usually be necessary to specify B<-anchor> as well. e.g. with default B then anchoring item as a whole B lines images up down left with text stuck to right side. =back =head1 TEXT ITEMS Display items of the type B are used to display a text string in a widget. Text items support the following options: =head2 Text Item Options =over 4 =item Name: B =item Class: B =item Switch: B<-style> Specifies the display style to use for this text item. Must be the name of a B display style that has already be created with B. =item Name: B =item Class: B =item Switch: B<-text> Specifies the text string to display in the item. =item Name: B =item Class: B =item Switch: B<-underline> Specifies the integer index of a character to underline in the item. 0 corresponds to the first character of the text displayed in the widget, 1 to the next character, and so on. =back =head2 Text Style Options B B<-activebackground> B<-activeforeground> B<-anchor> B<-background> B<-disabledbackground> B<-disabledforeground> B<-foreground> B<-font> B<-justify> B<-padx> B<-pady> B<-selectbackground> B<-selectforeground> B<-wraplength> See L for details of the standard options. =head1 WINDOW ITEMS Display items of the type I are used to display a sub-window in a widget. B items support the following options: =head2 Window Item Options =over 4 =item Name: B =item Class: B =item Switch: B<-style> Specifies the display style to use for this window item. Must be the name of a I display style that has already be created with the B method. =item Name: B =item Class: B =item Switch: B<-window> =item Alias: B<-widget> Specifies the sub-window to display in the item. =back =head2 Window Style Options B