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

📄 spintime.itk

📁 这是一个Linux下的集成开发环境
💻 ITK
📖 第 1 页 / 共 2 页
字号:
# Spintime # ----------------------------------------------------------------------# Implements a Time spinner widget.  A time spinner contains three# integer spinners:  one for hours, one for minutes and one for# seconds.  Options exist to manage to behavior, appearance, and# format of each component spinner.## ----------------------------------------------------------------------#  AUTHOR: Sue Yockey                  EMAIL: yockey@actc.com#          Mark L. Ulferts                    mulferts@austin.dsccc.com##   @(#) $Id: spintime.itk,v 1.1 2003/02/05 10:54:09 mdejong Exp $# ----------------------------------------------------------------------#            Copyright (c) 1997 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 *Spintime.hourLabel "Hour" widgetDefaultoption add *Spintime.minuteLabel "Minute" widgetDefaultoption add *Spintime.secondLabel "Second" widgetDefaultoption add *Spintime.hourWidth 3 widgetDefaultoption add *Spintime.minuteWidth 3 widgetDefaultoption add *Spintime.secondWidth 3 widgetDefault## Usual options.#itk::usual Spintime {    keep -background -cursor -foreground -labelfont -textbackground -textfont}# ------------------------------------------------------------------#                            SPINTIME# ------------------------------------------------------------------class iwidgets::Spintime {    inherit itk::Widget         constructor {args} {}    destructor {}    itk_option define -orient orient Orient vertical     itk_option define -labelpos labelPos Position w     itk_option define -houron hourOn HourOn true     itk_option define -minuteon minuteOn MinuteOn true     itk_option define -secondon secondOn SecondOn true     itk_option define -timemargin timeMargin Margin 1     itk_option define -militaryon militaryOn MilitaryOn true     public {	method get {{format "-string"}} 	method show {{date now}}    }        protected {	method _packTime {{when later}}	method _down60 {comp}	variable _repack {}             ;# Reconfiguration flag.	variable _interior    }}## Provide a lowercased access method for the Spintime class.# proc ::iwidgets::spintime {pathName args} {    uplevel ::iwidgets::Spintime $pathName $args}# ------------------------------------------------------------------#                        CONSTRUCTOR# ------------------------------------------------------------------body iwidgets::Spintime::constructor {args} {    set _interior $itk_interior    set clicks [clock seconds]    #    # Create Hour Spinner    #    itk_component add hour {	iwidgets::Spinint $itk_interior.hour -fixed 2 -range {0 23} -justify right    } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -hourlabel hourLabel Text	rename -width -hourwidth hourWidth Width    }        #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(hour) component entry] <1> {break}    bind [$itk_component(hour) component entry] <Button1-Motion> {break}    #    # Create Minute Spinner    #    itk_component add minute {	iwidgets::Spinint $itk_interior.minute \		-decrement [code $this _down60 minute] \		-fixed 2 -range {0 59} -justify right    } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -minutelabel minuteLabel Text	rename -width -minutewidth minuteWidth Width    }        #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(minute) component entry] <1> {break}    bind [$itk_component(minute) component entry] <Button1-Motion> {break}    #    # Create Second Spinner    #    itk_component add second {	iwidgets::Spinint $itk_interior.second  \		-decrement [code $this _down60 second] \		-fixed 2 -range {0 59} -justify right    } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -secondlabel secondLabel Text	rename -width -secondwidth secondWidth Width    }    #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(second) component entry] <1> {break}    bind [$itk_component(second) component entry] <Button1-Motion> {break}    #    # Initialize the widget based on the command line options.    #    eval itk_initialize $args    #     # Show the current time.    #    show now}	# ------------------------------------------------------------------#                           DESTRUCTOR# ------------------------------------------------------------------body iwidgets::Spintime::destructor {} {    if {$_repack != ""} {after cancel $_repack}}# ------------------------------------------------------------------#                             OPTIONS# ------------------------------------------------------------------# ------------------------------------------------------------------# OPTION: -orient# # Specifies the orientation of the 3 spinners for Hour, Minute # and second.# ------------------------------------------------------------------configbody iwidgets::Spintime::orient {    _packTime}# ------------------------------------------------------------------# OPTION: -labelpos# # Specifies the location of all 3 spinners' labels. # Overloaded # ------------------------------------------------------------------configbody iwidgets::Spintime::labelpos {    switch $itk_option(-labelpos) {	n {	    $itk_component(hour) configure -labelpos n	    $itk_component(minute) configure -labelpos n	    $itk_component(second) configure -labelpos n	    	    #	    # Un-align labels	    #	    $itk_component(hour) configure -labelmargin 1	    $itk_component(minute) configure -labelmargin 1	    $itk_component(second) configure -labelmargin 1	}		s {	    $itk_component(hour) configure -labelpos s	    $itk_component(minute) configure -labelpos s	    $itk_component(second) configure -labelpos s	    	    #	    # Un-align labels	    #	    $itk_component(hour) configure -labelmargin 1	    $itk_component(minute) configure -labelmargin 1	    $itk_component(second) configure -labelmargin 1	}		w {	    $itk_component(hour) configure -labelpos w	    $itk_component(minute) configure -labelpos w	    $itk_component(second) configure -labelpos w	}		e {	    $itk_component(hour) configure -labelpos e	    $itk_component(minute) configure -labelpos e	    $itk_component(second) configure -labelpos e	    	    #	    # Un-align labels	    #	    $itk_component(hour) configure -labelmargin 1	    $itk_component(minute) configure -labelmargin 1	    $itk_component(second) configure -labelmargin 1	}		default {	    error "bad labelpos option \"$itk_option(-labelpos)\",\		    should be n, s, w or e"	}    }    _packTime}# ------------------------------------------------------------------# OPTION: -houron# # Specifies whether or not to display the hour spinner.# ------------------------------------------------------------------configbody iwidgets::Spintime::houron {    _packTime}

⌨️ 快捷键说明

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