⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extfileselectionbox.itk

📁 这是一个Linux下的集成开发环境
💻 ITK
📖 第 1 页 / 共 3 页
字号:
## Extfileselectionbox# ----------------------------------------------------------------------# Implements a file selection box that is a slightly extended version# of the OSF/Motif standard XmExtfileselectionbox composite widget.  # The Extfileselectionbox differs from the Motif standard in that the# filter and selection fields are comboboxes and the files and directory# lists are in a paned window.## ----------------------------------------------------------------------#  AUTHOR: Mark L. Ulferts               EMAIL: mulferts@spd.dsccc.com#          Anthony L. Parent                    tony.parent@symbios.com##  @(#) $Id: extfileselectionbox.itk,v 1.1 2003/02/05 10:54:06 mdejong Exp $# ----------------------------------------------------------------------#            Copyright (c) 1997 DSC Technologies Corporation# ======================================================================# Permission to use, copy, modify, distribute and license this software# and its documentation for any purpose, and without fee or written# agreement with DSC, is hereby granted, provided that the above copyright# notice appears in all copies and that both the copyright notice and# warranty disclaimer below appear in supporting documentation, and that# the names of DSC Technologies Corporation or DSC Communications# Corporation not be used in advertising or publicity pertaining to the# software without specific, written prior permission.## DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS# SOFTWARE.# ======================================================================## Usual options.#itk::usual Extfileselectionbox {    keep -activebackground -activerelief -background -borderwidth -cursor \         -elementborderwidth -foreground -highlightcolor -highlightthickness \         -insertbackground -insertborderwidth -insertofftime -insertontime \         -insertwidth -jump -labelfont -selectbackground -selectborderwidth \         -textbackground -textfont -troughcolor}# ------------------------------------------------------------------#                          EXTFILESELECTIONBOX# ------------------------------------------------------------------class iwidgets::Extfileselectionbox {    inherit itk::Widget    constructor {args} {}    destructor {}    itk_option define -childsitepos childSitePos Position s    itk_option define -fileson filesOn FilesOn true    itk_option define -dirson dirsOn DirsOn true    itk_option define -selectionon selectionOn SelectionOn true    itk_option define -filteron filterOn FilterOn true    itk_option define -mask mask Mask {*}    itk_option define -directory directory Directory {}    itk_option define -nomatchstring noMatchString NoMatchString {}    itk_option define -dirsearchcommand dirSearchCommand Command {}    itk_option define -filesearchcommand fileSearchCommand Command {}    itk_option define -selectioncommand selectionCommand Command {}    itk_option define -filtercommand filterCommand Command {}    itk_option define -selectdircommand selectDirCommand Command {}    itk_option define -selectfilecommand selectFileCommand Command {}    itk_option define -invalid invalid Command {bell}    itk_option define -filetype fileType FileType {regular}    itk_option define -width width Width 350    itk_option define -height height Height 300    public {	method childsite {}	method get {}	method filter {}    }    protected {	method _packComponents {{when later}}	method _updateLists {{when later}}    }    private {	method _selectDir {}	method _dblSelectDir {}	method _selectFile {}	method _selectSelection {}	method _selectFilter {}	method _setFilter {}	method _setSelection {}	method _setDirList {}	method _setFileList {}	method _nPos {}	method _sPos {}	method _ePos {}	method _wPos {}	method _topPos {}	method _bottomPos {}	variable _packToken ""      ;# non-null => _packComponents pending	variable _updateToken ""    ;# non-null => _updateLists pending	variable _pwd "."           ;# present working dir	variable _interior          ;# original interior setting    }}## Provide a lowercased access method for the Extfileselectionbox class.#proc ::iwidgets::extfileselectionbox {pathName args} {    uplevel ::iwidgets::Extfileselectionbox $pathName $args}## Use option database to override default resources of base classes.#option add *Extfileselectionbox.borderWidth 2 widgetDefaultoption add *Extfileselectionbox.filterLabel Filter widgetDefaultoption add *Extfileselectionbox.dirsLabel Directories widgetDefaultoption add *Extfileselectionbox.filesLabel Files widgetDefaultoption add *Extfileselectionbox.selectionLabel Selection widgetDefaultoption add *Extfileselectionbox.width 350 widgetDefaultoption add *Extfileselectionbox.height 300 widgetDefault# ------------------------------------------------------------------#                        CONSTRUCTOR# ------------------------------------------------------------------body iwidgets::Extfileselectionbox::constructor {args} {    #    # Add back to the hull width and height options and make the    # borderwidth zero since we don't need it.    #    itk_option add hull.width hull.height    component hull configure -borderwidth 0    set _interior $itk_interior    #    # Create the filter entry.    #    itk_component add filter {        iwidgets::Combobox $itk_interior.filter -unique true \	    -command [code $this _selectFilter] -exportselection 0 \	    -labelpos nw -completion 0	    } {	usual        rename -labeltext -filterlabel filterLabel Text    }    set cmd [$itk_component(filter) cget -command]    set cmd "$cmd;[code $this _selectFilter]"    $itk_component(filter) configure -command "$cmd" -selectioncommand "$cmd";    #    # Create a paned window for the directory and file lists.    #    itk_component add listpane {      iwidgets::Panedwindow $itk_interior.listpane -orient vertical    }     $itk_component(listpane) add dirs -margin 5    $itk_component(listpane) add files -margin 5    #    # Create the directory list.    #    itk_component add dirs {        iwidgets::Scrolledlistbox [$itk_component(listpane) childsite dirs].dirs \	    -selectioncommand [code $this _selectDir] \	    -selectmode single -exportselection 0 \	    -visibleitems 1x1 -labelpos nw \	    -hscrollmode static -vscrollmode static \	    -dblclickcommand [code $this _dblSelectDir]    } {	usual        rename -labeltext -dirslabel dirsLabel Text    }    grid $itk_component(dirs) -sticky nsew    grid rowconfigure [$itk_component(listpane) childsite dirs] 0 -weight 1    grid columnconfigure [$itk_component(listpane) childsite dirs] 0 -weight 1    #    # Create the files list.    #    itk_component add files {        iwidgets::Scrolledlistbox [$itk_component(listpane) childsite files].files \	    -selectioncommand [code $this _selectFile] \	    -selectmode single -exportselection 0 \	    -visibleitems 1x1 -labelpos nw \	    -hscrollmode static -vscrollmode static    } {	usual        rename -labeltext -fileslabel filesLabel Text    }    grid $itk_component(files) -sticky nsew    grid rowconfigure [$itk_component(listpane) childsite files] 0 -weight 1    grid columnconfigure [$itk_component(listpane) childsite files] 0 -weight 1    #    # Create the selection entry.    #    itk_component add selection {      iwidgets::Combobox $itk_interior.selection -unique true \	  -command [code $this _selectSelection] -exportselection 0 \	  -labelpos nw -completion 0    } {	usual        rename -labeltext -selectionlabel selectionLabel Text    }    #    # Create the child site widget.    #    itk_component add -protected childsite {        frame $itk_interior.fsbchildsite    }     #    # Set the interior variable to the childsite for derived classes.    #    set itk_interior $itk_component(childsite)    #    # Explicitly handle configs that may have been ignored earlier.    #    eval itk_initialize $args    #    # When idle, pack the childsite and update the lists.    #    _packComponents    _updateLists}# ------------------------------------------------------------------#                           DESTRUCTOR# ------------------------------------------------------------------body iwidgets::Extfileselectionbox::destructor {} {    if {$_packToken != ""} {after cancel $_packToken}    if {$_updateToken != ""} {after cancel $_updateToken}}# ------------------------------------------------------------------#                             OPTIONS# ------------------------------------------------------------------# ------------------------------------------------------------------# OPTION: -childsitepos## Specifies the position of the child site in the selection box.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::childsitepos {    _packComponents}# ------------------------------------------------------------------# OPTION: -fileson## Specifies whether or not to display the files list.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::fileson {    if {$itk_option(-fileson)} {	$itk_component(listpane) show files	_updateLists    } else {	$itk_component(listpane) hide files    }}# ------------------------------------------------------------------# OPTION: -dirson## Specifies whether or not to display the dirs list.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::dirson {    if {$itk_option(-dirson)} {	$itk_component(listpane) show dirs	_updateLists    } else {	$itk_component(listpane) hide dirs    }}# ------------------------------------------------------------------# OPTION: -selectionon## Specifies whether or not to display the selection entry widget.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::selectionon {    _packComponents}# ------------------------------------------------------------------# OPTION: -filteron## Specifies whether or not to display the filter entry widget.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::filteron {    _packComponents}# ------------------------------------------------------------------# OPTION: -mask## Specifies the initial file mask string.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::mask {    global tcl_platform    set prefix $_pwd    #    # Remove automounter paths.    #    if {$tcl_platform(platform) == "unix"} {	    regsub {^/(tmp_mnt|export)} $prefix {} prefix;    }    set curFilter $itk_option(-mask);    $itk_component(filter) delete entry 0 end    $itk_component(filter) insert entry 0 [file join $_pwd $itk_option(-mask)]    #    # Make sure the right most text is visable.    #    [$itk_component(filter) component entry] xview moveto 1}# ------------------------------------------------------------------# OPTION: -directory## Specifies the initial default directory.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::directory {    if {$itk_option(-directory) != {}} {        if {! [file exists $itk_option(-directory)]} {            error "bad directory option \"$itk_option(-directory)\":\                    directory does not exist"        }        set olddir [pwd]        cd $itk_option(-directory)        set _pwd [pwd]        cd $olddir        configure -mask $itk_option(-mask)        _selectFilter    }}# ------------------------------------------------------------------# OPTION: -nomatchstring## Specifies the string to be displayed in the files list should# not regular files exist in the directory.# ------------------------------------------------------------------configbody iwidgets::Extfileselectionbox::nomatchstring {}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -