1 |
578 |
markom |
#
|
2 |
|
|
# Labeledframe
|
3 |
|
|
# ----------------------------------------------------------------------
|
4 |
|
|
# Implements a hull frame with a grooved relief, a label, and a
|
5 |
|
|
# frame childsite.
|
6 |
|
|
#
|
7 |
|
|
# The frame childsite can be filled with any widget via a derived class
|
8 |
|
|
# or though the use of the childsite method. This class was designed
|
9 |
|
|
# to be a general purpose base class for supporting the combination of
|
10 |
|
|
# a labeled frame and a childsite. The options include the ability to
|
11 |
|
|
# position the label at configurable locations within the grooved relief
|
12 |
|
|
# of the hull frame, and control the display of the label.
|
13 |
|
|
#
|
14 |
|
|
# To following demonstrates the different values which the "-labelpos"
|
15 |
|
|
# option may be set to and the resulting layout of the label when
|
16 |
|
|
# one executes the following command with "-labeltext" set to "LABEL":
|
17 |
|
|
#
|
18 |
|
|
# example:
|
19 |
|
|
# labeledframe .w -labeltext LABEL -labelpos
|
20 |
|
|
#
|
21 |
|
|
# ne n nw se s sw
|
22 |
|
|
#
|
23 |
|
|
# *LABEL**** **LABEL** ****LABEL* ********** ********* **********
|
24 |
|
|
# * * * * * * * * * * * *
|
25 |
|
|
# * * * * * * * * * * * *
|
26 |
|
|
# * * * * * * * * * * * *
|
27 |
|
|
# ********** ********* ********** *LABEL**** **LABEL** ****LABEL*
|
28 |
|
|
#
|
29 |
|
|
# en e es wn s ws
|
30 |
|
|
#
|
31 |
|
|
# ********** ********* ********* ********* ********* **********
|
32 |
|
|
# * * * * * * * * * * * *
|
33 |
|
|
# L * * * * * * L * * * *
|
34 |
|
|
# A * L * * * * A * L * L
|
35 |
|
|
# B * A * L * * B * A * A
|
36 |
|
|
# E * B * A * * E * B * B
|
37 |
|
|
# L * E * B * * L * E * E
|
38 |
|
|
# * * L * E * * * * L * L
|
39 |
|
|
# * * * * L * * * * * * *
|
40 |
|
|
# ********** ********** ********* ********** ********* **********
|
41 |
|
|
#
|
42 |
|
|
# ----------------------------------------------------------------------
|
43 |
|
|
# AUTHOR: John A. Tucker EMAIL: jatucker@spd.dsccc.com
|
44 |
|
|
#
|
45 |
|
|
# ======================================================================
|
46 |
|
|
# Copyright (c) 1997 DSC Technologies Corporation
|
47 |
|
|
# ======================================================================
|
48 |
|
|
# Permission to use, copy, modify, distribute and license this software
|
49 |
|
|
# and its documentation for any purpose, and without fee or written
|
50 |
|
|
# agreement with DSC, is hereby granted, provided that the above copyright
|
51 |
|
|
# notice appears in all copies and that both the copyright notice and
|
52 |
|
|
# warranty disclaimer below appear in supporting documentation, and that
|
53 |
|
|
# the names of DSC Technologies Corporation or DSC Communications
|
54 |
|
|
# Corporation not be used in advertising or publicity pertaining to the
|
55 |
|
|
# software without specific, written prior permission.
|
56 |
|
|
#
|
57 |
|
|
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
58 |
|
|
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
|
59 |
|
|
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
|
60 |
|
|
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
61 |
|
|
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
|
62 |
|
|
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
63 |
|
|
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
64 |
|
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
|
65 |
|
|
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
66 |
|
|
# SOFTWARE.
|
67 |
|
|
# ======================================================================
|
68 |
|
|
|
69 |
|
|
#
|
70 |
|
|
# Default resources.
|
71 |
|
|
#
|
72 |
|
|
option add *Labeledframe.labelMargin 10 widgetDefault
|
73 |
|
|
option add *Labeledframe.labelFont \
|
74 |
|
|
"-Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*" widgetDefault
|
75 |
|
|
option add *Labeledframe.labelPos n widgetDefault
|
76 |
|
|
option add *Labeledframe.labelBorderWidth 2 widgetDefault
|
77 |
|
|
option add *Labeledframe.labelRelief groove widgetDefault
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
#
|
81 |
|
|
# Usual options.
|
82 |
|
|
#
|
83 |
|
|
itk::usual Labeledframe {
|
84 |
|
|
keep -background -cursor -labelfont -foreground -labelrelief -labelborderwidth
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
class iwidgets::Labeledframe {
|
88 |
|
|
|
89 |
|
|
inherit itk::Widget
|
90 |
|
|
|
91 |
|
|
itk_option define -ipadx iPadX IPad 0
|
92 |
|
|
itk_option define -ipady iPadY IPad 0
|
93 |
|
|
|
94 |
|
|
itk_option define -labelmargin labelMargin LabelMargin 10
|
95 |
|
|
itk_option define -labelpos labelPos LabelPos n
|
96 |
|
|
itk_option define -labeltext labelText LabelText ""
|
97 |
|
|
|
98 |
|
|
constructor {args} {}
|
99 |
|
|
destructor {}
|
100 |
|
|
|
101 |
|
|
#
|
102 |
|
|
# Public methods
|
103 |
|
|
#
|
104 |
|
|
public method childsite {}
|
105 |
|
|
public method clientHandlesConfigure {{yes 1}}
|
106 |
|
|
|
107 |
|
|
#
|
108 |
|
|
# Private methods
|
109 |
|
|
#
|
110 |
|
|
private {
|
111 |
|
|
method smt {value} { _setMarginThickness $value }
|
112 |
|
|
method _positionLabel {{when later}}
|
113 |
|
|
method _collapseMargin {}
|
114 |
|
|
method _setMarginThickness {value}
|
115 |
|
|
|
116 |
|
|
proc _initTable {}
|
117 |
|
|
|
118 |
|
|
variable _reposition "" ;# non-null => _positionLabel pending
|
119 |
|
|
variable dontUpdate 0
|
120 |
|
|
|
121 |
|
|
common _LAYOUT_TABLE
|
122 |
|
|
}
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
#
|
126 |
|
|
# Provide a lowercased access method for the Labeledframe class.
|
127 |
|
|
#
|
128 |
|
|
proc ::iwidgets::labeledframe {pathName args} {
|
129 |
|
|
uplevel ::iwidgets::Labeledframe $pathName $args
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
# -----------------------------------------------------------------------------
|
133 |
|
|
# CONSTRUCTOR
|
134 |
|
|
# -----------------------------------------------------------------------------
|
135 |
|
|
body iwidgets::Labeledframe::constructor { args } {
|
136 |
|
|
#
|
137 |
|
|
# Create a window with the same name as this object
|
138 |
|
|
#
|
139 |
|
|
|
140 |
|
|
itk_component add labelFrame {
|
141 |
|
|
frame $itk_interior.lf \
|
142 |
|
|
-relief groove \
|
143 |
|
|
-class [namespace tail [info class]]
|
144 |
|
|
} {
|
145 |
|
|
keep -background -cursor
|
146 |
|
|
rename -relief -labelrelief labelRelief LabelRelief
|
147 |
|
|
rename -borderwidth -labelborderwidth labelBorderWidth LabelBorderWidth
|
148 |
|
|
rename -highlightbackground -background background Background
|
149 |
|
|
rename -highlightcolor -background background Background
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
#
|
153 |
|
|
# Create the childsite frame window
|
154 |
|
|
# _______
|
155 |
|
|
# |_____|
|
156 |
|
|
# |_|X|_|
|
157 |
|
|
# |_____|
|
158 |
|
|
#
|
159 |
|
|
itk_component add childsite {
|
160 |
|
|
frame $itk_component(labelFrame).childsite -highlightthickness 0 -bd 0
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
#
|
164 |
|
|
# Create the label to be positioned within the grooved relief
|
165 |
|
|
# of the labelFrame frame.
|
166 |
|
|
#
|
167 |
|
|
itk_component add label {
|
168 |
|
|
label $itk_component(labelFrame).label -highlightthickness 0 -bd 0
|
169 |
|
|
} {
|
170 |
|
|
usual
|
171 |
|
|
rename -bitmap -labelbitmap labelBitmap Bitmap
|
172 |
|
|
rename -font -labelfont labelFont Font
|
173 |
|
|
rename -image -labelimage labelImage Image
|
174 |
|
|
#rename -text -labeltext labelText Text
|
175 |
|
|
rename -textvariable -labelvariable labelVariable Variable
|
176 |
|
|
ignore -highlightthickness -highlightcolor -text
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
grid $itk_component(childsite) -row 1 -column 1 -sticky nsew
|
180 |
|
|
grid columnconfigure $itk_component(labelFrame) 1 -weight 1
|
181 |
|
|
grid rowconfigure $itk_component(labelFrame) 1 -weight 1
|
182 |
|
|
|
183 |
|
|
lappend after_script [code $this _positionLabel]
|
184 |
|
|
bind $itk_component(label) +[code $this _positionLabel]
|
185 |
|
|
|
186 |
|
|
pack $itk_component(labelFrame) -fill both -expand 1
|
187 |
|
|
|
188 |
|
|
#
|
189 |
|
|
# Initialize the class array of layout configuration options. Since
|
190 |
|
|
# this is a one time only thing.
|
191 |
|
|
#
|
192 |
|
|
_initTable
|
193 |
|
|
|
194 |
|
|
eval itk_initialize $args
|
195 |
|
|
|
196 |
|
|
#
|
197 |
|
|
# When idle, position the label.
|
198 |
|
|
#
|
199 |
|
|
_positionLabel
|
200 |
|
|
}
|
201 |
|
|
|
202 |
|
|
# -----------------------------------------------------------------------------
|
203 |
|
|
# DESTRUCTOR
|
204 |
|
|
# -----------------------------------------------------------------------------
|
205 |
|
|
body iwidgets::Labeledframe::destructor {} {
|
206 |
|
|
debug "In Labeledframe destructor for $this, reposition is $_reposition"
|
207 |
|
|
if {$_reposition != ""} {
|
208 |
|
|
debug "Canceling reposition $_reposition for $this"
|
209 |
|
|
after cancel $_reposition
|
210 |
|
|
set _reposition DESTRUCTOR
|
211 |
|
|
}
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
# -----------------------------------------------------------------------------
|
215 |
|
|
# OPTIONS
|
216 |
|
|
# -----------------------------------------------------------------------------
|
217 |
|
|
|
218 |
|
|
# ------------------------------------------------------------------
|
219 |
|
|
# OPTION: -ipadx
|
220 |
|
|
#
|
221 |
|
|
# Specifies the width of the horizontal gap from the border to the
|
222 |
|
|
# the child site.
|
223 |
|
|
# ------------------------------------------------------------------
|
224 |
|
|
configbody iwidgets::Labeledframe::ipadx {
|
225 |
|
|
grid configure $itk_component(childsite) -padx $itk_option(-ipadx)
|
226 |
|
|
_positionLabel
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
# ------------------------------------------------------------------
|
230 |
|
|
# OPTION: -ipady
|
231 |
|
|
#
|
232 |
|
|
# Specifies the width of the vertical gap from the border to the
|
233 |
|
|
# the child site.
|
234 |
|
|
# ------------------------------------------------------------------
|
235 |
|
|
configbody iwidgets::Labeledframe::ipady {
|
236 |
|
|
grid configure $itk_component(childsite) -pady $itk_option(-ipady)
|
237 |
|
|
_positionLabel
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
# -----------------------------------------------------------------------------
|
241 |
|
|
# OPTION: -labelmargin
|
242 |
|
|
#
|
243 |
|
|
# Set the margin of the most adjacent side of the label to the labelFrame
|
244 |
|
|
# relief.
|
245 |
|
|
# ----------------------------------------------------------------------------
|
246 |
|
|
configbody iwidgets::Labeledframe::labelmargin {
|
247 |
|
|
_positionLabel
|
248 |
|
|
}
|
249 |
|
|
|
250 |
|
|
# -----------------------------------------------------------------------------
|
251 |
|
|
# OPTION: -labelpos
|
252 |
|
|
#
|
253 |
|
|
# Set the position of the label within the relief of the labelFrame frame
|
254 |
|
|
# widget.
|
255 |
|
|
# ----------------------------------------------------------------------------
|
256 |
|
|
configbody iwidgets::Labeledframe::labelpos {
|
257 |
|
|
_positionLabel
|
258 |
|
|
}
|
259 |
|
|
|
260 |
|
|
# -----------------------------------------------------------------------------
|
261 |
|
|
# OPTION: -labelpos
|
262 |
|
|
#
|
263 |
|
|
# Set the position of the label within the relief of the labelFrame frame
|
264 |
|
|
# widget.
|
265 |
|
|
# ----------------------------------------------------------------------------
|
266 |
|
|
configbody iwidgets::Labeledframe::labeltext {
|
267 |
|
|
$itk_component(label) configure -text $itk_option(-labeltext)
|
268 |
|
|
_positionLabel
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
# -----------------------------------------------------------------------------
|
272 |
|
|
# PROCS
|
273 |
|
|
# -----------------------------------------------------------------------------
|
274 |
|
|
|
275 |
|
|
# -----------------------------------------------------------------------------
|
276 |
|
|
# PRIVATE PROC: _initTable
|
277 |
|
|
#
|
278 |
|
|
# Initializes the _LAYOUT_TABLE common variable of the Labeledframe
|
279 |
|
|
# class. The initialization is performed in its own proc ( as opposed
|
280 |
|
|
# to in the class definition ) so that the initialization occurs only
|
281 |
|
|
# once.
|
282 |
|
|
#
|
283 |
|
|
# _LAYOUT_TABLE common array description:
|
284 |
|
|
# Provides a table of the configuration option values
|
285 |
|
|
# used to place the label widget within the grooved relief of the labelFrame
|
286 |
|
|
# frame for each of the 12 possible "-labelpos" values.
|
287 |
|
|
#
|
288 |
|
|
# Each of the 12 rows is layed out as follows:
|
289 |
|
|
# {"-relx" "-rely" }
|
290 |
|
|
# -----------------------------------------------------------------------------
|
291 |
|
|
body iwidgets::Labeledframe::_initTable {} {
|
292 |
|
|
array set _LAYOUT_TABLE {
|
293 |
|
|
nw-relx 0.0 nw-rely 0.0 nw-wrap 0 nw-conf rowconfigure nw-num 0
|
294 |
|
|
n-relx 0.5 n-rely 0.0 n-wrap 0 n-conf rowconfigure n-num 0
|
295 |
|
|
ne-relx 1.0 ne-rely 0.0 ne-wrap 0 ne-conf rowconfigure ne-num 0
|
296 |
|
|
|
297 |
|
|
sw-relx 0.0 sw-rely 1.0 sw-wrap 0 sw-conf rowconfigure sw-num 2
|
298 |
|
|
s-relx 0.5 s-rely 1.0 s-wrap 0 s-conf rowconfigure s-num 2
|
299 |
|
|
se-relx 1.0 se-rely 1.0 se-wrap 0 se-conf rowconfigure se-num 2
|
300 |
|
|
|
301 |
|
|
en-relx 1.0 en-rely 0.0 en-wrap 1 en-conf columnconfigure en-num 2
|
302 |
|
|
e-relx 1.0 e-rely 0.5 e-wrap 1 e-conf columnconfigure e-num 2
|
303 |
|
|
es-relx 1.0 es-rely 1.0 es-wrap 1 es-conf columnconfigure es-num 2
|
304 |
|
|
|
305 |
|
|
wn-relx 0.0 wn-rely 0.0 wn-wrap 1 wn-conf columnconfigure wn-num 0
|
306 |
|
|
w-relx 0.0 w-rely 0.5 w-wrap 1 w-conf columnconfigure w-num 0
|
307 |
|
|
ws-relx 0.0 ws-rely 1.0 ws-wrap 1 ws-conf columnconfigure ws-num 0
|
308 |
|
|
}
|
309 |
|
|
|
310 |
|
|
#
|
311 |
|
|
# Since this is a one time only thing, we'll redefine the proc to be empty
|
312 |
|
|
# afterwards so it only happens once.
|
313 |
|
|
#
|
314 |
|
|
# NOTE: Be careful to use the "body" command, or the proc will get lost!
|
315 |
|
|
#
|
316 |
|
|
itcl::body ::iwidgets::Labeledframe::_initTable {} {}
|
317 |
|
|
}
|
318 |
|
|
|
319 |
|
|
# -----------------------------------------------------------------------------
|
320 |
|
|
# METHODS
|
321 |
|
|
# -----------------------------------------------------------------------------
|
322 |
|
|
|
323 |
|
|
# -----------------------------------------------------------------------------
|
324 |
|
|
# PUBLIC METHOD:: childsite
|
325 |
|
|
#
|
326 |
|
|
# -----------------------------------------------------------------------------
|
327 |
|
|
body iwidgets::Labeledframe::childsite {} {
|
328 |
|
|
return $itk_component(childsite)
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
# -----------------------------------------------------------------------------
|
332 |
|
|
# PUBLIC METHOD:: clientHandlesConfigure
|
333 |
|
|
#
|
334 |
|
|
# -----------------------------------------------------------------------------
|
335 |
|
|
body iwidgets::Labeledframe::clientHandlesConfigure {{yes 1}} {
|
336 |
|
|
if {$yes} {
|
337 |
|
|
set dontUpdate 1
|
338 |
|
|
bind $itk_component(label) { }
|
339 |
|
|
return [code $this _positionLabel now]
|
340 |
|
|
} else {
|
341 |
|
|
bind $itk_component(label) [code $this _positionLabel]
|
342 |
|
|
set dontUpdate 0
|
343 |
|
|
}
|
344 |
|
|
}
|
345 |
|
|
# -----------------------------------------------------------------------------
|
346 |
|
|
# PROTECTED METHOD: _positionLabel ?when?
|
347 |
|
|
#
|
348 |
|
|
# Places the label in the relief of the labelFrame. If "when" is "now", the
|
349 |
|
|
# change is applied immediately. If it is "later" or it is not
|
350 |
|
|
# specified, then the change is applied later, when the application
|
351 |
|
|
# is idle.
|
352 |
|
|
# -----------------------------------------------------------------------------
|
353 |
|
|
body iwidgets::Labeledframe::_positionLabel {{when later}} {
|
354 |
|
|
|
355 |
|
|
if {$when == "later"} {
|
356 |
|
|
if {$_reposition != ""} {
|
357 |
|
|
after cancel $_reposition
|
358 |
|
|
}
|
359 |
|
|
set _reposition [after idle [code $this _positionLabel now]]
|
360 |
|
|
return
|
361 |
|
|
}
|
362 |
|
|
|
363 |
|
|
set pos $itk_option(-labelpos)
|
364 |
|
|
|
365 |
|
|
#
|
366 |
|
|
# If there is not an entry for the "relx" value associated with
|
367 |
|
|
# the given "-labelpos" option value, then it invalid.
|
368 |
|
|
#
|
369 |
|
|
if { [catch {set relx $_LAYOUT_TABLE($pos-relx)}] } {
|
370 |
|
|
error "bad labelpos option\"$itk_option(-labelpos)\": should be\
|
371 |
|
|
nw, n, ne, sw, s, se, en, e, es, wn, w, or ws"
|
372 |
|
|
}
|
373 |
|
|
|
374 |
|
|
if {!$dontUpdate} {
|
375 |
|
|
update idletasks
|
376 |
|
|
if {[string compare $_reposition DESTRUCTOR] == 0} {
|
377 |
|
|
# OOPS... We are in the process of being destroyed. Get out of here...
|
378 |
|
|
debug "Stuck in _postionLabel during destruction"
|
379 |
|
|
return
|
380 |
|
|
}
|
381 |
|
|
}
|
382 |
|
|
|
383 |
|
|
$itk_component(label) configure -wraplength $_LAYOUT_TABLE($pos-wrap)
|
384 |
|
|
|
385 |
|
|
# If there is no text in the label, do not add it to the computation.
|
386 |
|
|
|
387 |
|
|
if {$itk_option(-labeltext) == ""} {
|
388 |
|
|
set minsize 0
|
389 |
|
|
if {[place slaves $itk_component(labelFrame)] != ""} {
|
390 |
|
|
place forget $itk_component(label)
|
391 |
|
|
}
|
392 |
|
|
_setMarginThickness 0
|
393 |
|
|
} else {
|
394 |
|
|
set labelWidth [winfo reqwidth $itk_component(label)]
|
395 |
|
|
set labelHeight [winfo reqheight $itk_component(label)]
|
396 |
|
|
set borderwidth $itk_option(-labelborderwidth)
|
397 |
|
|
set margin $itk_option(-labelmargin)
|
398 |
|
|
|
399 |
|
|
switch $pos {
|
400 |
|
|
nw {
|
401 |
|
|
set labelThickness $labelHeight
|
402 |
|
|
set minsize [expr $labelThickness/2.0]
|
403 |
|
|
set xPos [expr $minsize+$borderwidth+$margin]
|
404 |
|
|
set yPos -$minsize
|
405 |
|
|
}
|
406 |
|
|
n {
|
407 |
|
|
set labelThickness $labelHeight
|
408 |
|
|
set minsize [expr $labelThickness/2.0]
|
409 |
|
|
set xPos [expr -$labelWidth/2.0]
|
410 |
|
|
set yPos -$minsize
|
411 |
|
|
}
|
412 |
|
|
ne {
|
413 |
|
|
set labelThickness $labelHeight
|
414 |
|
|
set minsize [expr $labelThickness/2.0]
|
415 |
|
|
set xPos [expr -($minsize+$borderwidth+$margin+$labelWidth)]
|
416 |
|
|
set yPos -$minsize
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
sw {
|
420 |
|
|
set labelThickness $labelHeight
|
421 |
|
|
set minsize [expr $labelThickness/2.0]
|
422 |
|
|
set xPos [expr $minsize+$borderwidth+$margin]
|
423 |
|
|
set yPos -$minsize
|
424 |
|
|
}
|
425 |
|
|
s {
|
426 |
|
|
set labelThickness $labelHeight
|
427 |
|
|
set minsize [expr $labelThickness/2.0]
|
428 |
|
|
set xPos [expr -$labelWidth/2.0]
|
429 |
|
|
set yPos [expr -$labelHeight/2.0]
|
430 |
|
|
}
|
431 |
|
|
se {
|
432 |
|
|
set labelThickness $labelHeight
|
433 |
|
|
set minsize [expr $labelThickness/2.0]
|
434 |
|
|
set xPos [expr -($minsize+$borderwidth+$margin+$labelWidth)]
|
435 |
|
|
set yPos [expr -$labelHeight/2.0]
|
436 |
|
|
}
|
437 |
|
|
|
438 |
|
|
wn {
|
439 |
|
|
set labelThickness $labelWidth
|
440 |
|
|
set minsize [expr $labelThickness/2.0]
|
441 |
|
|
set xPos -$minsize
|
442 |
|
|
set yPos [expr $minsize+$margin+$borderwidth]
|
443 |
|
|
}
|
444 |
|
|
w {
|
445 |
|
|
set labelThickness $labelWidth
|
446 |
|
|
set minsize [expr $labelThickness/2.0]
|
447 |
|
|
set xPos -$minsize
|
448 |
|
|
set yPos [expr -($labelHeight/2.0)]
|
449 |
|
|
}
|
450 |
|
|
ws {
|
451 |
|
|
set labelThickness $labelWidth
|
452 |
|
|
set minsize [expr $labelThickness/2.0]
|
453 |
|
|
set xPos -$minsize
|
454 |
|
|
set yPos [expr -($minsize+$borderwidth+$margin+$labelHeight)]
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
en {
|
458 |
|
|
set labelThickness $labelWidth
|
459 |
|
|
set minsize [expr $labelThickness/2.0]
|
460 |
|
|
set xPos -$minsize
|
461 |
|
|
set yPos [expr $minsize+$borderwidth+$margin]
|
462 |
|
|
}
|
463 |
|
|
e {
|
464 |
|
|
set labelThickness $labelWidth
|
465 |
|
|
set minsize [expr $labelThickness/2.0]
|
466 |
|
|
set xPos -$minsize
|
467 |
|
|
set yPos [expr -($labelHeight/2.0)]
|
468 |
|
|
}
|
469 |
|
|
es {
|
470 |
|
|
set labelThickness $labelWidth
|
471 |
|
|
set minsize [expr $labelThickness/2.0]
|
472 |
|
|
set xPos -$minsize
|
473 |
|
|
set yPos [expr -($minsize+$borderwidth+$margin+$labelHeight)]
|
474 |
|
|
}
|
475 |
|
|
}
|
476 |
|
|
_setMarginThickness $minsize
|
477 |
|
|
|
478 |
|
|
place $itk_component(label) \
|
479 |
|
|
-relx $_LAYOUT_TABLE($pos-relx) -x $xPos \
|
480 |
|
|
-rely $_LAYOUT_TABLE($pos-rely) -y $yPos \
|
481 |
|
|
-anchor nw
|
482 |
|
|
}
|
483 |
|
|
|
484 |
|
|
set what $_LAYOUT_TABLE($pos-conf)
|
485 |
|
|
set number $_LAYOUT_TABLE($pos-num)
|
486 |
|
|
|
487 |
|
|
grid $what $itk_component(labelFrame) $number -minsize $minsize
|
488 |
|
|
|
489 |
|
|
set _reposition ""
|
490 |
|
|
}
|
491 |
|
|
|
492 |
|
|
# -----------------------------------------------------------------------------
|
493 |
|
|
# PROTECTED METHOD: _collapseMargin
|
494 |
|
|
#
|
495 |
|
|
# Resets the "-minsize" of all rows and columns of the labelFrame's grid
|
496 |
|
|
# used to set the label margin to 0
|
497 |
|
|
# -----------------------------------------------------------------------------
|
498 |
|
|
body iwidgets::Labeledframe::_collapseMargin {} {
|
499 |
|
|
grid columnconfigure $itk_component(labelFrame) 0 -minsize 0
|
500 |
|
|
grid columnconfigure $itk_component(labelFrame) 2 -minsize 0
|
501 |
|
|
grid rowconfigure $itk_component(labelFrame) 0 -minsize 0
|
502 |
|
|
grid rowconfigure $itk_component(labelFrame) 2 -minsize 0
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
# -----------------------------------------------------------------------------
|
506 |
|
|
# PROTECTED METHOD: _setMarginThickness
|
507 |
|
|
#
|
508 |
|
|
# Set the margin thickness ( i.e. the hidden "-highlightthickness"
|
509 |
|
|
# of the labelFrame ) to the input value.
|
510 |
|
|
#
|
511 |
|
|
# -----------------------------------------------------------------------------
|
512 |
|
|
body iwidgets::Labeledframe::_setMarginThickness {value} {
|
513 |
|
|
$itk_component(labelFrame) configure -highlightthickness $value
|
514 |
|
|
}
|
515 |
|
|
|
516 |
|
|
|