1 |
578 |
markom |
#
|
2 |
|
|
# Cygnus enhanced version of the iwidget Pane class
|
3 |
|
|
# ----------------------------------------------------------------------
|
4 |
|
|
# Implements a pane for a paned window widget. The pane is itself a
|
5 |
|
|
# frame with a child site for other widgets. The pane class performs
|
6 |
|
|
# basic option management.
|
7 |
|
|
#
|
8 |
|
|
# ----------------------------------------------------------------------
|
9 |
|
|
# AUTHOR: Mark L. Ulferts EMAIL: mulferts@austin.dsccc.com
|
10 |
|
|
#
|
11 |
|
|
# @(#) $Id: pane.tcl,v 1.1.1.1 2002-01-16 10:24:52 markom Exp $
|
12 |
|
|
# ----------------------------------------------------------------------
|
13 |
|
|
# Copyright (c) 1995 DSC Technologies Corporation
|
14 |
|
|
# ======================================================================
|
15 |
|
|
# Permission to use, copy, modify, distribute and license this software
|
16 |
|
|
# and its documentation for any purpose, and without fee or written
|
17 |
|
|
# agreement with DSC, is hereby granted, provided that the above copyright
|
18 |
|
|
# notice appears in all copies and that both the copyright notice and
|
19 |
|
|
# warranty disclaimer below appear in supporting documentation, and that
|
20 |
|
|
# the names of DSC Technologies Corporation or DSC Communications
|
21 |
|
|
# Corporation not be used in advertising or publicity pertaining to the
|
22 |
|
|
# software without specific, written prior permission.
|
23 |
|
|
#
|
24 |
|
|
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
25 |
|
|
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
|
26 |
|
|
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
|
27 |
|
|
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
28 |
|
|
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
|
29 |
|
|
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
30 |
|
|
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
31 |
|
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
|
32 |
|
|
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
33 |
|
|
# SOFTWARE.
|
34 |
|
|
# ======================================================================
|
35 |
|
|
|
36 |
|
|
#
|
37 |
|
|
# Usual options.
|
38 |
|
|
#
|
39 |
|
|
itk::usual Pane {
|
40 |
|
|
keep -background -cursor
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
# ------------------------------------------------------------------
|
44 |
|
|
# PANE
|
45 |
|
|
# ------------------------------------------------------------------
|
46 |
|
|
class cyg::Pane {
|
47 |
|
|
inherit itk::Widget
|
48 |
|
|
|
49 |
|
|
constructor {args} {}
|
50 |
|
|
|
51 |
|
|
itk_option define -maximum maximum Maximum 0
|
52 |
|
|
itk_option define -minimum minimum Minimum 10
|
53 |
|
|
itk_option define -margin margin Margin 0
|
54 |
|
|
itk_option define -resizable resizable Resizable 1
|
55 |
|
|
|
56 |
|
|
public method childSite {} {}
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
#
|
60 |
|
|
# Provide a lowercased access method for the Pane class.
|
61 |
|
|
#
|
62 |
|
|
proc ::cyg::pane {pathName args} {
|
63 |
|
|
uplevel ::cyg::Pane $pathName $args
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
# ------------------------------------------------------------------
|
67 |
|
|
# CONSTRUCTOR
|
68 |
|
|
# ------------------------------------------------------------------
|
69 |
|
|
body cyg::Pane::constructor {args} {
|
70 |
|
|
#
|
71 |
|
|
# Create the pane childsite.
|
72 |
|
|
#
|
73 |
|
|
itk_component add childsite {
|
74 |
|
|
frame $itk_interior.childsite
|
75 |
|
|
} {
|
76 |
|
|
keep -background -cursor
|
77 |
|
|
}
|
78 |
|
|
pack $itk_component(childsite) -fill both -expand yes
|
79 |
|
|
|
80 |
|
|
#
|
81 |
|
|
# Set the itk_interior variable to be the childsite for derived
|
82 |
|
|
# classes.
|
83 |
|
|
#
|
84 |
|
|
set itk_interior $itk_component(childsite)
|
85 |
|
|
|
86 |
|
|
eval itk_initialize $args
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
# ------------------------------------------------------------------
|
90 |
|
|
# OPTIONS
|
91 |
|
|
# ------------------------------------------------------------------
|
92 |
|
|
|
93 |
|
|
# ------------------------------------------------------------------
|
94 |
|
|
# OPTION: -minimum
|
95 |
|
|
#
|
96 |
|
|
# Specifies the minimum size that the pane may reach.
|
97 |
|
|
# ------------------------------------------------------------------
|
98 |
|
|
configbody cyg::Pane::minimum {
|
99 |
|
|
set pixels [winfo pixels $itk_component(hull) $itk_option(-minimum)]
|
100 |
|
|
set $itk_option(-minimum) $pixels
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
# ------------------------------------------------------------------
|
104 |
|
|
# OPTION: -maximum
|
105 |
|
|
#
|
106 |
|
|
# Specifies the maximum size that the pane may reach.
|
107 |
|
|
# ------------------------------------------------------------------
|
108 |
|
|
configbody cyg::Pane::maximum {
|
109 |
|
|
set pixels [winfo pixels $itk_component(hull) $itk_option(-maximum)]
|
110 |
|
|
set $itk_option(-maximum) $pixels
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
# ------------------------------------------------------------------
|
114 |
|
|
# OPTION: -margin
|
115 |
|
|
#
|
116 |
|
|
# Specifies the border distance between the pane and pane contents.
|
117 |
|
|
# This is done by setting the borderwidth of the pane to the margin.
|
118 |
|
|
# ------------------------------------------------------------------
|
119 |
|
|
configbody cyg::Pane::margin {
|
120 |
|
|
set pixels [winfo pixels $itk_component(hull) $itk_option(-margin)]
|
121 |
|
|
set itk_option(-margin) $pixels
|
122 |
|
|
$itk_component(childsite) configure -borderwidth $itk_option(-margin)
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
# ------------------------------------------------------------------
|
126 |
|
|
# METHODS
|
127 |
|
|
# ------------------------------------------------------------------
|
128 |
|
|
|
129 |
|
|
# ------------------------------------------------------------------
|
130 |
|
|
# METHOD: childSite
|
131 |
|
|
#
|
132 |
|
|
# Return the pane child site path name.
|
133 |
|
|
# ------------------------------------------------------------------
|
134 |
|
|
body cyg::Pane::childSite {} {
|
135 |
|
|
return $itk_component(childsite)
|
136 |
|
|
}
|