📄 tabnotebook.itk
字号:
# and its associated tab label (this is the selected state).# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::foreground { if {$itk_option(-foreground) != {}} { $itk_component(tabset) configure \ -selectforeground $itk_option(-foreground) }}# ----------------------------------------------------------------------# OPTION -background## Specifies a background color to use for displaying a page # and its associated tab bg (this is the selected state).# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::background { if {$itk_option(-background) != {}} { $itk_component(tabset) configure \ -selectbackground $itk_option(-background) #_recomputeBorder set _borderRecompute true }}# ----------------------------------------------------------------------# OPTION -tabforeground## Specifies a foreground color to use for displaying tab labels # when they are in their unselected state.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::tabforeground { if {$itk_option(-tabforeground) != {}} { $itk_component(tabset) configure \ -foreground $itk_option(-tabforeground) }}# ----------------------------------------------------------------------# OPTION -tabbackground## Specifies a background color to use for displaying tab backgrounds # when they are in their unselected state.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::tabbackground { if {$itk_option(-tabbackground) != {}} { $itk_component(tabset) configure \ -background $itk_option(-tabbackground) }}# ----------------------------------------------------------------------# OPTION -backdrop## Specifies a background color to use when filling in the # area behind the tabs.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::backdrop { if {$itk_option(-backdrop) != {}} { $itk_component(tabset) configure \ -backdrop $itk_option(-backdrop) }}# ----------------------------------------------------------------------# OPTION -margin## Sets the backdrop margin between tab edge and backdrop edge# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::margin { if {$itk_option(-margin) != {}} { $itk_component(tabset) configure -margin $itk_option(-margin) }}# ----------------------------------------------------------------------# OPTION -tabborders## Boolean that specifies whether to draw the borders of# the unselected tabs (tabs in background)# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::tabborders { if {$itk_option(-tabborders) != {}} { $itk_component(tabset) \ configure -tabborders $itk_option(-tabborders) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -bevelamount## Specifies pixel size of tab corners. 0 means no corners.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::bevelamount { if {$itk_option(-bevelamount) != {}} { $itk_component(tabset) \ configure -bevelamount $itk_option(-bevelamount) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -raiseselect## Sets whether to raise selected tabs# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::raiseselect { if {$itk_option(-raiseselect) != {}} { $itk_component(tabset) \ configure -raiseselect $itk_option(-raiseselect) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -auto## Determines whether pages are automatically unpacked and# packed when pages get selected.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::auto { if {$itk_option(-auto) != {}} { $itk_component(notebook) configure -auto $itk_option(-auto) }}# ----------------------------------------------------------------------# OPTION -start# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::start { if {$itk_option(-start) != {}} { $itk_component(tabset) configure \ -start $itk_option(-start) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -padx## Specifies a non-negative value indicating how much extra space # to request for a tab around its label in the X-direction. # When computing how large a window it needs, the tab will add # this amount to the width it would normally need The tab will # end up with extra internal space to the left and right of its # text label. This value may have any of the forms acceptable # to Tk_GetPixels.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::padx { if {$itk_option(-padx) != {}} { $itk_component(tabset) configure -padx $itk_option(-padx) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -pady## Specifies a non-negative value indicating how much extra space to # request for a tab around its label in the Y-direction. When computing # how large a window it needs, the tab will add this amount to the # height it would normally need The tab will end up with extra internal # space to the top and bot tom of its text label. This value may have # any of the forms acceptable to Tk_GetPixels.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::pady { if {$itk_option(-pady) != {}} { $itk_component(tabset) configure -pady $itk_option(-pady) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -gap## Specifies the amount of pixel space to place between each tab. # Value may be any pixel offset value. In addition, a special keyword # 'overlap' can be used as the value to achieve a standard overlap of # tabs. This value may have any of the forms acceptable to Tk_GetPixels.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::gap { if {$itk_option(-gap) != {}} { $itk_component(tabset) configure -gap $itk_option(-gap) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -angle## Specifes the angle of slope from the inner edge to the outer edge # of the tab. An angle of 0 specifies square tabs. Valid ranges are # 0 to 45 degrees inclusive. Default is 15 degrees. If tabPos is # e or w, this option is ignored.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::angle { if {$itk_option(-angle) != {}} { $itk_component(tabset) configure -angle $itk_option(-angle) #_reconfigureTabset set _tabsetReconfigure true }}# ----------------------------------------------------------------------# OPTION -tabpos## Specifies the location of the set of tabs in relation to the # Notebook area. Must be n, s, e, or w. Defaults to s.# ----------------------------------------------------------------------configbody iwidgets::Tabnotebook::tabpos { if {$itk_option(-tabpos) != {}} { set _tabPos $itk_option(-tabpos) $itk_component(tabset) configure \ -tabpos $itk_option(-tabpos) pack forget $itk_component(canvas) pack forget $itk_component(tabset) pack forget $itk_component(notebook) _pack $_tabPos }}# -------------------------------------------------------------# METHOD: configure ?<option>? ?<value> <option> <value>...?## Acts as an addendum to the itk::Widget::configure method.## Checks the _recomputeBorder flag and the _tabsetReconfigure to# determine what work has been batched to after the configure# -------------------------------------------------------------body iwidgets::Tabnotebook::configure { args } { set result [eval itk::Archetype::configure $args] # check for flags then do update... if { $_borderRecompute == "true" } { _recomputeBorder set _borderRecompute false } if { $_tabsetReconfigure == "true" } { _reconfigureTabset set _tabsetReconfigure false } return $result }# -------------------------------------------------------------# METHOD: add ?<option> <value>...?## Creates a page and appends it to the list of pages.# processes pageconfigure for the page added.## Returns the page's childsite frame# -------------------------------------------------------------body iwidgets::Tabnotebook::add { args } { # The args list should be an even # of params, if not then # prob missing value for last item in args list. Signal error. set len [llength $args] if { [expr $len % 2] } { error "value for \"[lindex $args [expr $len - 1]]\" missing" } # pick out the notebook args set nbArgs [eval _getArgs [list $_nbOptList] $args] set pageName [eval $itk_component(notebook) add $nbArgs] # pick out the tabset args set tsArgs [eval _getArgs [list $_tsOptList] $args] eval $itk_component(tabset) add $tsArgs set page [index end] bind $pageName <Configure> \ [code $this _pageReconfigure $pageName $page %w %h] return $pageName}# -------------------------------------------------------------# METHOD: childsite ?<index>?## If index is supplied, returns the child site widget # corresponding to the page index. If called with no arguments,# returns a list of all child sites# -------------------------------------------------------------body iwidgets::Tabnotebook::childsite { args } { return [eval $itk_component(notebook) childsite $args]}# -------------------------------------------------------------# METHOD: delete <index1> ?<index2>?## Deletes a page or range of pages from the notebook# -------------------------------------------------------------body iwidgets::Tabnotebook::delete { args } { eval $itk_component(notebook) delete $args eval $itk_component(tabset) delete $args}# -------------------------------------------------------------# METHOD: index <index>## Given an index identifier returns the numeric index of the page# -------------------------------------------------------------body iwidgets::Tabnotebook::index { args } { return [eval $itk_component(notebook) index $args]}# -------------------------------------------------------------# METHOD: insert <index> ?<option> <value>...?## Inserts a page before a index. The before page may# be specified as a label or a page position.## Note that since we use eval to preserve the $args list,# we must use list around $index to keep it together as a unit## Returns the name of the page's child site# -------------------------------------------------------------body iwidgets::Tabnotebook::insert { index args } { # pick out the notebook args set nbArgs [eval _getArgs [list $_nbOptList] $args] set pageName [eval $itk_component(notebook) insert [list $index] $nbArgs] # pick out the tabset args set tsArgs [eval _getArgs [list $_tsOptList] $args] eval $itk_component(tabset) insert [list $index] $tsArgs return $pageName }# -------------------------------------------------------------# METHOD: prev## Selects the previous page. Wraps at first back to last page.# -------------------------------------------------------------body iwidgets::Tabnotebook::prev { } { eval $itk_component(notebook) prev
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -