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

📄 tabnotebook.itk

📁 这是一个Linux下的集成开发环境
💻 ITK
📖 第 1 页 / 共 3 页
字号:
    eval $itk_component(tabset)   prev}# -------------------------------------------------------------# METHOD: next## Selects the next page. Wraps at last back to first page.# -------------------------------------------------------------body iwidgets::Tabnotebook::next { } {    eval $itk_component(notebook) next    eval $itk_component(tabset)   next}# -------------------------------------------------------------# METHOD: pageconfigure <index> ?<option> <value>...?## Performs configure on a given page denoted by index.# Index may be a page number or a pattern matching the label# associated with a page.# -------------------------------------------------------------body iwidgets::Tabnotebook::pageconfigure { index args } {        set nbArgs [eval _getArgs [list $_nbOptList] $args]    set tsArgs [eval _getArgs [list $_tsOptList] $args]        set len [llength $args]    switch $len {	0 {	    # Here is the case where they just want to query options	    set nbConfig \		    [eval $itk_component(notebook) pageconfigure $index $nbArgs]	    set tsConfig \		    [eval $itk_component(tabset)   tabconfigure $index $tsArgs]	    #	    # BUG: this currently just concatenates a page and a tab's	    # config lists together... We should bias to the Page	    # since this is what we are using as primary when both??	    #	    # a pageconfigure index -background will return something like:	    # -background background Background #9D008FF583C1 gray70 \		    # -background background background white gray 70	    #	    return [concat $nbConfig $tsConfig]	}	1 {	    # Here is the case where they are asking for only one	    # one options value... need to figure out which one	    # (page or tab) can service this. Then only return	    # that one's result.	    	    if { [llength $nbArgs] != 0 } {		return [eval $itk_component(notebook) \			pageconfigure $index $nbArgs]	    } elseif { [llength $tsArgs] != 0 } {		return [eval $itk_component(tabset) \			tabconfigure $index $tsArgs]	    } else {		error "unknown option \"$args\""	    }	    	}	default {	    	    # pick out the notebook args	    set nbConfig \		    [eval $itk_component(notebook) \		    pageconfigure [list $index] $nbArgs]	    	    # pick out the tabset args	    set tsConfig \		    [eval $itk_component(tabset)   \		    tabconfigure [list $index] $tsArgs]	    	    return ""	    #return [concat $nbConfig $tsConfig]	    	}    }}# -------------------------------------------------------------# METHOD: select index## Select a page by index# -------------------------------------------------------------body iwidgets::Tabnotebook::select { index } {    $itk_component(notebook) select $index    $itk_component(tabset)   select $index}# -------------------------------------------------------------# METHOD: view## Return the current page##         view index## Selects the page denoted by index to be current page##	  view 'moveto' fraction## Selects the page by using fraction amount##	  view 'scroll' num what## Selects the page by using num as indicator of next or# previous## -------------------------------------------------------------body iwidgets::Tabnotebook::view { args } {    eval $itk_component(notebook) view $args    $itk_component(tabset) select [index select]}# -------------------------------------------------------------# PRIVATE METHOD: _getArgs## Given an optList returned from a configure on an object and# given a candidate argument list, peruse throught the optList# and build a new argument list with only those options found# in optList.## This is used by the add, insert, and pageconfigure methods.# It is useful for a container kind of class like Tabnotebook# to be smart about args it gets for its concept of a "page"# which is actually a Notebook Page and a Tabset Tab.## -------------------------------------------------------------body iwidgets::Tabnotebook::_getArgs { optList args } {        set len [llength $args]        set retArgs {}        for {set i 0} {$i < $len} {incr i} {	# get the option for this pair	set opt [lindex $args $i]		# move ahead to the value	incr i		# option exists!	if { [lsearch -exact $optList $opt] != -1} {	    lappend retArgs $opt	    if {$i < [llength $args]} {		lappend retArgs [lindex $args $i]	    }	    # option does not exist	}    }        return $retArgs}# -------------------------------------------------------------# PROTECTED METHOD: _reconfigureTabset## bound to the tabset reconfigure... We call our canvas # reconfigure as if the canvas resized, it then configures# the tabset correctly.# -------------------------------------------------------------body iwidgets::Tabnotebook::_reconfigureTabset { } {        _canvasReconfigure $_canvasWidth $_canvasHeight    }# -------------------------------------------------------------# PROTECTED METHOD: _canvasReconfigure## bound to window Reconfigure event of the canvas# keeps the tabset area stretched in its major dimension.# -------------------------------------------------------------body iwidgets::Tabnotebook::_canvasReconfigure { wid hgt } {        if { $_tabPos == "n" || $_tabPos == "s" } {	$itk_component(tabset) configure -width $wid    } else {	$itk_component(tabset) configure -height $hgt    }        set _canvasWidth $wid    set _canvasHeight $hgt        _redrawBorder $wid $hgt     }# -------------------------------------------------------------# PRIVATE METHOD: _redrawBorder## called by methods when the packing changes, borderwidths, etc.# and height# -------------------------------------------------------------body iwidgets::Tabnotebook::_redrawBorder { wid hgt } {        # Get the top of the Notebook area...        set nbTop [winfo y $itk_component(notebook)]    set canTop [expr $nbTop - $itk_option(-borderwidth)]        $itk_component(canvas) delete BORDER    if { $itk_option(-borderwidth) > 0 } {		# For south, east, and west -- draw the top/north edge	if { $_tabPos != "n" } {	    $itk_component(canvas) create line \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    $wid \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    -width $itk_option(-borderwidth) \		    -fill [iwidgets::colors::topShadow $itk_option(-background)] \		    -tags BORDER	}		# For north, east, and west -- draw the bottom/south edge	if { $_tabPos != "s" } {	    $itk_component(canvas) create line \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    [expr floor($hgt - ($itk_option(-borderwidth)/2.0))] \		    [expr floor($wid - ($itk_option(-borderwidth)/2.0))] \		    [expr floor($hgt - ($itk_option(-borderwidth)/2.0))] \		    -width $itk_option(-borderwidth) \		    -fill [iwidgets::colors::bottomShadow $itk_option(-background)] \		    -tags BORDER	} 		# For north, south, and east -- draw the left/west edge	if { $_tabPos != "w" } {	    $itk_component(canvas) create line \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    0 \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    $hgt \		    -width $itk_option(-borderwidth) \		    -fill [iwidgets::colors::topShadow $itk_option(-background)] \		    -tags BORDER	}		# For north, south, and west -- draw the right/east edge	if { $_tabPos != "e" } {	    $itk_component(canvas) create line \		    [expr floor($wid - ($itk_option(-borderwidth)/2.0))] \		    [expr floor(0 + ($itk_option(-borderwidth)/2.0))] \		    [expr floor($wid - ($itk_option(-borderwidth)/2.0))] \		    $hgt \		    -width $itk_option(-borderwidth) \		    -fill [iwidgets::colors::bottomShadow $itk_option(-background)] \		    -tags BORDER	}    }    }# -------------------------------------------------------------# PRIVATE METHOD: _recomputeBorder## Based on current width and height of our canvas, repacks# the notebook with padding for borderwidth, and calls# redraw border method # -------------------------------------------------------------body iwidgets::Tabnotebook::_recomputeBorder { } {        set wid [winfo width $itk_component(canvas)]    set hgt [winfo height $itk_component(canvas)]        _pack $_tabPos    _redrawBorder $wid $hgt}# -------------------------------------------------------------# PROTECTED METHOD: _pageReconfigure## This method will eventually reconfigure the tab notebook's # notebook area to contain the resized child site# -------------------------------------------------------------body iwidgets::Tabnotebook::_pageReconfigure { pageName page wid hgt } {    }# -------------------------------------------------------------# PRIVATE METHOD: _pack## This method packs the notebook and tabset correctly according# to the current $tabPos# -------------------------------------------------------------body iwidgets::Tabnotebook::_pack { tabPos } {        pack $itk_component(canvas) -fill both -expand yes     pack propagate $itk_component(canvas) no        switch $tabPos {	n {	    # north	    pack $itk_component(tabset) \		    -anchor nw \		    -fill x \		    -expand no	    pack $itk_component(notebook) \		    -fill both \		    -expand yes \		    -padx $itk_option(-borderwidth) \		    -pady $itk_option(-borderwidth) \		    -side bottom 	}	s {	    # south	    pack $itk_component(notebook) \		    -anchor nw \		    -fill both \		    -expand yes \		    -padx $itk_option(-borderwidth) \		    -pady $itk_option(-borderwidth)	    	    pack $itk_component(tabset) \		    -side left \		    -fill x \		    -expand yes	}	w {	    # west	    pack $itk_component(tabset) \		    -anchor nw \		    -side left \		    -fill y \		    -expand no	    pack $itk_component(notebook) \		    -anchor nw \		    -side left \		    -fill both \		    -expand yes \		    -padx $itk_option(-borderwidth) \		    -pady $itk_option(-borderwidth)	    	}	e {	    # east	    pack $itk_component(notebook) \		    -side left \		    -anchor nw \		    -fill both \		    -expand yes \		    -padx $itk_option(-borderwidth) \		    -pady $itk_option(-borderwidth)	    	    pack $itk_component(tabset) \		    -fill y \		    -expand yes	}    }        set wid [winfo width $itk_component(canvas)]    set hgt [winfo height $itk_component(canvas)]        _redrawBorder $wid $hgt}

⌨️ 快捷键说明

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