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

📄 spintime.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 2 页
字号:
# ------------------------------------------------------------------# OPTION: -minuteon# # Specifies whether or not to display the minute spinner.# ------------------------------------------------------------------itcl::configbody iwidgets::Spintime::minuteon {    _packTime}# ------------------------------------------------------------------# OPTION: -secondon# # Specifies whether or not to display the second spinner.# ------------------------------------------------------------------itcl::configbody iwidgets::Spintime::secondon {    _packTime}# ------------------------------------------------------------------# OPTION: -timemargin# # Specifies the margin space between the hour and minute spinners # and the minute and second spinners. # ------------------------------------------------------------------itcl::configbody iwidgets::Spintime::timemargin {    _packTime}# ------------------------------------------------------------------# OPTION: -militaryon## Specifies 24-hour clock or 12-hour.# ------------------------------------------------------------------itcl::configbody iwidgets::Spintime::militaryon {    set clicks [clock seconds]    if {$itk_option(-militaryon)} {	$itk_component(hour) configure -range {0 23}	$itk_component(hour) delete 0 end	$itk_component(hour) insert end [clock format $clicks -format "%H"]    } else {	$itk_component(hour) configure -range {1 12}	$itk_component(hour) delete 0 end	$itk_component(hour) insert end [clock format $clicks -format "%I"]    }}# ------------------------------------------------------------------#                            METHODS# ------------------------------------------------------------------# ------------------------------------------------------------------# METHOD: get ?format?## Get the value of the time spinner in one of two formats string or # as an integer clock value using the -string and -clicks options # respectively.  The default is by string.  Reference the clock # command for more information on obtaining time and its formats.# ------------------------------------------------------------------itcl::body iwidgets::Spintime::get {{format "-string"}} {    set hour [$itk_component(hour) get]    set minute [$itk_component(minute) get]    set second [$itk_component(second) get]    switch -- $format {	"-string" {	    return "$hour:$minute:$second"	}	"-clicks" {	    return [clock scan "$hour:$minute:$second"]	}	default {	    error "bad format option \"$format\":\                   should be -string or -clicks"	}    }}# ------------------------------------------------------------------# PUBLIC METHOD: show time## Changes the currently displayed time to be that of the time# argument.  The time may be specified either as a string or an# integer clock value.  Reference the clock command for more # information on obtaining time and its format.# ------------------------------------------------------------------itcl::body iwidgets::Spintime::show {{time "now"}} {    if {$time == "now"} {	set seconds [clock seconds]    } else {	if {[catch {clock format $time}] == 0} {	    set seconds $time	} elseif {[catch {set seconds [clock scan $time]}] != 0} {	    error "bad time: \"$time\", must be a valid time\               string, clock clicks value or the keyword now"	}    }    $itk_component(hour) delete 0 end    if {$itk_option(-militaryon)} {	scan [clock format $seconds -format "%H"] "%d" hour    } else {	scan hour [clock format $seconds -format "%I"] "%d" hour    }    $itk_component(hour) insert end $hour    $itk_component(minute) delete 0 end    scan [clock format $seconds -format "%M"] "%d" minute     $itk_component(minute) insert end $minute    $itk_component(second) delete 0 end    scan [clock format $seconds -format "%S"] "%d" seconds    $itk_component(second) insert end $seconds    return}# ------------------------------------------------------------------# PROTECTED METHOD: _packTime ?when?## Pack components of time spinner.  If "when" is "now", the change # is applied immediately.  If it is "later" or it is not specified,# then the change is applied later, when the application is idle.# ------------------------------------------------------------------itcl::body iwidgets::Spintime::_packTime {{when later}} {    if {$when == "later"} {	if {$_repack == ""} {	    set _repack [after idle [itcl::code $this _packTime now]]	}	return    } elseif {$when != "now"} {	error "bad option \"$when\": should be now or later"    }    for {set i 0} {$i < 5} {incr i} {	grid rowconfigure $_interior $i -minsize 0	grid columnconfigure $_interior $i -minsize 0    }    if {$itk_option(-minuteon)} {	set minuteon 1    } else {	set minuteon 0    }    if {$itk_option(-secondon)} {	set secondon 1    } else {	set secondon 0    }    set _repack ""    switch $itk_option(-orient) {	vertical {	    set row -1	    if {$itk_option(-houron)} {		grid $itk_component(hour) -row [incr row] -column 0 \		    -sticky nsew 	    } else {		grid forget $itk_component(hour)	    }	    if {$itk_option(-minuteon)} {		if {$itk_option(-houron)} {		    grid rowconfigure $_interior [incr row] \			-minsize $itk_option(-timemargin)		}		grid $itk_component(minute) -row [incr row] -column 0 \		    -sticky nsew 	    } else {		grid forget $itk_component(minute)	    }	    	    if {$itk_option(-secondon)} {		if {$minuteon || $secondon} {		    grid rowconfigure $_interior [incr row] \			-minsize $itk_option(-timemargin)		}		grid $itk_component(second) -row [incr row] -column 0 \		    -sticky nsew 	    } else {		grid forget $itk_component(second)	    }	    	    if {$itk_option(-labelpos) == "w"} {		iwidgets::Labeledwidget::alignlabels $itk_component(hour) \			$itk_component(minute) $itk_component(second)	    }	}		horizontal {	    set column -1	    if {$itk_option(-houron)} {		grid $itk_component(hour) -row 0 -column [incr column] \		    -sticky nsew 	    } else {		grid forget $itk_component(hour)	    }	    	    if {$itk_option(-minuteon)} {		if {$itk_option(-houron)} {		    grid columnconfigure $_interior [incr column] \			-minsize $itk_option(-timemargin)		}		grid $itk_component(minute) -row 0 -column [incr column] \		    -sticky nsew 	    } else {		grid forget $itk_component(minute)	    }	    	    if {$itk_option(-secondon)} {		if {$minuteon || $secondon} {		    grid columnconfigure $_interior [incr column] \			-minsize $itk_option(-timemargin)		}		grid $itk_component(second) -row 0 -column [incr column] \		    -sticky nsew 	    } else {		grid forget $itk_component(second)	    }	    	    #	    # Un-align labels	    #	    $itk_component(hour) configure -labelmargin 1	    $itk_component(minute) configure -labelmargin 1	    $itk_component(second) configure -labelmargin 1	}		default {	    error "bad orient option \"$itk_option(-orient)\", should\		    be \"vertical\" or \"horizontal\""	}    } }# ------------------------------------------------------------------# METHOD: down60## Down arrow button press event.  Decrement value in the minute# or second entry.# ------------------------------------------------------------------itcl::body iwidgets::Spintime::_down60 {comp} {	set step [$itk_component($comp) cget -step]	set val [$itk_component($comp) get]	incr val -$step	if {$val < 0} {	   set val [expr {60-$step}]        }	$itk_component($comp) delete 0 end	$itk_component($comp) insert 0 $val}

⌨️ 快捷键说明

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