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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [doc/] [tabset.n] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1995 DSC Technologies Corporation
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
'\" @(#) WIDGET.n
8
'/"
9
.so man.macros
10
.HS tabset iwid
11
.BS
12
'\" Note:  do not modify the .SH NAME line immediately below!
13
'\"
14
'\"
15
.SH NAME
16
tabset \- create and manipulate tabs as as set
17
.SH SYNOPSIS
18
\fBtabset\fR \fIpathName\fR ?\fIoptions\fR?
19
.SH "INHERITANCE"
20
itk::Widget <- tabset
21
.SH "STANDARD OPTIONS"
22
.LP
23
.nf
24
.ta 4c 8c 12c
25
\fBbackground\fR        \fBfont\fR      \fBselectBackground\fR  \fBcursor\fR
26
\fBforeground\fR        \fBselectForeground\fR  \fBdisabledForeground\fR        \fBheight\fR
27
\fBwidth\fR
28
.fi
29
.LP
30
See the "options" manual entry for details on the standard options.
31
.SH "WIDGET-SPECIFIC OPTIONS"
32
.LP
33
.nf
34
Name:   \fBangle\fR
35
Class:  \fBAngle\fR
36
Command-Line Switch:    \fB-angle\fR
37
.fi
38
.IP
39
Specifes the angle of slope from the inner edge to the outer edge of the
40
tab. An angle of 0 specifies square tabs. Valid ranges are 0 to 45 degrees
41
inclusive. Default is 15 degrees. If tabPos is e or w, this option is ignored.
42
.LP
43
.nf
44
Name:   \fBbackdrop\fR
45
Class:  \fBBackdrop\fR
46
Command-Line Switch:    \fB-backdrop\fR
47
.fi
48
.IP
49
Specifies a background color to use when filling in the area behind the tabs.
50
.LP
51
.nf
52
Name:   \fBbevelAmount\fR
53
Class:  \fBBevelAmount\fR
54
Command-Line Switch:    \fB-bevelamount\fR
55
.fi
56
.IP
57
Specifes the size of tab corners. A value of 0 with angle set to 0 results
58
in square tabs. A \fBbevelAmount\fR of 4, means that the tab will be
59
drawn with angled corners that cut in 4 pixels from the edge of the
60
tab. The default is 0.
61
.LP
62
.nf
63
Name:   \fBcommand\fR
64
Class:  \fBCommand\fR
65
Command-Line Switch:    \fB-command\fR
66
Specifes the prefix of a Tcl command to invoke to change the view in the
67
widget associated with the tabset. When a user selects a tab, a Tcl command
68
is invoked. The actual command consists of this option followed by a space
69
and a number. The number is the numerical index of the tab that has been
70
selected.
71
.LP
72
.nf
73
Name:   \fBequalTabs\fR
74
Class:  \fBEqualTabs\fR
75
Command-Line Switch:    \fB-equaltabs\fR
76
.fi
77
.IP
78
Specifies whether to force tabs to be equal sized or not. A value
79
of \fBtrue\fR means constrain tabs to be equal sized. A value
80
of \fBfalse\fR allows each tab to size based on the text label size. The
81
value may have any of the forms accepted by the \fBTcl_GetBoolean\fR, such
82
as \fBtrue\fR, \fBfalse\fR, \fB0\fR, \fB1\fR, \fByes\fR, or \fBno\fR.
83
.IP
84
For horizontally positioned tabs (\fBtabPos\fR is either \fBs\fR
85
or \fBn\fR), \fBtrue\fR forces all tabs to be equal width (the width being
86
equal to the longest label plus any padX specified). Horizontal tabs are
87
always equal in height.
88
.IP
89
For vertically positioned tabs (\fBtabPos\fR is either \fBw\fR or \fBe\fR),
90
\fBtrue\fR forces all tabs to be equal height (the height being equal to
91
the height of the label with the largest font). Vertically oriented tabs are
92
always equal in width.
93
.LP
94
.nf
95
Name:   \fBgap\fR
96
Class:  \fBGap\fR
97
Command-Line Switch:    \fB-gap\fR
98
.fi
99
.IP
100
Specifies the amount of pixel space to place between each tab. Value may
101
be any pixel offset value. In addition, a special keyword \fBoverlap\fR
102
can be used as the value to achieve a standard overlap of tabs. This value
103
may have any of the forms acceptable to \fBTk_GetPixels\fR.
104
.LP
105
.nf
106
Name:   \fBmargin\fR
107
Class:  \fBMargin\fR
108
Command-Line Switch:    \fB-margin\fR
109
.fi
110
.IP
111
Specifies the amount of space to place between the outside edge of the
112
tabset and the outside edge of its tabs. If \fBtabPos\fR is \fBs\fR, this
113
is the amount of space between the bottom edge of the tabset and the
114
bottom edge of the set of tabs. If \fBtabPos\fR is \fBn\fR, this is the
115
amount of space between the top edge of the tabset and the top edge of the
116
set of tabs. If \fBtabPos\fR is \fBe\fR, this is the amount of space between
117
the right edge of the tabset and the right edge of the set of tabs.
118
If \fBtabPos\fR is \fBw\fR, this is the amount of space between the left
119
edge of the tabset and the left edge of the set of tabs. This value may
120
have any of the forms acceptable to \fBTk_GetPixels\fR.
121
.LP
122
.nf
123
Name:   \fBpadX\fR
124
Class:  \fBPadX\fR
125
Command-Line Switch:    \fB-padx\fR
126
.fi
127
.IP
128
Specifies a non-negative value indicating how much extra space to request for
129
a tab around its label in the X-direction. When computing how large a
130
window it needs, the tab will add this amount to the width it would normally
131
need The tab will end up with extra internal space to the left and right of
132
its text label. This value may have any of the forms acceptable
133
to \fBTk_GetPixels\fR.
134
.LP
135
.nf
136
Name:   \fBpadY\fR
137
Class:  \fBPadY\fR
138
Command-Line Switch:    \fB-pady\fR
139
.fi
140
.IP
141
Specifies a non-negative value indicating how much extra space to request
142
for a tab around its label in the Y-direction. When computing how large a
143
window it needs, the tab will add this amount to the height it would
144
normally need The tab will end up with extra internal space to the top and
145
bottom of its text label. This value may have any of the forms acceptable
146
to \fBTk_GetPixels\fR.
147
.LP
148
.nf
149
Name:   \fBraiseSelect\fR
150
Class:  \fBRaiseSelect\fR
151
Command-Line Switch:    \fB-raiseselect\fR
152
.fi
153
.IP
154
Specifes whether to slightly raise the selected tab from the rest of the
155
tabs. The selected tab is drawn 2 pixels closer to the outside edge of the
156
tabset than the unselected tabs. A value of true says to raise selected
157
tabs, a value of false turns this off. The default is false. The value may
158
have any of the forms accepted by the \fBTcl_GetBoolean\fR, such
159
as \fBtrue\fR, \fBfalse\fR, \fB0\fR, \fB1\fR, \fByes\fR, or \fBno\fR.
160
.LP
161
.nf
162
Name:   \fBstart\fR
163
Class:  \fBStart\fR
164
Command-Line Switch:    \fB-start\fR
165
.fi
166
.IP
167
Specifies the amount of space to place between the left or top edge of the
168
tabset and the starting edge of its tabs. For horizontally positioned tabs,
169
this is the amount of space between the left edge of the tabset and the left
170
edge of the first tab. For vertically positioned tabs, this is the amount
171
of space between the top of the tabset and the top of the first tab. This
172
value may change if the user performs a MButton-2 scroll on the tabs. This
173
value may have any of the forms acceptable to \fBTk_GetPixels\fR.
174
.LP
175
.nf
176
Name:   \fBstate\fR
177
Class:  \fBState\fR
178
Command-Line Switch:    \fB-state\fR
179
.fi
180
.IP
181
Sets the active state of the tabset. Specifying \fBnormal\fR allows all
182
tabs to be selectable. Specifying \fBdisabled\fR disables the tabset
183
causing all tabs to be drawn in the disabledForeground color.
184
.LP
185
.nf
186
Name:   \fBtabBorders\fR
187
Class:  \fBTabBorders\fR
188
Command-Line Switch:    \fB-tabborders\fR
189
.fi
190
.IP
191
Specifies whether to draw the borders of tabs that are not selected.
192
Specifying true (the default) draws these borders, specifying false
193
draws only the border around the selected tab. The value may have any
194
of the forms accepted by the \fBTcl_GetBoolean\fR, such
195
as \fBtrue\fR, \fBfalse,\fR \fB0\fR, \fB1\fR, \fByes\fR, or \fBno\fR.
196
.LP
197
.nf
198
Name:   \fBtabPos\fR
199
Class:  \fBTabPos\fR
200
Command-Line Switch:    \fB-tabpos\fR
201
.fi
202
.IP
203
Specifies the location of the set of tabs in relation to another widget. Must
204
be \fBn\fR, \fBs\fR, \fBe\fR, or \fBw\fR. Defaults to \fBs\fR. North tabs
205
open downward, South tabs open upward. West tabs open to the right, east
206
tabs open to the left.
207
.BE
208
.SH DESCRIPTION
209
.PP
210
The \fBtabset\fR command creates a new window (given by the pathName
211
argument) and makes it into a \fBtabset\fR widget. Additional \fIoptions\fR,
212
described above may be specified on the command line or in the option
213
database to configure aspects of the tabset such as its colors, font, and
214
text. The \fBtabset\fR command returns its \fIpathName\fR argument. At the
215
time this command is invoked, there must not exist a window
216
named \fIpathName\fR, but pathName's parent must exist.
217
.PP
218
A \fBtabset\fR is a widget that contains a set of Tab buttons. It displays
219
these tabs in a row or column depending on it tabpos. When a tab is
220
clicked on, it becomes the only tab in the tab set that is selected. All
221
other tabs are deselected. The Tcl command prefix associated with this
222
tab (through the command tab configure option) is invoked with the tab
223
index number appended to its argument list. This allows the tabset to
224
control another widget such as a Notebook.
225
.SH TABS
226
Tabs are drawn to appear attached to another widget. The tabset draws an
227
edge boundary along one of its edges. This edge is known as the attachment
228
edge. This edge location is dependent on the value of \fBtabPos\fR. For
229
example, if \fBtabPos\fR is \fBs\fR, the attachment edge wil be on the
230
top side of the tabset (in order to attach to the bottom or south side of
231
its attached widget). The selected tab is draw with a 3d relief to appear
232
above the other tabs. This selected tab "opens" toward attachment edge.
233
.PP
234
Tabs can be controlled in their location along the edges, the angle that
235
tab sides are drawn with, gap between tabs, starting margin of tabs,
236
internal padding around labels in a tab, the font, and its text or bitmap.
237
.SH "WIDGET-SPECIFIC METHODS"
238
.PP
239
The \fBtabset\fR command creates a new Tcl command whose name
240
is \fIpathName\fR. This command may be used to invoke various operations on
241
the widget. It has the following general form:
242
.DS C
243
\fIpathName option \fR?\fIarg arg ...\fR?
244
.DE
245
\fIoption\fR and the \fIarg\fRs
246
determine the exact behavior of the command.
247
.PP
248
Many of the widget commands for a tabset take as one argument an indicator
249
of which tab of the tabset to operate on. These indicators are called indexes
250
and may be specified in any of the following forms:
251
.TP
252
\fInumber\fR
253
Specifies the tab numerically, where 0 corresponds to the first tab in
254
the tab set, 1 to the second, and so on.
255
.TP
256
\fBselect\fR
257
Specifies the currently selected tab's index. If no tab is currently
258
selected, the value -1 is returned.
259
.TP
260
\fBend\fR
261
Specifes the last tab in the tabset's index. If the tabset is empty this
262
will return -1.
263
.TP
264
\fIpattern\fR
265
If the index doesn't satisfy any of the above forms, then this form is
266
used. Pattern is pattern-matched against the label of each tab in the
267
tabset, in order from the first to the last tab, until a matching entry is
268
found. The rules of Tcl_StringMatch are used.
269
.PP
270
'.............................................................................
271
The following commands are possible for tabset widgets:
272
.RS
273
.TP
274
\fIpathName\fR \fBadd\fR ?\fIoption\fR \fIvalue\fR \fIoption\fR \fIvalue\fR ...?
275
Add a new tab at the end of the tabset. Returns the child
276
site \fIpathName\fR. If additional arguments are present, they specify
277
any of the following options:
278
.RS
279
.TP
280
\fB-angle\fR \fIvalue\fR
281
Specifes the angle of slope from the inner edge to the outer edge of
282
the tab. An angle of 0 specifies square tabs. Valid ranges are 0 to
283
45 degrees inclusive. Default is 15 degrees. If this option is specified as
284
an empty string (the default), then the angle option for the overall tabset
285
is used.
286
.TP
287
\fB-background\fR \fIvalue\fR
288
Specifies a background color to use for displaying tabs when they are in
289
their normal state (unselected). If this option is specified as an empty
290
string (the default), then the background option for the overall tabset is
291
used.
292
.TP
293
\fB-bevelamount\fR \fIvalue\fR
294
Specifes the size of tab corners. A value of 0 with angle set to 0 results
295
in square tabs. A bevelAmount of 4, means that the tab will be drawn with
296
angled corners that cut in 4 pixels from the edge of the tab. The default is
297
0. This is generally only set at the tabset configuration level. Tabs
298
normally will want to share the same bevelAmount.
299
.TP
300
\fB-bitmap\fR \fIvalue\fR
301
If label is a non-empty string, specifies a bitmap to display in the
302
tab. Bitmap may be of any of the forms accepted by Tk_GetBitmap.
303
.TP
304
\fB-disabledforeground\fR \fIvalue\fR
305
Specifies a foreground color to use for displaying tab labels when tabs are
306
in their disable state. If this option is specified as an empty
307
string (the default), then the disabledforeground option for the overall
308
tabset is used.
309
.TP
310
\fB-font\fR \fIvalue\fR
311
Specifies the font to use when drawing the label on a tab. If this option
312
is specified as an empty string then the font option for the overall
313
tabset is used.
314
.TP
315
\fB-foreground\fR \fIvalue\fR
316
Specifies a foreground color to use for displaying tab labels when tabs
317
are in their normal unselected state. If this option is specified as an
318
empty string (the default), then the foreground option for the overall
319
tabset is used.
320
.TP
321
\fB-image\fR \fIvalue\fR
322
If label is a non-empty string, specifies an image to display in the
323
tab. Image must have been created with the image create command. Typically,
324
if the image option is specified then it overrides other options that
325
specify a bitmap or textual value to display in the widget; the image
326
option may be reset to an empty string to re-enable a bitmap or text display.
327
.TP
328
\fB-label\fR \fIvalue\fR
329
Specifies a text string to be placed in the tabs label. If this value is
330
set, the bitmap option is overridden and this option is used instead. This
331
label serves as an additional identifier used to reference the tab. This
332
label may be used for the index value in widget commands.
333
.TP
334
\fB-selectbackground\fR \fIvalue\fR
335
Specifies a background color to use for displaying the selected tab. If
336
this option is specified as an empty string (the default), then the
337
selectBackground option for the overall tabset is used.
338
.TP
339
\fB-selectforeground\fR \fIvalue\fR
340
Specifies a foreground color to use for displaying the selected tab. If
341
this option is specified as an empty string (the default), then the
342
selectForeground option for the overall tabset is used.
343
.TP
344
\fB-padx\fR \fIvalue\fR
345
Specifies a non-negative value indicating how much extra space to request
346
for a tab around its label in the X-direction. When computing how large
347
a window it needs, the tab will add this amount to the width it would
348
normally need The tab will end up with extra internal space to the left
349
and right of its text label. This value may have any of the forms acceptable
350
to Tk_GetPixels. If this option is specified as an empty string (the
351
default), then the padX option for the overall tabset is used
352
.TP
353
\fB-pady\fR \fIvalue\fR
354
Specifies a non-negative value indicating how much extra space to request
355
for a tab around its label in the Y-direction. When computing how large
356
a window it needs, the tab will add this amount to the height it would
357
normally need The tab will end up with extra internal space to the top
358
and bottom of its text label. This value may have any of the forms
359
acceptable to Tk_GetPixels. If this option is specified as an empty
360
string (the default), then the padY option for the overall tabset is used
361
.TP
362
\fB-state\fR \fIvalue\fR
363
Sets the state of the tab. Specifying normal allows this tab to be
364
selectable. Specifying disabled disables the this tab causing its tab label
365
to be drawn in the disabledForeground color. The tab will not respond to
366
events until the state is set back to normal.
367
.RE
368
.TP
369
\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue\fR \fIoption\fR \fIvalue\fR ...?
370
Query or modify the configuration options of the widget. If no \fIoption\fR
371
is specified, returns a list describing all of the available options
372
for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the
373
format of this list). If option is specified with no value, then the
374
command returns a list describing the one named option (this list will be
375
identical to the corresponding sublist of the value returned if no option
376
is specified). If one or more option-value pairs are specified, then the
377
command modifies the given widget option(s) to have the given value(s); in
378
this case the command returns an empty string. \fIOption\fR may have any
379
of the values accepted by the tabset command.
380
.TP
381
\fIpathName\fR \fBdelete\fR \fIindex1\fR ?\fIindex2\fR?
382
Delete all of the tabs between \fIindex1\fR and \fIindex2\fR inclusive.
383
If \fIindex2\fR is omitted then it defaults to \fIindex1\fR. Returns an
384
empty string.
385
.TP
386
\fIpathName\fR \fBindex\fR \fIindex\fR
387
Returns the numerical index corresponding to \fIindex\fR.
388
.TP
389
\fIpathName\fR \fBinsert\fR \fIindex\fR ?\fIoption\fR \fIvalue\fR \fIoption\fR \fIvalue\fR ...?
390
Insert a new tab in the tabset before the tab specified by \fIindex\fR. The
391
additional arguments are the same as for the \fBadd\fR command. Returns
392
the tab's \fIpathName\fR.
393
.TP
394
\fIpathName\fR \fBnext\fR
395
Advances the selected tab to the next tab (order is determined by insertion
396
order). If the currently selected tab is the last tab in the tabset, the
397
selection wraps around to the first tab. It behaves as if the user
398
selected the next tab.
399
.TP
400
\fIpathName\fR \fBtabconfigure\fR \fIindex\fR ?\fIoption\fR? ?\fIvalue\fR?
401
This command is similar to the \fBconfigure\fR command, except that it
402
applies to the options for an individual tab, whereas configure applies to
403
the options for the tabset as a whole. Options may have any of the values
404
accepted by the \fBadd\fR widget command. If options are specified, options
405
are modified as indicated in the command and the command returns an empty
406
string. If no options are specified, returns a list describing the current
407
options for tab index (see \fBTk_ConfigureInfo\fR for information on
408
the format of this list).
409
.TP
410
\fIpathName\fR \fBprev\fR
411
Moves the selected tab to the previous tab (order is determined by insertion
412
order). If the currently selected tab is the first tab in the tabset, the
413
selection wraps around to the last tab in the tabset. It behaves as if
414
the user selected the previous tab.
415
.TP
416
\fIpathName\fR \fBselect\fR \fIindex\fR
417
Selects the tab specified by \fIindex\fR as the currently selected tab. It
418
behaves as if the user selected the new tab.
419
 
