Debian Codegraph @

man/container.mann

raw ◀ ▶
1 Debian patch touch this file
1 '\"
2 '\" Copyright 1998 by Bell Labs Innovations for Lucent Technologies.
3 '\"
4 '\" Permission to use, copy, modify, and distribute this software and its
5 '\" documentation for any purpose and without fee is hereby granted, provided
6 '\" that the above copyright notice appear in all copies and that both that the
7 '\" copyright notice and warranty disclaimer appear in supporting documentation,
8 '\" and that the names of Lucent Technologies any of their entities not be used
9 '\" in advertising or publicity pertaining to distribution of the software
10 '\" without specific, written prior permission.
11 '\"
12 '\" Lucent Technologies disclaims all warranties with regard to this software,
13 '\" including all implied warranties of merchantability and fitness. In no event
14 '\" shall Lucent Technologies be liable for any special, indirect or
15 '\" consequential damages or any damages whatsoever resulting from loss of use,
16 '\" data or profits, whether in an action of contract, negligence or other
17 '\" tortuous action, arising out of or in connection with the use or performance
18 '\" of this software.
19 '\"
20 '\" Container widget created by George Howlett.
21 '\"
22 .so man.macros.in
23 .TH container n BLT_VERSION BLT "BLT Built-In Commands"
24 .BS
25 '\" Note: do not modify the .SH NAME line immediately below!
26 .SH NAME
27 container \- Widget to contain a foreign window.
28 .BE
29 .SH SYNOPSIS
30 \fBcontainer\fR \fIpathName \fR?\fIoptions\fR?
31 .SH DESCRIPTION
32 The \fBcontainer\fR widget lets you swallow another X11/Win32 toplevel or
33 embed an X11 window from a foreign
34 application into your Tk application. The foreign window is
35 reparented inside of the widget. You can then place and arrange the
36 container just as you would any Tk widget.
37 .SH INTRODUCTION
38 Notebooks are a popular graphical paradigm. They allow you to organize
39 many windows in a single widget. For example, you might have an
40 application the displays several X-Y graphs at the same time.
41 Typically, you can't pack the graphs into the same \fBframe\fR because
42 they are too large. The other alternative is to pack the graphs into
43 several \fBtoplevel\fR widgets, allowing them to overlap on the
44 screen. The problem is that all the different toplevel windows
45 clutter the screen and are difficult to manage.
46 .PP
47 The \fBcontainer\fR widget lets organize your application by displaying
48 each graph as a page in a folder of a notebook. Only one page is
49 visible at a time. When you click on a tab, the folder (graph)
50 corresponding to the tab is displayed in the \fBcontainer\fR widget. The
51 container also lets you temporarily tear pages out of the notebook into a
52 separate toplevel widget, and put them back in the container later. For
53 example, you could compare two graphs side-by-side by tearing them
54 out, and then replace them when you are finished.
55 .PP
56 A container may contain an unlimited number of folders. If there are too
57 many tabs to view, you can arrange them as multiple tiers or scroll
58 the tabs. The container uses the conventional Tk scrollbar syntax, so you
59 can attach a scrollbar too.
60 .SH EXAMPLE
61 You create a container widget with the \fBcontainer\fR command.
62 .CS
63 # Create a new container
64 container .c
65 .CE
66 A new Tcl command \fB.c\fR is also created. This command can be
67 used to query and modify the container. For example, to change the
68 default borderwidth, you use the new command and
69 the container's \fBconfigure\fR operation.
70 .CS
71 # Change the default font.
72 \&.c configure \-borderwidth 2
73 .CE
74 You can then add folders using the \fBinsert\fR operation.
75 .CS
76 # Create a new folder "f1"
77 \&.c coinsert 0 "f1"
78 .CE
79 This inserts the new tab named "f1" into the container. The index
80 \fB0\fR indicates location to insert the new tab. You can also use
81 the index \fBend\fR to append a tab to the end of the container. By
82 default, the text of the tab is the name of the tab. You can change
83 this by configuring the \fB\-text\fR option.
84 .CS
85 # Change the label of "f1"
86 \&.ts tab configure "f1" -label "Tab #1"
87 .CE
88 The \fBinsert\fR operation lets you add one or more folders at a time.
89 .CS
90 \&.ts insert end "f2" -label "Tab #2" "f3" "f4"
91 .CE
92 The tab on each folder contains a label. A label may display both
93 an image and a text string. You can reconfigure the tab's attributes
94 (foreground/background colors, font, rotation, etc) using the \fBtab
95 configure\fR operation.
96 .CS
97 # Add an image to the label of "f1"
98 set image [image create photo -file stopsign.gif]
99 \&.ts tab configure "f1" -image $image
100 \&.ts tab configure "f2" -rotate 90
101 .CE
102 Each folder may contain an embedded widget to represent its contents.
103 The widget to be embedded must be a child of the container widget. Using
104 the \fB\-window\fR option, you specify the name of widget to be
105 embedded. But don't pack the widget, the container takes care of placing
106 and arranging the widget for you.
107 .CS
108 graph .ts.graph
109 \&.ts tab configure "f1" -window ".ts.graph" \\
110 -fill both -padx 0.25i -pady 0.25i
111 .CE
112 The size of the folder is determined the sizes of the Tk widgets
113 embedded inside each folder. The folder will be as wide as the widest
114 widget in any folder. The tallest determines the height. You can use
115 the tab's \fB\-pagewidth\fR and \fB\-pageheight\fR options override this.
116 .PP
117 Other options control how the widget appears in the folder. The
118 \fB\-fill\fR option says that you wish to have the widget stretch to
119 fill the available space in the folder.
120 .CS
121 \&.ts tab configure "f1" -fill both -padx 0.25i -pady 0.25i
122 .CE
123 .PP
124 Now when you click the left mouse button on "f1", the
125 graph will be displayed in the folder. It will be automatically
126 hidden when another folder is selected. If you click on the right
127 mouse button, the embedded widget will be moved into a toplevel widget
128 of its own. Clicking again on the right mouse button puts it back into
129 the folder.
130 .PP
131 If you want to share a page between two different folders, the
132 \fB\-command\fR option lets you specify a Tcl command to be invoked
133 whenever the folder is selected. You can reset the \fB\-window\fR
134 option for the tab whenever it's clicked.
135 .CS
136 \&.ts tab configure "f2" -command {
137 \&.ts tab configure "f2" -window ".ts.graph"
138 }
139 \&.ts tab configure "f1" -command {
140 \&.ts tab configure "f1" -window ".ts.graph"
141 }
142 .CE
143 If you have many folders, you may wish to stack tabs in multiple
144 tiers. The container's \fB\-tiers\fR option requests a maximum
145 number of tiers. The default is one tier.
146 .CS
147 \&.ts configure -tiers 2
148 .CE
149 If the tabs can fit in less tiers, the widget will use that many.
150 Whenever there are more tabs than can be displayed in the maximum number
151 of tiers, the container will automatically let you scroll the tabs. You
152 can even attach a scrollbar to the container.
153 .CS
154 \&.ts configure -scrollcommand { .sbar set } -scrollincrement 20
155 \&.sbar configure -orient horizontal -command { .ts view }
156 .CE
157 By default tabs are along the top of the container from left to right.
158 But tabs can be placed on any side of the container using the \fB\-side\fR
159 option.
160 .CS
161 # Arrange tabs along the right side of the container.
162 \&.ts configure -side right -rotate 270
163 .CE
164 .SH SYNTAX
165 The \fBcontainer\fR command creates a new window using the \fIpathName\fR
166 argument and makes it into a container widget.
167 .CS
168 \fBcontainer \fIpathName \fR?\fIoption value\fR?...
169 .CE
170 Additional options may be specified on the command line or in the
171 option database to configure aspects of the container such as its colors,
172 font, text, and relief. The \fBcontainer\fR command returns its
173 \fIpathName\fR argument. At the time this command is invoked, there
174 must not exist a window named \fIpathName\fR, but \fIpathName\fR's
175 parent must exist.
176 .PP
177 When first created, a new container contains no tabs. Tabs are added or
178 deleted using widget operations described below. It is not necessary
179 for all the tabs to be displayed in the container window at once;
180 commands described below may be used to change the view in the window.
181 Containers allow scrolling of tabs using the \fB\-scrollcommand\fR
182 option. They also support scanning (see the \fBscan\fR operation).
183 Tabs may be arranged along any side of the container window using the
184 \fB\-side\fR option.
185 .PP
186 The size of the container window is determined the number of tiers of
187 tabs and the sizes of the Tk widgets embedded inside each folder.
188 The widest widget determines the width of the folder. The tallest
189 determines the height. If no folders contain an embedded widget, the
•190 size is determined solely by the size of the tabs.
191 .PP
192 You can override either dimension with the container's \fB\-width\fR
193 and \fB\-height\fR options.
194 .SH "CONTAINER OPERATIONS"
195 All \fBcontainer\fR operations are invoked by specifying the widget's
196 pathname, the operation, and any arguments that pertain to that
197 operation. The general form is:
198 .sp
199 .CS
200 \fIpathName operation \fR?\fIarg arg ...\fR?
201 .CE
202 .sp
203 \fIOperation\fR and the \fIarg\fRs determine the exact behavior of the
204 command. The following operations are available for container widgets:
205 .TP
206 \fIpathName \fBcget\fR \fIoption\fR
207 Returns the current value of the configuration option given
208 by \fIoption\fR.
209 \fIOption\fR may have any of the values accepted by the \fBconfigure\fR
210 operation described below.
211 .TP
212 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
213 Query or modify the configuration options of the widget.
214 If no \fIoption\fR is specified, returns a list describing all
215 the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
216 information on the format of this list). If \fIoption\fR is specified
217 with no \fIvalue\fR, then the command returns a list describing the
218 one named option (this list will be identical to the corresponding
219 sublist of the value returned if no \fIoption\fR is specified). If
220 one or more \fIoption\-value\fR pairs are specified, then the command
221 modifies the given widget option(s) to have the given value(s); in
222 this case the command returns an empty string.
223 \fIOption\fR and \fIvalue\fR are described below:
224 .RS
225 .TP
226 \fB\-background \fIcolor\fR
227 Sets the border color of the container.
228 .TP
229 \fB\-borderwidth \fIpixels\fR
230 Sets the width of the 3\-D border around the outside edge of the widget. The
231 \fB\-relief\fR option determines how the border is to be drawn. The
232 default is \fB2\fR.
233 .TP
234 \fB\-command \fIpattern\fR
235 Specifies to search for a window whose \fBWM_COMMAND\fR property matches
236 the given pattern (X11 only). If no windows, or more than one window, matches
237 the pattern, an error is generated. If \fIpattern\fR is the empty
238 string, then no command search is performed.
239 The default is \fB""\fR.
240 .TP
241 \fB\-cursor \fIcursor\fR
242 Specifies the widget's cursor. The default cursor is \fB""\fR.
243 .TP
244 \fB\-height \fIpixels\fR
245 Specifies the requested height of widget. If \fIpixels\fR is
246 0, then the height is height the embedded window plus the specified
247 borderwidth. The default is \fB0\fR.
248 .TP
249 \fB\-highlightbackground \fIcolor\fR
250 Sets the color to display in the traversal highlight region when
251 the container does not have the input focus.
252 .TP
253 \fB\-highlightcolor \fIcolor\fR
254 Sets the color to use for the traversal highlight rectangle that is
255 drawn around the widget when it has the input focus.
256 The default is \fBblack\fR.
257 .TP
258 \fB\-highlightthickness \fIpixels\fR
259 Sets the width of the highlight rectangle to draw around the outside of
260 the widget when it has the input focus. \fIPixels\fR is a non-negative
261 value and may have any of the forms acceptable to \fBTk_GetPixels\fR.
262 If the value is zero, no focus highlight is drawn around the widget.
263 The default is \fB2\fR.
264 .TP
265 \fB\-name \fIpattern\fR
266 Specifies to search for a window whose \fBWM_NAME\fR property matches
267 the given pattern (X11 only). If no windows, or more than one window, matches
268 the pattern, an error is generated. If \fIpattern\fR is the empty
269 string, then no name search is performed.
270 The default is \fB""\fR.
271 .TP
272 \fB\-relief \fIrelief\fR
273 Specifies the 3-D effect for the container widget. \fIRelief\fR
274 specifies how the container should appear relative to widget that
275 it is packed into; for example, \fBraised\fR means the container should
276 appear to protrude. The default is \fBsunken\fR.
277 .TP
278 \fB\-takefocus\fR \fIfocus\fR
279 Provides information used when moving the focus from window to window
280 via keyboard traversal (e.g., Tab and Shift-Tab). If \fIfocus\fR is
281 \fB0\fR, this means that this window should be skipped entirely during
282 keyboard traversal. \fB1\fR means that the this window should always
283 receive the input focus. An empty value means that the traversal
284 scripts decide whether to focus on the window.
285 The default is \fB1\fR.
286 .TP
287 \fB\-width \fIpixels\fR
288 Specifies the requested width of the widget. If \fIpixels\fR is 0,
289 then the width is the width the embedded window and the specified
290 borderwidth. The default is \fB0\fR.
291 .TP
292 \fB\-window \fIid\fR
293 Specifies the foreign embedded using its path or X window id.
294 .RE
295 .TP
296 \fIpathName \fBfind \fB\-command\fR|\fB\-name\fR \fIpattern\fR
297 Searches for all windows that match the given pattern. If the
298 \fB\-command\fR switch is given, all windows whose \fCWWM_COMMAND\fR
299 property match \fIpattern\fR are returned in a list (X11 only). If the
300 \fB\-name\fR switch is given, all windows whose \fCWWM_NAME\fR
301 property match \fIpattern\fR are returned in a list. The list
302 returned will contains pairs of the window id and the matching property.
303 .SH KEYWORDS
304 container, widget