📄 fileselectionbox.itk
字号:
# PRIVATE METHOD: _selectFilter## The user has pressed Return in the filter entry widget. Call the# defined selection command if it exists, otherwise just filter.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_selectFilter {} { if {$itk_option(-filtercommand) != {}} { uplevel #0 $itk_option(-filtercommand) } else { filter }}# ------------------------------------------------------------------# PRIVATE METHOD: _packComponents## Pack the selection, items, and child site widgets based on options.# Using the -in option of pack, put the childsite around the frame# in the hull for n, s, e, and w positions. Make sure and raise # the child site since using the 'in' option may obscure the site.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_packComponents {{when "later"}} { if {$when == "later"} { if {$_packToken == ""} { set _packToken [after idle [code $this _packComponents now]] } return } elseif {$when != "now"} { error "bad option \"$when\": should be now or later" } set _packToken "" # # Forget about any previous placements via the grid and # reset all the possible minsizes and weights for all # the rows and columns. # foreach component {childsite filter dirs files selection} { grid forget $itk_component($component) } for {set row 0} {$row < 6} {incr row} { grid rowconfigure $_interior $row -minsize 0 -weight 0 } for {set col 0} {$col < 4} {incr col} { grid columnconfigure $_interior $col -minsize 0 -weight 0 } # # Place all the components based on the childsite poisition # option. # switch $itk_option(-childsitepos) { n { _nPos } w { _wPos } s { _sPos } e { _ePos } center { _centerPos } top { _topPos } bottom { _bottomPos } default { error "bad childsitepos option \"$itk_option(-childsitepos)\":\ should be n, e, s, w, center, top, or bottom" } }}# ------------------------------------------------------------------# PRIVATE METHOD: _nPos## Position the childsite to the north and all the other components# appropriately based on the individual "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_nPos {} { grid $itk_component(childsite) -row 0 -column 0 \ -columnspan 3 -rowspan 1 -sticky nsew if {$itk_option(-filteron)} { grid $itk_component(filter) -row 1 -column 0 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 2 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 3 -column 0 \ -columnspan 1 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 3 -column 2 \ -columnspan 1 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 1 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 0 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 0 } } grid rowconfigure $_interior 3 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 4 -minsize 7 grid $itk_component(selection) -row 5 -column 0 \ -columnspan 3 -sticky ew } grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1}# ------------------------------------------------------------------# PRIVATE METHOD: _sPos## Position the childsite to the south and all the other components# appropriately based on the individual "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_sPos {} { if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 0 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 1 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 0 \ -columnspan 1 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 2 \ -columnspan 1 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 1 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 0 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 0 } } grid rowconfigure $_interior 2 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 3 -minsize 7 grid $itk_component(selection) -row 4 -column 0 \ -columnspan 3 -sticky ew } grid $itk_component(childsite) -row 5 -column 0 \ -columnspan 3 -rowspan 1 -sticky nsew grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1}# ------------------------------------------------------------------# PRIVATE METHOD: _ePos## Position the childsite to the east and all the other components# appropriately based on the individual "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_ePos {} { if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 0 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 1 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 0 \ -columnspan 1 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 2 \ -columnspan 1 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 1 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 0 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 0 } } grid rowconfigure $_interior 2 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 3 -minsize 7 grid $itk_component(selection) -row 4 -column 0 \ -columnspan 3 -sticky ew } grid $itk_component(childsite) -row 0 -column 3 \ -rowspan 5 -columnspan 1 -sticky nsew grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1}# ------------------------------------------------------------------# PRIVATE METHOD: _wPos## Position the childsite to the west and all the other components# appropriately based on the individual "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_wPos {} { grid $itk_component(childsite) -row 0 -column 0 \ -rowspan 5 -columnspan 1 -sticky nsew if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 1 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 1 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 1 \ -columnspan 1 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 3 \ -columnspan 1 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 2 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 1 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 1 } } grid rowconfigure $_interior 2 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 3 -minsize 7 grid $itk_component(selection) -row 4 -column 1 \ -columnspan 3 -sticky ew } grid columnconfigure $_interior 1 -weight 1 grid columnconfigure $_interior 3 -weight 1}# ------------------------------------------------------------------# PRIVATE METHOD: _topPos## Position the childsite below the filter but above the lists and # all the other components appropriately based on the individual # "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_topPos {} { if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 0 \ -columnspan 3 -sticky ew } grid $itk_component(childsite) -row 1 -column 0 \ -columnspan 3 -rowspan 1 -sticky nsew if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 0 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 2 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 1 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 0 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 0 } } grid rowconfigure $_interior 2 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 3 -minsize 7 grid $itk_component(selection) -row 4 -column 0 \ -columnspan 3 -sticky ew } grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1}# ------------------------------------------------------------------# PRIVATE METHOD: _centerPos## Position the childsite between the lists and all the other # components appropriately based on the individual "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_centerPos {} { if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 0 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 1 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 0 \ -columnspan 1 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 2 \ -columnspan 1 -sticky nsew } grid $itk_component(childsite) -row 2 \ -columnspan 1 -rowspan 1 -sticky nsew if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid configure $itk_component(childsite) -column 1 grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1 } else { grid configure $itk_component(dirs) -columnspan 2 -column 0 grid configure $itk_component(childsite) -column 2 grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 1 -weight 1 } } else { grid configure $itk_component(childsite) -column 0 if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 2 \ -column 1 grid columnconfigure $_interior 1 -weight 1 grid columnconfigure $_interior 2 -weight 1 } else { grid columnconfigure $_interior 0 -weight 1 } } grid rowconfigure $_interior 2 -weight 1 if {$itk_option(-selectionon)} { grid rowconfigure $_interior 3 -minsize 7 grid $itk_component(selection) -row 4 -column 0 \ -columnspan 3 -sticky ew }}# ------------------------------------------------------------------# PRIVATE METHOD: _bottomPos## Position the childsite below the lists and above the selection# and all the other components appropriately based on the individual # "on" options.# ------------------------------------------------------------------body iwidgets::Fileselectionbox::_bottomPos {} { if {$itk_option(-filteron)} { grid $itk_component(filter) -row 0 -column 0 \ -columnspan 3 -sticky ew grid rowconfigure $_interior 1 -minsize 7 } if {$itk_option(-dirson)} { grid $itk_component(dirs) -row 2 -column 0 -sticky nsew } if {$itk_option(-fileson)} { grid $itk_component(files) -row 2 -column 2 -sticky nsew } if {$itk_option(-dirson)} { if {$itk_option(-fileson)} { grid columnconfigure $_interior 1 -minsize 7 } else { grid configure $itk_component(dirs) -columnspan 3 -column 0 } } else { if {$itk_option(-fileson)} { grid configure $itk_component(files) -columnspan 3 -column 0 } } grid rowconfigure $_interior 2 -weight 1 grid $itk_component(childsite) -row 3 -column 0 \ -columnspan 3 -rowspan 1 -sticky nsew if {$itk_option(-selectionon)} { grid $itk_component(selection) -row 4 -column 0 \ -columnspan 3 -sticky ew } grid columnconfigure $_interior 0 -weight 1 grid columnconfigure $_interior 2 -weight 1}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -