Changeset 11 for trunk/gui/scripts/scroller.tcl
- Timestamp:
- May 30, 2005, 9:33:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/scroller.tcl
r1 r11 9 9 # ====================================================================== 10 10 # AUTHOR: Michael McLennan, Purdue University 11 # Copyright (c) 2004 Purdue Research Foundation, West Lafayette, IN 11 # Copyright (c) 2004-2005 12 # Purdue Research Foundation, West Lafayette, IN 12 13 # ====================================================================== 13 14 package require Itk … … 32 33 protected method _widget2sbar {which args} 33 34 protected method _fixsbar {which {state ""}} 34 protected method _fixframe { }35 protected method _fixframe {which} 35 36 protected method _lock {option} 36 37 … … 100 101 if {$widget == "frame"} { 101 102 if {$_frame == ""} { 102 set _frame [canvas $itk_component(hull).ifr] 103 bind $_frame <Configure> [itcl::code $this _resizeframe] 103 set _frame [canvas $itk_component(hull).ifr -highlightthickness 0] 104 frame $_frame.f 105 $_frame create window 0 0 -anchor nw -window $_frame.f -tags frame 106 bind $_frame.f <Configure> [itcl::code $this _fixframe inner] 107 bind $_frame <Configure> [itcl::code $this _fixframe outer] 104 108 } 105 109 set widget $_frame … … 119 123 set _contents $widget 120 124 125 if {$widget == $_frame} { 126 return $_frame.f 127 } 121 128 return $widget 122 129 } … … 149 156 itcl::body Rappture::Scroller::_fixsbar {which {state ""}} { 150 157 if {$state == ""} { 151 switch -- $itk_option(-${which}scrollmode){158 switch -- [string tolower $itk_option(-${which}scrollmode)] { 152 159 on - 1 - true - yes { set state 1 } 153 160 off - 0 - false - no { set state 0 } … … 161 168 } 162 169 } 170 default { 171 set state 0 172 } 163 173 } 164 174 } … … 187 197 188 198 # ---------------------------------------------------------------------- 189 # USAGE: _fixframe 199 # USAGE: _fixframe <which> 190 200 # 191 201 # Invoked automatically whenever the canvas representing the "frame" … … 193 203 # to the new size. 194 204 # ---------------------------------------------------------------------- 195 itcl::body Rappture::Scroller::_fixframe {} { 196 $_frame configure -scrollregion [$_frame bbox all] 205 itcl::body Rappture::Scroller::_fixframe {which} { 206 switch -- $which { 207 inner { 208 $_frame configure -scrollregion [$_frame bbox all] 209 } 210 outer { 211 $_frame itemconfigure frame -width [winfo width $_frame] 212 } 213 } 197 214 } 198 215 … … 248 265 itcl::configbody Rappture::Scroller::width { 249 266 if {$itk_option(-width) == "0"} { 267 if {$itk_option(-height) == "0"} { 268 grid propagate $itk_component(hull) yes 269 } else { 270 component hull configure -width 1i 271 } 272 } else { 273 grid propagate $itk_component(hull) no 274 component hull configure -width $itk_option(-width) 275 } 276 } 277 278 # ---------------------------------------------------------------------- 279 # OPTION: -height 280 # ---------------------------------------------------------------------- 281 itcl::configbody Rappture::Scroller::height { 282 if {$itk_option(-height) == "0"} { 250 283 if {$itk_option(-width) == "0"} { 251 284 grid propagate $itk_component(hull) yes 252 285 } else { 253 component hull configure -width 1i254 }255 } else {256 grid propagate $itk_component(hull) no257 component hull configure -width $itk_option(-width)258 }259 }260 261 # ----------------------------------------------------------------------262 # OPTION: -height263 # ----------------------------------------------------------------------264 itcl::configbody Rappture::Scroller::height {265 if {$itk_option(-height) == "0"} {266 if {$itk_option(-height) == "0"} {267 grid propagate $itk_component(hull) yes268 } else {269 286 component hull configure -height 1i 270 287 }
Note: See TracChangeset
for help on using the changeset viewer.