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

📄 tabnotebook.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 3 页
字号:
## Tabnotebook Widget# ----------------------------------------------------------------------# The Tabnotebook command creates a new window (given by the pathName # argument) and makes it into a Tabnotebook widget. Additional options, # described above may be specified on the command line or in the option # database to configure aspects of the Tabnotebook such as its colors, # font, and text. The Tabnotebook command returns its pathName argument. # At the time this command is invoked, there must not exist a window # named pathName, but pathName's parent must exist.# # A Tabnotebook is a widget that contains a set of tabbed pages. It # displays one page from the set as the selected page. A Tab displays # the label for the page to which it is attached and serves as a page # selector.   When a page's tab is selected, the page's contents are # displayed in the page area. The selected tab has a three-dimensional # effect to make it appear to float above the other tabs. The tabs are # displayed as a group along either the left, top, right, or bottom # edge. When first created a Tabnotebook has no pages. Pages may be # added or deleted using widget commands described below.# # A special option may be provided to the Tabnotebook. The -auto # option specifies whether the Tabnotebook will automatically handle # the unpacking and packing of pages when pages are selected. A value # of true sig nifies that the notebook will automatically manage it. This # is the default value. A value of false signifies the notebook will not # perform automatic switching of pages.# # ----------------------------------------------------------------------#  AUTHOR: Bill W. Scott##  CURRENT MAINTAINER: Chad Smith --> csmith@adc.com or itclguy@yahoo.com##  @(#) $Id: tabnotebook.itk,v 1.7 2002/09/05 20:19:35 smithc Exp $# ----------------------------------------------------------------------#            Copyright (c) 1995 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.# ======================================================================## Default resources.#option add *Tabnotebook.borderWidth 2 widgetDefaultoption add *Tabnotebook.state normal widgetDefaultoption add *Tabnotebook.disabledForeground #a3a3a3 widgetDefaultoption add *Tabnotebook.scrollCommand {} widgetDefaultoption add *Tabnotebook.equalTabs true widgetDefaultoption add *Tabnotebook.font \	-Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* widgetDefaultoption add *Tabnotebook.width 300 widgetDefaultoption add *Tabnotebook.height 150 widgetDefaultoption add *Tabnotebook.foreground Black widgetDefaultoption add *Tabnotebook.background #d9d9d9 widgetDefaultoption add *Tabnotebook.tabForeground Black widgetDefaultoption add *Tabnotebook.tabBackground #d9d9d9 widgetDefaultoption add *Tabnotebook.backdrop #d9d9d9 widgetDefaultoption add *Tabnotebook.margin 4 widgetDefaultoption add *Tabnotebook.tabBorders true widgetDefaultoption add *Tabnotebook.bevelAmount 0 widgetDefaultoption add *Tabnotebook.raiseSelect false widgetDefaultoption add *Tabnotebook.auto true widgetDefaultoption add *Tabnotebook.start 4 widgetDefaultoption add *Tabnotebook.padX 4 widgetDefaultoption add *Tabnotebook.padY 4 widgetDefaultoption add *Tabnotebook.gap overlap widgetDefaultoption add *Tabnotebook.angle 15 widgetDefaultoption add *Tabnotebook.tabPos s widgetDefault## Usual options.#itk::usual Tabnotebook {    keep -backdrop -background -borderwidth -cursor -disabledforeground \	 -font -foreground -tabbackground -tabforeground}# ------------------------------------------------------------------#                            TABNOTEBOOK# ------------------------------------------------------------------itcl::class iwidgets::Tabnotebook {    inherit itk::Widget        constructor {args} {}    destructor {}        itk_option define -borderwidth borderWidth BorderWidth 2     itk_option define -state state State normal    itk_option define \	    -disabledforeground disabledForeground DisabledForeground #a3a3a3    itk_option define -scrollcommand scrollCommand ScrollCommand {}    itk_option define -equaltabs equalTabs EqualTabs true    itk_option define -font font Font \	    -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*    itk_option define -width width Width 300    itk_option define -height height Height 150    itk_option define -foreground foreground Foreground Black    itk_option define -background background Background  #d9d9d9    itk_option define -tabforeground tabForeground TabForeground Black    itk_option define -tabbackground tabBackground TabBackground #d9d9d9    itk_option define -backdrop backdrop Backdrop #d9d9d9    itk_option define -margin margin Margin 4     itk_option define -tabborders tabBorders TabBorders true     itk_option define -bevelamount bevelAmount BevelAmount 0     itk_option define -raiseselect raiseSelect RaiseSelect false     itk_option define -auto auto Auto true    itk_option define -start start Start 4     itk_option define -padx padX PadX 4     itk_option define -pady padY PadY 4     itk_option define -gap gap Gap overlap     itk_option define -angle angle Angle 15     itk_option define -tabpos tabPos TabPos s         public method add { args }    public method configure { args }     public method childsite { args }    public method delete { args }     public method index { args }     public method insert { index args }    public method prev { }     public method next { }    public method pageconfigure { index args }     public method select { index }     public method view { args }         protected method _reconfigureTabset { }     protected method _canvasReconfigure { wid hgt }    protected method _pageReconfigure { pageName page wid hgt }        private method _getArgs { optList args }    private method _redrawBorder { wid hgt }     private method _recomputeBorder { }    private method _pack { tabPos }     private method _resize {newWidth_ newHeight_}        private variable _canvasWidth 0       ;# currently tabnote canvas width    private variable _canvasHeight 0      ;# currently tabnote canvas height    private variable _nbOptList {}        ;# list of notebook options available    private variable _tsOptList {}        ;# list of tabset options available        private variable _tabPos s            ;# holds -tabPos, because of ordering        private variable _borderRecompute false   ;# did we dirty border after cfg?    private variable _tabsetReconfigure false ;# did we dirty tabsets after cfg?    }# ----------------------------------------------------------------------#                              CONSTRUCTOR# ----------------------------------------------------------------------itcl::body iwidgets::Tabnotebook::constructor {args} {    # The following conditional added for SF ticket #514222.   csmith 9/5/02    if {$::tk_version > 8.3} {      component hull configure -borderwidth 0 -padx 0 -pady 0    } else {      component hull configure -borderwidth 0    }    #    # Create the outermost canvas to maintain geometry.    #    itk_component add canvas {	canvas $itk_interior.canvas -highlightthickness 0    } {	keep -cursor -background -width -height    }    bind $itk_component(canvas) <Configure> [itcl::code $this _resize %w %h]            # .......................    # Create the NOTEBOOK    #    itk_component add notebook {	iwidgets::Notebook $itk_interior.canvas.notebook     } {	keep -cursor -background     }        #    # Ouch, create a dummy page, go pageconfigure to get its options    # and munge them into a list for later doling by pageconfigure    #    $itk_component(notebook) add    set nbConfigList [$itk_component(notebook) pageconfigure 0]    foreach config $nbConfigList {	lappend _nbOptList [lindex $config 0]    }    $itk_component(notebook) delete 0        #     # Create the tabset.    #    itk_component add tabset {	iwidgets::Tabset $itk_interior.canvas.tabset \		-command [itcl::code $this component notebook select]    } {	keep -cursor     }        eval itk_initialize $args        #    # Ouch, create a dummy tab, go tabconfigure to get its options    # and munge them into a list for later doling by pageconfigure    #    $itk_component(tabset) add    set tsConfigList [$itk_component(tabset) tabconfigure 0]    foreach config $tsConfigList {	lappend _tsOptList [lindex $config 0]    }    $itk_component(tabset) delete 0        bind $itk_component(tabset) <Configure> \	    [itcl::code $this _reconfigureTabset]        _pack $_tabPos    $itk_component(hull) configure -width [cget -width] -height [cget -height]}proc ::iwidgets::tabnotebook {pathName args} {    uplevel ::iwidgets::Tabnotebook $pathName $args}# -------------------------------------------------------------# DESTRUCTOR: destroy the Tabnotebook# -------------------------------------------------------------itcl::body iwidgets::Tabnotebook::destructor {} {}# ----------------------------------------------------------------------# OPTION -borderwidth## Thickness of Notebook Border# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::borderwidth {    if {$itk_option(-borderwidth) != {}} {	#_recomputeBorder	set _borderRecompute true    }}# ----------------------------------------------------------------------# OPTION -state## State of the tabs in the tab notebook: normal or disabled# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::state {    if {$itk_option(-state) != {}} {	$itk_component(tabset) configure -state $itk_option(-state)	#_reconfigureTabset	set _tabsetReconfigure true	    }}# ----------------------------------------------------------------------# OPTION -disabledforeground## Specifies a foreground color to use for displaying a # tab's label when its state is disabled.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::disabledforeground {        if {$itk_option(-disabledforeground) != {}} {	$itk_component(tabset) configure \		-disabledforeground $itk_option(-disabledforeground)	#_reconfigureTabset	set _tabsetReconfigure true    }}# ----------------------------------------------------------------------# OPTION -scrollcommand## Standard option. See options man pages.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::scrollcommand {        if {$itk_option(-scrollcommand) != {}} {	$itk_component(notebook) \		configure -scrollcommand $itk_option(-scrollcommand)    }}# ----------------------------------------------------------------------# OPTION -equaltabs## Specifies whether to force tabs to be equal sized or not. # A value of true means constrain tabs to be equal sized. # A value of false allows each tab to size based on the text # label size. The value may have any of the forms accepted by # the Tcl_GetBoolean, such as true, false, 0, 1, yes, or no.# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::equaltabs {        if {$itk_option(-equaltabs) != {}} {	$itk_component(tabset) \		configure -equaltabs $itk_option(-equaltabs)	#_reconfigureTabset	set _tabsetReconfigure true    }}# ----------------------------------------------------------------------# OPTION -font## Font for tab labels when they are set to text (-label set)# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::font {        if {$itk_option(-font) != {}} {	$itk_component(tabset) configure -font $itk_option(-font)	#_reconfigureTabset	set _tabsetReconfigure true    }}# ----------------------------------------------------------------------# OPTION -width## Width of the Tabnotebook# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::width {    if {$itk_option(-width) != {}} {	$itk_component(canvas) configure -width $itk_option(-width)	#_recomputeBorder	set _borderRecompute true    }}# ----------------------------------------------------------------------# OPTION -height## Height of the Tabnotebook# ----------------------------------------------------------------------itcl::configbody iwidgets::Tabnotebook::height {    if {$itk_option(-height) != {}} {	$itk_component(canvas) configure -height $itk_option(-height)	#_recomputeBorder	set _borderRecompute true    }}# ----------------------------------------------------------------------# OPTION -foreground## Specifies a foreground color to use for displaying a page # and its associated tab label (this is the selected state).

⌨️ 快捷键说明

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