OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tix/] [man/] [DItem.n] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996, Expert Interface Technologies
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" The file man.macros and some of the macros used by this file are
8
'\" copyrighted: (c) 1990 The Regents of the University of California.
9
'\"              (c) 1994-1995 Sun Microsystems, Inc.
10
'\" The license terms of the Tcl/Tk distrobution are in the file
11
'\" license.tcl.
12
.so man.macros
13
'----------------------------------------------------------------------
14
.HS tixItemType tix 4.0
15
.BS
16
'
17
'
18
'----------------------------------------------------------------------
19
.SH NAME
20
Tix Display Items
21
'
22
.BE
23
'
24
.SH DESCRIPTION
25
'
26
The Tix \fBDisplay Items\fR and \fBDisplay Types\fR are devised to
27
solve a general problem: many Tix widgets (both existing and planned
28
ones) display many items of many types simutaneously.
29
'
30
.PP
31
'
32
For example, a hierarchical listbox widget (HList) can display items
33
of images, plain text and subwindows in the form of a
34
hierarchy. Another widget, the tabular listbox, (TList, currently
35
planned and will be released in Tix 4.1) also display items of the
36
same types, although it arranges the items in a tabular form. Yet
37
another widget, the spreadsheet widget, also displays similar types
38
items, but in yet another format.
39
'
40
.PP
41
'
42
In these examples, the display items in different widgets are only
43
different in how they are arranged by the \fBhost widget\fR. In Tix,
44
display items are clearly separated from the host widgets. The
45
advantage is two-fold: first, the creation and configuration of
46
display items become uniform across different host widgets. Second,
47
new display item types can be added without the need to modify the
48
existing host widgets.
49
'
50
.PP
51
'
52
In a way, Tix display items are similar to the items inside Tk
53
the canvas widget. However, unlike the Tix display items, the canvas
54
items are not independent of the canvas widget; this makes it
55
impossible to use the canvas items inside other types of TK widgets.
56
'
57
.PP
58
'
59
The appearance of a display item is controlled by a set of
60
\fIattributes\fR. It is observed that each the attributes usually fall
61
into one of two categroies: "\fIindividual\fR" or
62
"\fIcollective\fR". For example, the text items inside a HList widget
63
may all display a different text string; however, in most cases, the
64
text items share the same color, font and spacing. Instead of keeping
65
a duplicated version of the same attributes inside each display item,
66
it will be advantageous to put the collective attributes in a
67
special object called a \fBdisplay style\fR. First, there is the space
68
concern: a host widget may have many thousands of items; keeping
69
dupilcated attributes will be very wasteful. Second, when it becomes
70
necessary to change a collective attribute, such as changing all the
71
text items' foreground color to red, it will be more efficient to
72
change only the display style object than to modify all the text
73
items one by one.
74
'
75
.PP
76
'
77
The attributes of the a display item are thus stored in two places: it
78
has a set of \fBitem options\fR to store its individual attributes. Each
79
display item is also associated with a \fIdisplay style\fR, which specifies
80
the collective attributes of all items associated with itself.
81
'
82
.PP
83
'
84
The division between the individual and collective attributes are
85
fixed and cannot be changed. Thus, when it becomes necessary for some
86
items to differ in their collective attributes, two or more \fBdisplay
87
styles\fR can be used. For example, suppose you want to display two
88
columns of text items inside an HList widget, one column in red and
89
the other in blue. You can create a TextStyle object called "red",
90
which defines a red foreground, and another called "blue", which
91
defines a blue foreground. You can then associate all text items of
92
the first column to "red" and the second column to "blue".
93
'
94
.SH DISPLAY ITEM TYPES AND OPTIONS
95
'
96
Currently there are three types of display items: \fBtext\fR,
97
\fBimagetext\fR and \fBwindow\fR.
98
'
99
'----------------------------------------------------------------------
100
'                       ImageText
101
'----------------------------------------------------------------------
102
.SH IMAGETEXT ITEMS
103
'
104
Display items of the type \fBimagetext\fR are used to display an image
105
together with a text string. Imagetext items support the following options:
106
'
107
.PP
108
\fBITEM OPTIONS\fR
109
.PP
110
.RS
111
'----------BEGIN
112
.LP
113
.nf
114
Name:           \fBbitmap\fR
115
Class:          \fBBitmap\fR
116
Switch:         \fB\-bitmap\fR
117
.fi
118
.IP
119
Specifies the bitmap to display in the item.
120
'----------END
121
'
122
'----------BEGIN
123
.LP
124
.nf
125
Name:           \fBimage\fR
126
Class:          \fBImage\fR
127
Switch:         \fB\-image\fR
128
.fi
129
.IP
130
Specifies the image to display in the item. When both the
131
\fB\-bitmap\fR and \fB\-image\fR options are specified, only the image
132
will be displayed.
133
'----------END
134
'
135
'----------BEGIN
136
.LP
137
.nf
138
Name:           \fBimageTextStyle\fR
139
Class:          \fBImageTextStyle\fR
140
Switch:         \fB\-style\fR
141
.fi
142
.IP
143
Specifies the display style to use for this item. Must be the
144
name of a \fBimagetext\fR display style that has already be created by
145
the \fBtixDisplayStyle(n)\fR command.
146
'----------END
147
'
148
'----------BEGIN
149
.LP
150
.nf
151
Name:           \fBshowImage\fR
152
Class:          \fBShowImage\fR
153
Switch:         \fB\-showimage\fR
154
.fi
155
.IP
156
A Boolean value that specifies whether the image/bitmap should be
157
displayed.
158
'----------END
159
'
160
'----------BEGIN
161
.LP
162
.nf
163
Name:           \fBshowText\fR
164
Class:          \fBShowText\fR
165
Switch:         \fB\-showtext\fR
166
.fi
167
.IP
168
A Boolean value that specifies whether the text string should be
169
displayed.
170
'----------END
171
'
172
'----------BEGIN
173
.LP
174
.nf
175
Name:           \fBtext\fR
176
Class:          \fBText\fR
177
Switch:         \fB\-text\fR
178
.fi
179
.IP
180
Specifies the text string to display in the item.
181
'----------END
182
'
183
'----------BEGIN
184
.LP
185
.nf
186
Name:           \fBunderline\fR
187
Class:          \fBUnderline\fR
188
Switch:         \fB\-underline\fR
189
.fi
190
.IP
191
Specifies the integer index of a character to underline in the text
192
string in the item.  0 corresponds to the first character of the text
193
displayed in the widget, 1 to the next character, and so on.
194
'----------END
195
.RE
196
'
197
.PP
198
\fBSTYLE OPTIONS\fR
199
'
200
.PP
201
The style information of \fBimagetext\fR items are stored in the
202
\fBimagetext\fR display style. The following options are supported:
203
'
204
.RS
205
'
206
.PP
207
\fBSTANDARD OPTIONS\fR
208
'
209
.PP
210
\fC
211
.ta 6c
212
.nf
213
activeBackground        activeForeground
214
anchor                  background
215
disabledBackground      disabledForeground
216
foreground              font
217
justify                 padX
218
padY                    selectBackground
219
selectForeground        wrapLength
220
.fi
221
\fR
222
.ta 4c
223
.PP
224
See the \fBoptions(n)\fR manual entry for details on the standard
225
options.
226
.PP
227
'
228
.PP
229
\fBSTYLE-SPECIFIC OPTIONS\fR
230
.PP
231
'----------BEGIN
232
.LP
233
.nf
234
Name:           \fBgap\fR
235
Class:          \fBGap\fR
236
Switch:         \fB\-gap\fR
237
'
238
.fi
239
.IP
240
Specifies the distance between the bitmap/image and the text string,
241
in number of pixels.
242
'----------END
243
'
244
.RE
245
'
246
'**********************************************************************
247
'
248
'                       text
249
'
250
'**********************************************************************
251
.SH TEXT ITEMS
252
'
253
Display items of the type \fBtext\fR are used to display a text string
254
in a widget. Text items support the following options:
255
'
256
.PP
257
\fBITEM OPTIONS\fR
258
.PP
259
.RS
260
'----------BEGIN
261
.LP
262
.nf
263
Name:           \fBtextStyle\fR
264
Class:          \fBTextStyle\fR
265
Switch:         \fB\-style\fR
266
.fi
267
.IP
268
Specifies the display style to use for this text item. Must be the
269
name of a \fBtext\fR display style that has already be created by the
270
\fBtixDisplayStyle(n)\fR command.
271
'----------END
272
'
273
'----------BEGIN
274
.LP
275
.nf
276
Name:           \fBtext\fR
277
Class:          \fBText\fR
278
Switch:         \fB\-text\fR
279
.fi
280
.IP
281
Specifies the text string to display in the item.
282
'----------END
283
'
284
'----------BEGIN
285
.LP
286
.nf
287
Name:           \fBunderline\fR
288
Class:          \fBUnderline\fR
289
Switch:         \fB\-underline\fR
290
.fi
291
.IP
292
Specifies the integer index of a character to underline in the item.
293
 
