Changeset 1725
- Timestamp:
- May 20, 2010 8:27:02 AM (14 years ago)
- Location:
- branches/blt4/gui/scripts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/flowvisviewer.tcl
r1719 r1725 169 169 } 170 170 171 itk::usual TkPushbutton { 172 } 173 171 174 # ---------------------------------------------------------------------- 172 175 # CONSTRUCTOR … … 301 304 302 305 itk_component add volume { 303 Rappture::PushButton $f.volume \306 blt::tk::pushbutton $f.volume \ 304 307 -onimage [Rappture::icon volume-on] \ 305 308 -offimage [Rappture::icon volume-off] \ … … 387 390 # Play 388 391 itk_component add play { 389 Rappture::PushButton $itk_component(flowcontrols).play \392 blt::tk::pushbutton $itk_component(flowcontrols).play \ 390 393 -onimage [Rappture::icon flow-pause] \ 391 394 -offimage [Rappture::icon flow-play] \ … … 399 402 # Loop 400 403 itk_component add loop { 401 Rappture::PushButton $itk_component(flowcontrols).loop \404 blt::tk::pushbutton $itk_component(flowcontrols).loop \ 402 405 -onimage [Rappture::icon flow-loop] \ 403 406 -offimage [Rappture::icon flow-loop] \ … … 2250 2253 # X-value slicer... 2251 2254 itk_component add xCutButton { 2252 Rappture::PushButton $inner.xbutton \2255 blt::tk::pushbutton $inner.xbutton \ 2253 2256 -onimage [Rappture::icon x-cutplane] \ 2254 2257 -offimage [Rappture::icon x-cutplane] \ … … 2277 2280 # Y-value slicer... 2278 2281 itk_component add yCutButton { 2279 Rappture::PushButton $inner.ybutton \2282 blt::tk::pushbutton $inner.ybutton \ 2280 2283 -onimage [Rappture::icon y-cutplane] \ 2281 2284 -offimage [Rappture::icon y-cutplane] \ … … 2304 2307 # Z-value slicer... 2305 2308 itk_component add zCutButton { 2306 Rappture::PushButton $inner.zbutton \2309 blt::tk::pushbutton $inner.zbutton \ 2307 2310 -onimage [Rappture::icon z-cutplane] \ 2308 2311 -offimage [Rappture::icon z-cutplane] \ -
branches/blt4/gui/scripts/heightmapviewer.tcl
r1719 r1725 109 109 keep -plotbackground -plotforeground 110 110 } 111 itk::usual TkPushbutton { 112 } 111 113 112 114 # ---------------------------------------------------------------------- … … 216 218 217 219 itk_component add surface { 218 Rappture::PushButton $f.surface \220 blt::tk::pushbutton $f.surface \ 219 221 -onimage [Rappture::icon volume-on] \ 220 222 -offimage [Rappture::icon volume-off] \ -
branches/blt4/gui/scripts/molvisviewer.tcl
r1719 r1725 141 141 itk::usual MolvisViewer { 142 142 keep -background -foreground -cursor -font 143 } 144 itk::usual TkPushbutton { 143 145 } 144 146 … … 263 265 264 266 itk_component add labels { 265 Rappture::PushButton $f.labels \267 blt::tk::pushbutton $f.labels \ 266 268 -onimage [Rappture::icon molvis-labels-view] \ 267 269 -offimage [Rappture::icon molvis-labels-view] \ … … 275 277 276 278 itk_component add rock { 277 Rappture::PushButton $f.rock \279 blt::tk::pushbutton $f.rock \ 278 280 -onimage [Rappture::icon molvis-rock-view] \ 279 281 -offimage [Rappture::icon molvis-rock-view] \ -
branches/blt4/gui/scripts/nanovisviewer.tcl
r1719 r1725 161 161 keep -plotbackground -plotforeground 162 162 } 163 itk::usual TkPushbutton { 164 } 163 165 164 166 # ---------------------------------------------------------------------- … … 267 269 268 270 itk_component add volume { 269 Rappture::PushButton $f.volume \271 blt::tk::pushbutton $f.volume \ 270 272 -onimage [Rappture::icon volume-on] \ 271 273 -offimage [Rappture::icon volume-off] \ -
branches/blt4/gui/scripts/pushbutton.tcl
r1670 r1725 38 38 public method select {} 39 39 public method toggle {} 40 public method disable {} 41 public method enable {} 40 42 41 43 protected method _fixValue {args} 42 44 43 45 private variable _state 0 44 public variable command ""; # Command to be invoked 45 private variable _variable ""; # Variable to be set. 46 public variable onimage ""; # Image displayed when selected 47 public variable offimage ""; # Image displayed when deselected. 48 public variable onvalue "1"; # Value set when selected. 49 public variable offvalue "0"; # Value set when deselected. 46 private variable _enabled 1 47 public variable command ""; # Command to be invoked 48 private variable _variable ""; # Variable to be set. 49 public variable onimage ""; # Image displayed when selected 50 public variable offimage ""; # Image displayed when deselected. 51 public variable disabledimage ""; # Image displayed when deselected. 52 public variable onvalue "1"; # Value set when selected. 53 public variable offvalue "0"; # Value set when deselected. 50 54 } 51 55 … … 60 64 itcl::body Rappture::PushButton::constructor {args} { 61 65 itk_component add button { 62 66 label $itk_interior.button -borderwidth 1 -relief sunken 63 67 } { 64 65 68 usual 69 ignore -padx -pady -relief -borderwidth -background 66 70 } 67 71 bind $itk_component(button) <ButtonPress> \ … … 72 76 } 73 77 74 # ---------------------------------------------------------------------- 75 # CONSTRUCTOR 76 # ---------------------------------------------------------------------- 77 itcl::body Rappture::PushButton::destructor {} { 78 if {"" != $_variable} { 79 upvar #0 $_variable var 80 trace remove variable var write [itcl::code $this _fixValue] 78 itcl::body Rappture::PushButton::invoke {} { 79 if { !$_enabled } { 80 puts "in invoke button not enabled" 81 return 81 82 } 82 }83 84 itcl::body Rappture::PushButton::invoke {} {85 83 toggle 86 84 if { $command != "" } { 87 85 uplevel \#0 $command 88 86 } 89 87 } 90 88 91 89 itcl::body Rappture::PushButton::toggle {} { 90 if { !$_enabled } { 91 return 92 } 92 93 set _state [expr !$_state] 93 94 if { $_state } { 94 95 select 95 96 } else { 96 deselect 97 deselect 98 } 99 } 100 101 itcl::body Rappture::PushButton::disable {} { 102 if { $_enabled } { 103 set _enabled [expr !$_enabled] 104 $itk_component(button) configure -relief raise \ 105 -image $disabledimage -bg grey85 106 } 107 } 108 109 itcl::body Rappture::PushButton::enable {} { 110 if { !$_enabled } { 111 set _enabled [expr !$_enabled] 112 _fixValue 97 113 } 98 114 } … … 107 123 itcl::body Rappture::PushButton::_fixValue {args} { 108 124 if {"" == $itk_option(-variable)} { 109 125 return 110 126 } 111 127 upvar #0 $itk_option(-variable) var … … 125 141 126 142 itcl::body Rappture::PushButton::select {} { 143 if { !$_enabled } { 144 return 145 } 127 146 upvar #0 $_variable state 128 147 set state $onvalue … … 130 149 131 150 itcl::body Rappture::PushButton::deselect {} { 151 if { !$_enabled } { 152 return 153 } 132 154 upvar #0 $_variable state 133 155 set state $offvalue -
branches/blt4/gui/scripts/xyprint.tcl
r1719 r1725 809 809 "Set the size (points) of the font." 810 810 811 Rappture::PushButton $page.fontweight \811 blt::tk::pushbutton $page.fontweight \ 812 812 -width 18 -height 18 \ 813 813 -onimage [Rappture::icon font-bold] \ … … 819 819 "Use the bold version of the font." 820 820 821 Rappture::PushButton $page.fontslant \821 blt::tk::pushbutton $page.fontslant \ 822 822 -width 18 -height 18 \ 823 823 -onimage [Rappture::icon font-italic] \ … … 962 962 "Set the size (points) of the tick font." 963 963 964 Rappture::PushButton $page.tickfontweight \964 blt::tk::pushbutton $page.tickfontweight \ 965 965 -width 18 -height 18 \ 966 966 -onimage [Rappture::icon font-bold] \ … … 972 972 "Use the bold version of the tick font." 973 973 974 Rappture::PushButton $page.tickfontslant \974 blt::tk::pushbutton $page.tickfontslant \ 975 975 -width 18 -height 18 \ 976 976 -onimage [Rappture::icon font-italic] \ … … 1009 1009 "Set the size (point) of the title font." 1010 1010 1011 Rappture::PushButton $page.titlefontweight \1011 blt::tk::pushbutton $page.titlefontweight \ 1012 1012 -width 18 -height 18 \ 1013 1013 -onimage [Rappture::icon font-bold] \ … … 1019 1019 "Use the bold version of the title font." 1020 1020 1021 Rappture::PushButton $page.titlefontslant \1021 blt::tk::pushbutton $page.titlefontslant \ 1022 1022 -width 18 -height 18 \ 1023 1023 -onimage [Rappture::icon font-italic] \
Note: See TracChangeset
for help on using the changeset viewer.