Changeset 5679 for branches/uq/gui/scripts/filelistentry.tcl
- Timestamp:
- Jun 9, 2015 1:55:08 PM (9 years ago)
- Location:
- branches/uq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq
- Property svn:mergeinfo changed
-
branches/uq/gui/scripts/filelistentry.tcl
r4512 r5679 1 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: FileListEntry - widget for entering a choice of strings … … 15 15 16 16 itk::usual BltTreeView { 17 keep -foreground -cursor 17 keep -foreground -cursor 18 18 } 19 19 itk::usual BltScrollset { … … 25 25 26 26 itk_option define -state state State "normal" 27 27 28 28 private variable _rebuildPending 0 29 29 private variable _tree "" … … 32 32 private variable _icon "" 33 33 34 constructor {owner path args} { 35 # defined below 36 } 37 destructor { 38 # defined below 34 constructor {owner path args} { 35 # defined below 36 } 37 destructor { 38 # defined below 39 39 } 40 40 public method value {args} … … 42 42 public method label {} 43 43 public method tooltip {} 44 44 45 45 protected method Rebuild {} 46 46 protected method NewValue { args } … … 98 98 99 99 blt::table $itk_interior \ 100 0,0 $itk_component(scrollset) -fill both 100 0,0 $itk_component(scrollset) -fill both 101 101 bind $itk_component(tree) <<Value>> [itcl::code $this NewValue] 102 102 103 103 # Standard ButtonPress-1 104 $itk_component(tree) bind Entry <ButtonPress-1> { 104 $itk_component(tree) bind Entry <ButtonPress-1> { 105 105 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 106 106 set blt::TreeView::_private(scroll) 1 107 107 } 108 108 # Standard B1-Motion 109 $itk_component(tree) bind Entry <B1-Motion> { 109 $itk_component(tree) bind Entry <B1-Motion> { 110 110 set blt::TreeView::_private(x) %x 111 111 set blt::TreeView::_private(y) %y … … 116 116 $itk_component(tree) button bind all <ButtonRelease-1> { 117 117 set index [%W nearest %x %y blt::TreeView::_private(who)] 118 if { [%W index current] == $index && 118 if { [%W index current] == $index && 119 119 $blt::TreeView::_private(who) == "button" } { 120 120 %W see -anchor nw current … … 123 123 } 124 124 # Shift-ButtonPress-1 125 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 125 $itk_component(tree) bind Entry <Shift-ButtonPress-1> { 126 126 Rappture::FileListEntry::SetSelectionAnchor %W current yes set 127 127 set blt::TreeView::_private(scroll) 1 128 128 } 129 129 # Shift-B1-Motion 130 $itk_component(tree) bind Entry <Shift-B1-Motion> { 130 $itk_component(tree) bind Entry <Shift-B1-Motion> { 131 131 set blt::TreeView::_private(x) %x 132 132 set blt::TreeView::_private(y) %y … … 139 139 } 140 140 # Shift-ButtonRelease-1 141 $itk_component(tree) bind Entry <Shift-ButtonRelease-1> { 141 $itk_component(tree) bind Entry <Shift-ButtonRelease-1> { 142 142 if { [%W cget -selectmode] == "multiple" } { 143 143 %W selection anchor current … … 147 147 set blt::TreeView::_private(scroll) 0 148 148 } 149 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 149 $itk_component(tree) bind Entry <Control-ButtonPress-1> { 150 150 Rappture::FileListEntry::SetSelectionAnchor %W current no toggle 151 151 set blt::TreeView::_private(scroll) 1 152 152 } 153 $itk_component(tree) bind Entry <Control-B1-Motion> { 153 $itk_component(tree) bind Entry <Control-B1-Motion> { 154 154 set blt::TreeView::_private(x) %x 155 155 set blt::TreeView::_private(y) %y … … 161 161 } 162 162 } 163 $itk_component(tree) bind Entry <Control-ButtonRelease-1> { 163 $itk_component(tree) bind Entry <Control-ButtonRelease-1> { 164 164 if { [%W cget -selectmode] == "multiple" } { 165 165 %W selection anchor current … … 170 170 } 171 171 # First time, parse the <pattern> elements to generate notify callbacks 172 # for each template found. 172 # for each template found. 173 173 foreach cname [$_owner xml children -type pattern $_path] { 174 174 set glob [string trim [$_owner xml get $_path.$cname]] … … 224 224 return 225 225 } 226 foreach id [$itk_component(tree) curselection] { 227 set path [$_tree get $id "path" ""] 226 foreach id [$itk_component(tree) curselection] { 227 set path [$_tree get $id "path" ""] 228 228 set path2id($path) $id 229 229 } … … 237 237 # 238 238 set list {} 239 foreach id [$itk_component(tree) curselection] { 240 set path [$_tree get $id "path" ""] 239 foreach id [$itk_component(tree) curselection] { 240 set path [$_tree get $id "path" ""] 241 241 if { $path != "" } { 242 242 lappend list $path … … 330 330 eval $_tree delete [$_tree tag nodes unused] 331 331 $itk_component(tree) configure -width $max 332 catch { 332 catch { 333 333 if { ![$itk_component(tree) selection present] } { 334 334 $itk_component(tree) selection set [$_tree firstchild root] 335 335 } 336 } 336 } 337 337 } 338 338 … … 423 423 } 424 424 425 # 425 # 426 426 # Glob -- 427 427 # 428 # Matches a single pattern for files. This differs from the 428 # Matches a single pattern for files. This differs from the 429 429 # Tcl glob by 430 430 #
Note: See TracChangeset
for help on using the changeset viewer.