source: trunk/gui/scripts/groupentry.tcl @ 22

Last change on this file since 22 was 22, checked in by mmc, 17 years ago

Lots of changes to support Huckel-IV:

  • Support for embedded <tool> declarations
  • New <integer> entry
  • Support for numbers and structures as output elements
  • Atom numbers/symbols in MoleculeViewer?
File size: 3.0 KB
Line 
1# ----------------------------------------------------------------------
2#  COMPONENT: GroupEntry - widget containing a group of controls
3#
4#  This widget represents a <group> entry on a control panel.
5#  It contains a series of other controls.  Sort of a glorified
6#  frame widget.
7# ======================================================================
8#  AUTHOR:  Michael McLennan, Purdue University
9#  Copyright (c) 2004-2005
10#  Purdue Research Foundation, West Lafayette, IN
11# ======================================================================
12package require Itk
13
14itcl::class Rappture::GroupEntry {
15    inherit itk::Widget
16
17    constructor {owner path args} { # defined below }
18
19    public method value {args}
20
21    public method label {}
22    public method tooltip {}
23
24    private variable _owner ""    ;# thing managing this control
25    private variable _path ""     ;# path in XML to this number
26}
27
28itk::usual GroupEntry {
29    keep -cursor -font
30    keep -foreground -background
31    keep -textbackground
32    keep -selectbackground -selectforeground -selectborderwidth
33}
34
35# ----------------------------------------------------------------------
36# CONSTRUCTOR
37# ----------------------------------------------------------------------
38itcl::body Rappture::GroupEntry::constructor {owner path args} {
39    if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} {
40        error "bad object \"$owner\": should be Rappture::ControlOwner"
41    }
42    set _owner $owner
43    set _path $path
44
45    eval itk_initialize $args
46}
47
48# ----------------------------------------------------------------------
49# USAGE: value ?-check? ?<newval>?
50#
51# Clients use this to query/set the value for this widget.  With
52# no args, it returns the current value for the widget.  If the
53# <newval> is specified, it sets the value of the widget and
54# sends a <<Value>> event.  If the -check flag is included, the
55# new value is not actually applied, but just checked for correctness.
56# ----------------------------------------------------------------------
57itcl::body Rappture::GroupEntry::value {args} {
58    # groups have no value
59    return ""
60}
61
62# ----------------------------------------------------------------------
63# USAGE: label
64#
65# Clients use this to query the label associated with this widget.
66# Reaches into the XML and pulls out the appropriate label string.
67# ----------------------------------------------------------------------
68itcl::body Rappture::GroupEntry::label {} {
69    return [$_owner xml get $_path.about.label]
70}
71
72# ----------------------------------------------------------------------
73# USAGE: tooltip
74#
75# Clients use this to query the tooltip associated with this widget.
76# Reaches into the XML and pulls out the appropriate description
77# string.  Returns the string that should be used with the
78# Rappture::Tooltip facility.
79# ----------------------------------------------------------------------
80itcl::body Rappture::GroupEntry::tooltip {} {
81    return [$_owner xml get $_path.about.description]
82}
Note: See TracBrowser for help on using the repository browser.