1# 2# Paned 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.itk,v 1.3 2001/08/07 19:56:48 smithc 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# 39itk::usual Pane { 40 keep -background -cursor 41} 42 43# ------------------------------------------------------------------ 44# PANE 45# ------------------------------------------------------------------ 46itcl::class iwidgets::Pane { 47 inherit itk::Widget 48 49 constructor {args} {} 50 51 itk_option define -minimum minimum Minimum 10 52 itk_option define -margin margin Margin 8 53 54 public method childSite {} {} 55} 56 57# 58# Provide a lowercased access method for the Pane class. 59# 60proc ::iwidgets::pane {pathName args} { 61 uplevel ::iwidgets::Pane $pathName $args 62} 63 64# ------------------------------------------------------------------ 65# CONSTRUCTOR 66# ------------------------------------------------------------------ 67itcl::body iwidgets::Pane::constructor {args} { 68 # 69 # Create the pane childsite. 70 # 71 itk_component add childsite { 72 frame $itk_interior.childsite 73 } { 74 keep -background -cursor 75 } 76 pack $itk_component(childsite) -fill both -expand yes 77 78 # 79 # Set the itk_interior variable to be the childsite for derived 80 # classes. 81 # 82 set itk_interior $itk_component(childsite) 83 84 eval itk_initialize $args 85} 86 87# ------------------------------------------------------------------ 88# OPTIONS 89# ------------------------------------------------------------------ 90 91# ------------------------------------------------------------------ 92# OPTION: -minimum 93# 94# Specifies the minimum size that the pane may reach. 95# ------------------------------------------------------------------ 96itcl::configbody iwidgets::Pane::minimum { 97 set pixels \ 98 [winfo pixels $itk_component(hull) $itk_option(-minimum)] 99 100 set itk_option(-minimum) $pixels 101} 102 103# ------------------------------------------------------------------ 104# OPTION: -margin 105# 106# Specifies the border distance between the pane and pane contents. 107# This is done by setting the borderwidth of the pane to the margin. 108# ------------------------------------------------------------------ 109itcl::configbody iwidgets::Pane::margin { 110 set pixels [winfo pixels $itk_component(hull) $itk_option(-margin)] 111 set itk_option(-margin) $pixels 112 113 $itk_component(childsite) configure \ 114 -borderwidth $itk_option(-margin) 115} 116 117# ------------------------------------------------------------------ 118# METHODS 119# ------------------------------------------------------------------ 120 121# ------------------------------------------------------------------ 122# METHOD: childSite 123# 124# Return the pane child site path name. 125# ------------------------------------------------------------------ 126itcl::body iwidgets::Pane::childSite {} { 127 return $itk_component(childsite) 128} 129