420
.SH EXAMPLE
421
.PP
422
Following is an example that creates a tabset with two tabs and a list box
423
that the tabset controls. In addition selecting an item from the list
424
also selects the corresponding tab.
425
.PP
426
.nf
427
.IP
428
.ta 2c 8c 12c
429
# Define a proc that knows how to select an item
430
# from a list given an index from the tabset -command callback.
431
  proc selectItem { item } {
432
    .l selection clear [.l curselection]
433
    .l selection set $item
434
    .l see $item
435
}
436
.IP
437
# Define a proc that knows how to select a tab
438
# given a y pixel coordinate from the list..
439
  proc selectTab { y } {
440
    set whichItem [.l nearest $y]
441
    .ts select $whichItem
442
}
443
.IP
444
# Create a listbox with two items (one and two)
445
# and bind button 1 press to the selectTab procedure.
446
  listbox .l -selectmode single -exportselection false
447
  .l insert end one
448
  .l insert end two
449
  .l selection set 0
450
  pack .l
451
  bind .l  { selectTab %y }
452
.IP
453
# Create a tabset, set its -command to call selectItem
454
# Add two labels to the tabset (one and two).
455
  tabset .ts -command selectItem
456
  .ts add -label 1
457
  .ts add -label 2
458
  .ts select 0
459
  pack .ts -fill x -expand no
460
.fi
461
.SH AUTHOR
462
Bill W. Scott
463
.SH KEYWORDS
464
tab tabset notebook tabnotebook

powered by: WebSVN 2.1.0

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