294
widget, 1 to the next character, and so on.
295
'----------END
296
.RE
297
'
298
\fBSTYLE OPTIONS\fR
299
.PP
300
.RS
301
.PP
302
\fBSTANDARD OPTIONS\fR
303
'
304
.PP
305
\fC
306
.ta 6c
307
.nf
308
activeBackground        activeForeground
309
anchor                  background
310
disabledBackground      disabledForeground
311
foreground              font
312
justify                 padX
313
padY                    selectBackground
314
selectForeground        wrapLength
315
.fi
316
\fR
317
.ta 4c
318
.PP
319
See the \fBoptions(n)\fR manual entry for details on the standard
320
options.
321
'
322
'
323
.PP
324
.RE
325
'**********************************************************************
326
'
327
'                       Window
328
'
329
'**********************************************************************
330
.SH WINDOW ITEMS
331
'
332
Display items of the type \fBwindow\fR are used to display a
333
sub-window in a widget. \fBWindow\fR items support the following
334
options:
335
'
336
.PP
337
\fBITEM OPTIONS\fR
338
.PP
339
.RS
340
'----------BEGIN
341
.LP
342
.nf
343
Name:           \fBwindowStyle\fR
344
Class:          \fBWindowStyle\fR
345
Switch:         \fB\-style\fR
346
.fi
347
.IP
348
Specifies the display style to use for this window item. Must be the
349
name of a \fBwindow\fR display style that has already be created by
350
the \fBtixDisplayStyle(n)\fR command.
351
'----------END
352
'
353
'----------BEGIN
354
.LP
355
.nf
356
Name:           \fBwindow\fR
357
Class:          \fBWindow\fR
358
Switch:         \fB\-window\fR
359
Alias:          \fB\-widget\fR
360
.fi
361
.IP
362
Specifies the sub-window to display in the item.
363
'----------END
364
'
365
.RE
366
'
367
\fBSTYLE OPTIONS\fR
368
.PP
369
.RS
370
\fBSTANDARD OPTIONS\fR
371
'
372
.PP
373
\fC
374
.ta 6c
375
.nf
376
anchor
377
padX            padY
378
.PP
379
.fi
380
.ta 4c
381
See the \fBoptions(n)\fR manual entry for details on the standard
382
options.
383
'
384
.PP
385
.RE
386
'
387
'**********************************************************************
388
'
389
.SH CREATING DISPLAY ITEMS
390
'
391
'
392
Display items do not exist on their and thus they cannot be created
393
independently of the widgets they reside in. As a rule, display items
394
are created by special widget commands of their "host" widgets. For
395
example, the HList widgets has a command \fBitem\fR which can be used
396
to create new display items. The following code creates a new imagetext
397
item at the third column of the entry foo inside an HList widget:
398
'
399
.PP
400
\fC
401
.nf
402
 tixHList .h -columns 3
403
 .h add foo
404
 .h item create foo 2 \-itemtype imagetext \-text Hello \-image image1
405
.fi
406
.PP
407
\fR
408
'
409
The \fBitem create\fR command of the HList widget accepts a variable
410
number of arguments. The special argument \fB\-itemtype\fR specifies
411
which type of display item to create. Options that are valid for this
412
type of display items can then be specified by one or more
413
\fIoption\-value\fR pairs.
414
'
415
.PP
416
'
417
After the display item is created, they can then be configured or
418
destroyed using the commands provided by the host widget. For example,
419
the HList widget has the command \fBitem configure\fR, \fBitem cget\fR
420
and \fBitem delete\fR for accessing the display items.
421
'
422
'**********************************************************************
423
'
424
.SH CREATING AND MANIPULATING DISPLAY STYLES
425
'
426
'
427
Display styles are created by the command \fBtixDisplayStyle\fR:
428
'
429
.SH SYNOPSIS
430
\fBtixDisplayStyle\fI \fIitemType\fR ?\fI\-stylename name\fR? ?\fI\-refwindow pathName\fR? ?\fIoptions value ...\fR?
431
'
432
'
433
.PP
434
\fIitemType\fR must be one of the existing display items types such as
435
\fBtext\fR, \fBimagetext\fR, \fBwindow\fR or any new types added by
436
the user. Additional arguments can be given in one or more
437
\fIoption\-value\fR pairs. \fIoption\fR can be any of the valid option
438
for this display style or any of the following:
439
.PP
440
.RS
441
'
442
.TP
443
\fB\-stylename \fIname\fR
444
'
445
Specifies a name for this style. If unspecified, then a default name
446
will be chosen for this style.
447
'
448
.TP
449
\fB\-refwindow \fIpathName\fR
450
'
451
Specifies a window to use for determine the default values of the
452
display type. If unspecified, the main window will be used. Default
453
values for the display types can be set via the options database. The
454
following example sets the \fB\-disablebackground\fR and
455
\fB\-disabledforeground\fR options of a \fBtext\fR display style via
456
the option database:
457
\fC
458
.nf
459
option add *table.list*disabledForeground blue
460
option add *table.list*disabledBackground darkgray
461
tixDisplayStyle text -refwindow .table.list -fg red
462
.fi
463
\fR
464
'
465
By using the option database to set the options of the display styles,
466
we can advoid hard-coding the option values and give the user more
467
flexibility in customization. See option(n) for a detailed description
468
of the option database.
469
'
470
.SH STYLE COMMAND
471
.PP
472
The \fBtixDisplayStyle\fR command creates a new Tcl command whose name is the
473
same as the name of the newly created display style.  This command
474
may be used to invoke various operations on the display style.  It has the
475
following general form:
476
'
477
'
478
.DS C
479
'
480
\fIstyleName option \fR?\fIarg arg ...\fR?
481
.PP
482
.DE
483
'
484
\fIstyleName\fR is the name of the command. \fIOption\fR and the
485
\fIarg\fRs determine the exact behavior of the command. The following
486
commands are possible:
487
'
488
.TP
489
\fIstyleName \fBcget\fR \fIoption\fR
490
'
491
Returns the current value of the configuration option given by
492
\fIoption\fR. \fIOption\fR may have any of the valid options of this
493
display style.
494
'
495
.TP
496
'
497
\fIstyleName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
498
'
499
Query or modify the configuration options of the display style.  If no
500
\fIoption\fR is specified, returns a list describing all of the
501
available options for \fIstyleName\fR (see \fBTk_ConfigureInfo\fR for
502
information on the format of this list). If \fIoption\fR is specified
503
with no \fIvalue\fR, then the command returns a list describing the
504
one named option (this list will be identical to the corresponding
505
sublist of the value returned if no \fIoption\fR is specified).  If
506
one or more \fIoption\-value\fR pairs are specified, then the command
507
modifies the given option(s) to have the given value(s); in this case
508
the command returns an empty string. \fIOption\fR may have any of the
509
valid options of this display style.
510
'
511
.TP
512
\fIstyleName \fBdelete\fR
513
'
514
Destroy this display style object.
515
'
516
.SH EXAMPLE
517
'
518
The following example creates two columns of data in a HList
519
widget. The first column is in red and the second column in blue. The
520
colors of the columns are controlled by two different \fBtext\fR
521
styles. Also, the anchor and font of the second column is chosen so
522
that the income data is aligned properly.
523
'
524
.PP
525
\fC
526
.nf
527
set courier -*-courier-medium-r-*-*-14-*-*-*-*-*-*-*
528
tixHList .h -columns 2; pack .h
529
set red  [tixDisplayStyle text -fg #800000]
530
set blue [tixDisplayStyle text -fg #000080 -anchor e -font $courier]
531
 
532
foreach n {{Joe $10,000} {Peter $20,000} {Raj $90,000} {Zinh $0}} {
533
    set entry [.h addchild {}]
534
    .h item create $entry 0 -itemtype text \\
535
        -text [lindex $n 0] -style $red
536
    .h item create $entry 1 -itemtype text \\
537
        -text [lindex $n 1] -style $blue
538
}
539
.fi
540
.PP
541
\fR
542
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.