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

📄 tabset.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 5 页
字号:
            [expr {$_canvasWidth - 1}] 0 \            [expr {$_canvasWidth - 1}] [expr {$_canvasHeight - 1}] \            -fill [iwidgets::colors::topShadow $itk_option(-selectbackground)] \            -tags bevelBorder            }    e {        $itk_component(canvas) create line \            0 0 \            0 [expr {$_canvasHeight - 1}] \            -fill black \            -tags bevelBorder        $itk_component(canvas) create line \            1 0 \            1 [expr {$_canvasHeight - 1}] \            -fill [iwidgets::colors::bottomShadow $itk_option(-selectbackground)] \            -tags bevelBorder            }    }        $itk_component(canvas) raise bevelBorder    if { $_currTab != -1 } {    set currTabName [lindex $_tabs $_currTab]    $currTabName raise    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _calcNextTabOffset# # given $tabName, determines the offset in pixels to place# the next tab's start edge at.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_calcNextTabOffset {tabName} {    if { $_gap == "overlap" } {    return [$tabName offset]    } else {    return [expr {[$tabName majordim] + $_gap}]    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _tabBounds# # calculates the bounding box that will completely enclose # all the tabs.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_tabBounds {} {    set bbox { 100000 100000 -10000 -10000 }    foreach tab $_tabs {    set tabBBox [$tab bbox]    # if this left is less use it    if { [lindex $tabBBox 0] < [lindex $bbox 0] } {        set bbox [lreplace $bbox 0 0 [lindex $tabBBox 0]]    }    # if this top is greater use it    if { [lindex $tabBBox 1] < [lindex $bbox 1] } {        set bbox [lreplace $bbox 1 1 [lindex $tabBBox 1]]    }    # if this right is less use it    if { [lindex $tabBBox 2] > [lindex $bbox 2] } {        set bbox [lreplace $bbox 2 2 [lindex $tabBBox 2]]    }    # if this bottom is greater use it    if { [lindex $tabBBox 3] > [lindex $bbox 3] } {        set bbox [lreplace $bbox 3 3 [lindex $tabBBox 3]]    }        }    return $bbox}# ----------------------------------------------------------------------# PRIVATE METHOD: _recalcCanvasGeom# # Based on size of tabs, recalculates the canvas geometry that# will hold the tabs.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_recalcCanvasGeom {} {    if { [llength $_tabs] == 0 } {    return    }        set bbox [_tabBounds]        set width [lindex [_tabBounds] 2]    set height [lindex [_tabBounds] 3]        # now we have the dimensions of all the tabs in the canvas.            switch $itk_option(-tabpos) {    n {        # height already includes margin        $itk_component(canvas) configure \            -width $width \            -height $height    }    s {        $itk_component(canvas) configure \            -width $width \            -height [expr {$height + $_margin}]    }    w {        # width already includes margin        $itk_component(canvas) configure \            -width $width \            -height [expr {$height + 1}]    }    e {        $itk_component(canvas) configure \            -width [expr {$width + $_margin}] \            -height [expr {$height + 1}]    }    default {    }    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _canvasReconfigure# # Bound to the reconfigure notify event of a canvas, this # method resets canvas's correct width (since we are fill x)# and redraws the beveled edge border.# will hold the tabs.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_canvasReconfigure {width height} {    set _canvasWidth $width    set _canvasHeight $height        if { [llength $_tabs] > 0 } {    _drawBevelBorder    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _startMove# # This method is bound to the MB2 down in the canvas area of the# tab set. This starts animated scrolling of the tabs along their# major axis.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_startMove {x y} {    if { $itk_option(-tabpos) == "n" || $itk_option(-tabpos) == "s" } {    set _anchorX $x    } else {    set _anchorY $y    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _moveTabs# # This method is bound to the MB2 motion in the canvas area of the# tab set. This causes the tabset to move with the mouse.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_moveTabs {x y} {    if { $itk_option(-tabpos) == "n" || $itk_option(-tabpos) == "s" } {    set startX [expr {$_start + $x - $_anchorX}]    foreach tab $_tabs {        $tab configure -left $startX         set startX [expr {$startX + [_calcNextTabOffset $tab]}]    }    } else {    set startY [expr {$_start + $y - $_anchorY}]    foreach tab $_tabs {        $tab configure -top $startY         set startY [expr {$startY + [_calcNextTabOffset $tab]}]    }    }}# ----------------------------------------------------------------------# PRIVATE METHOD: _endMove# # This method is bound to the MB2 release in the canvas area of the# tab set. This causes the tabset to end moving tabs.# ----------------------------------------------------------------------itcl::body iwidgets::Tabset::_endMove {x y} {    if { $itk_option(-tabpos) == "n" || $itk_option(-tabpos) == "s" } {    set startX [expr {$_start + $x - $_anchorX}]    set _skipRelayout true    configure -start $startX    set _skipRelayout false    } else {    set startY [expr {$_start + $y - $_anchorY}]    set _skipRelayout true    configure -start $startY    set _skipRelayout false    }}#==============================================================# CLASS: Tab#==============================================================itcl::class iwidgets::Tab {    constructor {args} {}        destructor {}        public variable bevelamount 0 {}    public variable state normal {}    public variable height 0 {}    public variable width 0 {}    public variable anchor c {}    public variable left 0 {}    public variable top 0 {}    public variable image {} {}    public variable bitmap {} {}    public variable label {} {}    public variable padx 4 {}    public variable pady 4 {}    public variable selectbackground "gray70" {}    public variable selectforeground "black" {}    public variable disabledforeground "gray" {}    public variable background "white" {}    public variable foreground "black" {}    public variable orient vertical {}    public variable invert false {}    public variable angle 20 {}    public variable font \       "-adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-1" {}    public variable tabborders true {}        public method configure {args}     public method bbox  {}     public method deselect {}     public method lower {}     public method majordim  {}     public method minordim  {}     public method offset  {}     public method raise {}     public method select {}    public method labelheight {}    public method labelwidth {}         private method _makeTab {}     private method _createLabel {canvas tagList}     private method _makeEastTab {canvas}     private method _makeWestTab {canvas}     private method _makeNorthTab {canvas}    private method _makeSouthTab {canvas}    private method _calcLabelDim {labelItem}    private method _itk_config  {args} @itcl-builtin-configure     private method _selectNoRaise {}    private method _deselectNoLower {}        private variable   _selected false    private variable   _padX 0    private variable   _padY 0        private variable   _canvas        # these are in pixels    private variable   _left 0    private variable   _width 0    private variable   _height 0    private variable   _oldLeft 0    private variable   _top 0    private variable   _oldTop 0        private variable   _right    private variable   _bottom        private variable   _offset    private variable   _majorDim    private variable   _minorDim        private variable   _darkShadow    private variable   _lightShadow        #     # graphic components that make up a tab    #    private variable   _gRegion    private variable   _gLabel    private variable   _gLightOutline {}    private variable   _gBlackOutline {}    private variable   _gTopLine    private variable   _gTopLineShadow    private variable   _gLightShadow    private variable   _gDarkShadow        private variable   _labelWidth 0    private variable   _labelHeight 0        private variable   _labelXOrigin 0    private variable   _labelYOrigin 0        private variable   _just left        private variable   _configTripped true        common _tan        set _tan(0)  0.0    set _tan(1)  0.0175    set _tan(2)  0.0349    set _tan(3)  0.0524    set _tan(4)  0.0699    set _tan(5)  0.0875    set _tan(6)  0.1051    set _tan(7)  0.1228    set _tan(8)  0.1405    set _tan(9)  0.1584    set _tan(10) 0.1763    set _tan(11) 0.1944    set _tan(12) 0.2126    set _tan(13) 0.2309    set _tan(14) 0.2493    set _tan(15) 0.2679    set _tan(16) 0.2867    set _tan(17) 0.3057    set _tan(18) 0.3249    set _tan(19) 0.3443    set _tan(20) 0.3640    set _tan(21) 0.3839    set _tan(22) 0.4040    set _tan(23) 0.4245    set _tan(24) 0.4452    set _tan(25) 0.4663    set _tan(26) 0.4877    set _tan(27) 0.5095    set _tan(28) 0.5317    set _tan(29) 0.5543    set _tan(30) 0.5774    set _tan(31) 0.6009    set _tan(32) 0.6294    set _tan(33) 0.6494    set _tan(34) 0.6745    set _tan(35) 0.7002    set _tan(36) 0.7265    set _tan(37) 0.7536    set _tan(38) 0.7813    set _tan(39) 0.8098    set _tan(40) 0.8391    set _tan(41) 0.8693    set _tan(42) 0.9004    set _tan(43) 0.9325    set _tan(44) 0.9657    set _tan(45) 1.0}# ----------------------------------------------------------------------#                              CONSTRUCTOR# ----------------------------------------------------------------------itcl::body iwidgets::Tab::constructor {args} {        set _canvas [lindex $args 0]    set args [lrange $args 1 [llength $args]]        set _darkShadow  [iwidgets::colors::bottomShadow $selectbackground]    set _lightShadow [iwidgets::colors::topShadow $selectbackground]        if { $args != "" } {    eval configure $args    }}# ----------------------------------------------------------------------#                              DESTRUCTOR# ----------------------------------------------------------------------itcl::body iwidgets::Tab::destructor {} {    if { [winfo exists $_canvas] } {    $_canvas delete $this    }}# ----------------------------------------------------------------------#                              OPTIONS# ----------------------------------------------------------------------## Note, we trip _configTripped for every option that requires the tab# to be remade.## ----------------------------------------------------------------------# OPTION -bevelamount## Specifies the size of tab corners. A value of 0 with angle set # to 0 results in square tabs. A bevelAmount of 4, means that the # tab will be drawn with angled corners that cut in 4 pixels from # the edge of the tab. The default is 0.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tab::bevelamount { }# ----------------------------------------------------------------------# OPTION -state## sets the active state of the tab. specifying normal allows # the tab to be selectable. Specifying disabled disables the tab, # causing its image, bitmap, or label to be drawn with the # disabledForeground color.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tab::state { }# ----------------------------------------------------------------------# OPTION -height## the height of the tab. if 0, uses the font label height.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tab::height {    set _height [winfo pixels $_canvas $height]

⌨️ 快捷键说明

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