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

📄 disjointlistbox.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 2 页
字号:
# Purpose: Retrieve the items of the right Listbox widget#itcl::body ::iwidgets::Disjointlistbox::getrhs {{first 0} {last end}} {    return [rhs get $first $last]}# ------------------------------------------------------------------# Method: insertrhs## Purpose: Insert items into the right Listbox widget#itcl::body ::iwidgets::Disjointlistbox::insertrhs {items} {    remove $itk_component(lhs) $items    insert rhs $items}# ------------------------------------------------------------------# Method: insertlhs## Purpose: Insert items into the left Listbox widget#itcl::body ::iwidgets::Disjointlistbox::insertlhs {items} {    remove $itk_component(rhs) $items    insert lhs $items}# ------------------------------------------------------------------# Method:  clear## Purpose: Remove the items from the Listbox widgets and set the item count#          Labels text to 0#itcl::body ::iwidgets::Disjointlistbox::clear {} {    lhs clear    rhs clear    showCount}# ------------------------------------------------------------------# Method: insert## Purpose: Insert the input items into the input Listbox widget while#          maintaining the disjoint property between them.#itcl::body ::iwidgets::Disjointlistbox::insert {theListbox items} {    set curritems [$theListbox get 0 end]    foreach item $items {        #        # if the item is not already present in the Listbox then insert it        #        if {[lsearch -exact $curritems $item] == -1} {            $theListbox insert end $item        }    }    if {![string equal $itk_option(-${theListbox}sortoption) "none"]} {        $theListbox sort $itk_option(-${theListbox}sortoption)    }    showCount}# ------------------------------------------------------------------# Method: remove## Purpose: Remove the input items from the input Listbox widget while#          maintaining the disjoint property between them.#itcl::body ::iwidgets::Disjointlistbox::remove {theListbox items} {    set indexes {}    set curritems [$theListbox get 0 end]    foreach item $items {        #        # if the item is in the listbox then add its index to the index list        #         if {[set index [lsearch -exact $curritems $item]] != -1} {            lappend indexes $index        }    }    foreach index [lsort -integer -decreasing $indexes] {        $theListbox delete $index    }    showCount}# ------------------------------------------------------------------# Method: showCount## Purpose: Set the text of the item count Labels.#itcl::body ::iwidgets::Disjointlistbox::showCount {} {    $itk_component(lhsCount) config -text "item count: [lhs size]"    $itk_component(rhsCount) config -text "item count: [rhs size]"}# ------------------------------------------------------------------# METHOD: setlhs## Set the items of the left-most Listbox with the input list# option.  Remove all (if any) items from the right-most Listbox# which exist in the input list option to maintain the disjoint# property between the two#itcl::body ::iwidgets::Disjointlistbox::setlhs {items} {    lhs clear    insertlhs $items}# ------------------------------------------------------------------# METHOD: setrhs## Set the items of the right-most Listbox with the input list# option.  Remove all (if any) items from the left-most Listbox# which exist in the input list option to maintain the disjoint# property between the two#itcl::body ::iwidgets::Disjointlistbox::setrhs {items} {    rhs clear    insertrhs $items}# ------------------------------------------------------------------# Method:  lhs## Purpose: Evaluates the specified arguments against the lhs Listbox#itcl::body ::iwidgets::Disjointlistbox::lhs {args} {    return [eval $itk_component(lhs) $args]}# ------------------------------------------------------------------# Method:  rhs## Purpose: Evaluates the specified arguments against the rhs Listbox#itcl::body ::iwidgets::Disjointlistbox::rhs {args} {    return [eval $itk_component(rhs) $args]}# ------------------------------------------------------------------# OPTION: buttonplacement## Configure the placement of the buttons to be either between or below# the two list boxes.#itcl::configbody ::iwidgets::Disjointlistbox::buttonplacement {    if {$itk_option(-buttonplacement) != ""} {        if { [lsearch [component] lhsbutton] != -1 } {            eval destroy $itk_component(rhsbutton) $itk_component(lhsbutton)        }        if { [lsearch [component] bbox] != -1 } {            destroy $itk_component(bbox)        }        set where $itk_option(-buttonplacement)        switch $where {            center {                #                # Create the button box frame                #                itk_component add bbox {                    frame $itk_interior.bbox                }                    itk_component add lhsbutton {                    button $itk_component(bbox).lhsbutton -command [itcl::code \                            $this transfer]                } {                    usual                    rename -text -lhsbuttonlabel lhsButtonLabel LabelText                    rename -font -labelfont labelFont Font                }                    itk_component add rhsbutton {                    button $itk_component(bbox).rhsbutton -command [itcl::code \                            $this transfer]                } {                    usual                    rename -text -rhsbuttonlabel rhsButtonLabel LabelText                    rename -font -labelfont labelFont Font                }                    grid configure $itk_component(lhsCount) -row 1 -column 0 \                        -sticky ew                grid configure $itk_component(rhsCount) -row 1 -column 2 \                        -sticky ew                     grid configure $itk_component(bbox) \                        -in $itk_interior -row 0 -column 1 -columnspan 1 \                                -sticky nsew                    grid configure $itk_component(rhsbutton) \                        -in $itk_component(bbox) -row 0 -column 0 -sticky ew                grid configure $itk_component(lhsbutton) \                        -in $itk_component(bbox) -row 1 -column 0 -sticky ew                }            bottom {                    itk_component add lhsbutton {                    button $itk_interior.lhsbutton -command [itcl::code $this \                            transfer]                } {                    usual                    rename -text -lhsbuttonlabel lhsButtonLabel LabelText                    rename -font -labelfont labelFont Font                }                itk_component add rhsbutton {                    button $itk_interior.rhsbutton -command [itcl::code $this \                            transfer]                } {                    usual                    rename -text -rhsbuttonlabel rhsButtonLabel LabelText                    rename -font -labelfont labelFont Font                }                grid $itk_component(lhsCount)  -row 2 -column 0 -sticky ew                grid $itk_component(rhsCount)  -row 2 -column 2 -sticky ew                grid $itk_component(lhsbutton) -row 1 -column 0 -sticky ew                grid $itk_component(rhsbutton) -row 1 -column 2 -sticky ew            }            default {                error "bad buttonplacement option\"$where\": should be center\                        or bottom"            }        }    }}# ------------------------------------------------------------------# OPTION: lhssortoption## Configure the sort option to use for the left side#itcl::configbody ::iwidgets::Disjointlistbox::lhssortoption {    if {![string equal $itk_option(-lhssortoption) "none"]} {        $itk_component(lhs) sort $itk_option(-lhssortoption)    }}# ------------------------------------------------------------------# OPTION: rhssortoption## Configure the sort option to use for the right side#itcl::configbody ::iwidgets::Disjointlistbox::rhssortoption {    if {![string equal $itk_option(-rhssortoption) "none"]} {        $itk_component(rhs) sort $itk_option(-rhssortoption)    }}

⌨️ 快捷键说明

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