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

📄 spindate.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 2 页
字号:
# Spindate # ----------------------------------------------------------------------# Implements a Date spinner widget.  A date spinner contains three# Spinner widgets:  one Spinner for months, one SpinInt for days,# and one SpinInt for years.  Months can be specified as abbreviated# strings, integers or a user-defined list.  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: spindate.itk,v 1.5 2001/08/22 15:51:13 smithc 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 *Spindate.monthLabel "Month" widgetDefaultoption add *Spindate.dayLabel "Day" widgetDefaultoption add *Spindate.yearLabel "Year" widgetDefaultoption add *Spindate.monthWidth 4 widgetDefaultoption add *Spindate.dayWidth 4 widgetDefaultoption add *Spindate.yearWidth 4 widgetDefault## Usual options.#itk::usual Spindate {    keep -background -cursor -foreground -labelfont -textbackground -textfont }# ------------------------------------------------------------------#                            SPINDATE# ------------------------------------------------------------------itcl::class iwidgets::Spindate {    inherit itk::Widget         constructor {args} {}    destructor {}        itk_option define -labelpos labelPos Position w    itk_option define -orient orient Orient vertical     itk_option define -monthon monthOn MonthOn true     itk_option define -dayon dayOn DayOn true     itk_option define -yearon yearOn YearOn true     itk_option define -datemargin dateMargin Margin 1     itk_option define -yeardigits yearDigits YearDigits 4    itk_option define -monthformat monthFormat MonthFormat integer     public {	method get {{format "-string"}} 	method show {{date now}}     }    protected {	method _packDate {{when later}} 	variable _repack {}             ;# Reconfiguration flag.    }    private {	method _lastDay {month year}	method _spinMonth {direction} 	method _spinDay {direction} 	variable _monthFormatStr "%m"	variable _yearFormatStr "%Y"	variable _interior    }}## Provide a lowercased access method for the Spindate class.# proc ::iwidgets::spindate {pathName args} {    uplevel ::iwidgets::Spindate $pathName $args}# ------------------------------------------------------------------#                        CONSTRUCTOR# ------------------------------------------------------------------itcl::body iwidgets::Spindate::constructor {args} {    set _interior $itk_interior    set clicks [clock seconds]    #    # Create Month Spinner    #    itk_component add month {	iwidgets::Spinner $itk_interior.month  -fixed 2 -justify right \	    -decrement [itcl::code $this _spinMonth -1] \	    -increment [itcl::code $this _spinMonth 1]     } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -monthlabel monthLabel Text	rename -width -monthwidth monthWidth Width    }    #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(month) component entry] <1> {break}    bind [$itk_component(month) component entry] <Button1-Motion> {break}        #    # Create Day Spinner    #    itk_component add day {	iwidgets::Spinint $itk_interior.day -fixed 2 -justify right \	    -decrement [itcl::code $this _spinDay -1] \	    -increment [itcl::code $this _spinDay 1]    } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -daylabel dayLabel Text	rename -width -daywidth dayWidth Width    }        #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(day) component entry] <1> {break}    bind [$itk_component(day) component entry] <Button1-Motion> {break}        #    # Create Year Spinner    #    itk_component add year {	iwidgets::Spinint $itk_interior.year -fixed 2 -justify right \	    -range {1900 3000}    } {	keep -background -cursor -arroworient -foreground \		-labelfont -labelmargin -relief -textbackground \		-textfont -repeatdelay -repeatinterval	rename -labeltext -yearlabel yearLabel Text	rename -width -yearwidth yearWidth Width    }    #    # Take off the default bindings for selction and motion.    #    bind [$itk_component(year) component entry] <1> {break}    bind [$itk_component(year) component entry] <Button1-Motion> {break}        #    # Initialize the widget based on the command line options.    #    eval itk_initialize $args    #    # Show the current date.    #    show now}# ------------------------------------------------------------------#                           DESTRUCTOR# ------------------------------------------------------------------itcl::body iwidgets::Spindate::destructor {} {    if {$_repack != ""} {after cancel $_repack}}# ------------------------------------------------------------------#                             OPTIONS# ------------------------------------------------------------------# ------------------------------------------------------------------# OPTION: -labelpos## Specifies the location of all 3 spinners' labels.# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::labelpos {    switch $itk_option(-labelpos) {	n {	    $itk_component(month) configure -labelpos n	    $itk_component(day) configure -labelpos n	    $itk_component(year) configure -labelpos n	    	    #	    # Un-align labels	    #	    $itk_component(month) configure -labelmargin 1	    $itk_component(day) configure -labelmargin 1	    $itk_component(year) configure -labelmargin 1 	}		s {	    $itk_component(month) configure -labelpos s	    $itk_component(day) configure -labelpos s	    $itk_component(year) configure -labelpos s	    	    #	    # Un-align labels	    #	    $itk_component(month) configure -labelmargin 1	    $itk_component(day) configure -labelmargin 1	    $itk_component(year) configure -labelmargin 1 	}		w {	    $itk_component(month) configure -labelpos w	    $itk_component(day) configure -labelpos w	    $itk_component(year) configure -labelpos w	}		e {	    $itk_component(month) configure -labelpos e	    $itk_component(day) configure -labelpos e	    $itk_component(year) configure -labelpos e	    	    #	    # Un-align labels	    #	    $itk_component(month) configure -labelmargin 1	    $itk_component(day) configure -labelmargin 1	    $itk_component(year) configure -labelmargin 1 	}		default {	    error "bad labelpos option \"$itk_option(-labelpos)\",\		    should be n, s, w or e" 	}    }    _packDate}# ------------------------------------------------------------------# OPTION: -orient# # Specifies the orientation of the 3 spinners for Month, Day # and year.# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::orient {    _packDate}# ------------------------------------------------------------------# OPTION: -monthon# # Specifies whether or not to display the month spinner.# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::monthon {    _packDate}# ------------------------------------------------------------------# OPTION: -dayon# # Specifies whether or not to display the day spinner.# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::dayon {    _packDate}# ------------------------------------------------------------------# OPTION: -yearon# # Specifies whether or not to display the year spinner.# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::yearon {    _packDate}# ------------------------------------------------------------------# OPTION: -datemargin# # Specifies the margin space between the month and day spinners # and the day and year spinners. # ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::datemargin {    _packDate}# ------------------------------------------------------------------# OPTION: -yeardigits## Number of digits for year display, 2 or 4 # ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::yeardigits {    set clicks [clock seconds]    switch $itk_option(-yeardigits) {	"2" {	    $itk_component(year) configure -width 2 -fixed 2	    $itk_component(year) clear	    $itk_component(year) insert 0 [clock format $clicks -format "%y"]	    set _yearFormatStr "%y"	}		"4" {	    $itk_component(year) configure -width 4 -fixed 4	    $itk_component(year) clear	    $itk_component(year) insert 0 [clock format $clicks -format "%Y"]	    set _yearFormatStr "%Y"	}		default {	    error "bad yeardigits option \"$itk_option(-yeardigits)\",\		    should be 2 or 4"	}    } }# ------------------------------------------------------------------# OPTION: -monthformat## Format of month display, integers (1-12) or brief strings (Jan - # Dec), or full strings (January - December).# ------------------------------------------------------------------itcl::configbody iwidgets::Spindate::monthformat {    set clicks [clock seconds]    if {$itk_option(-monthformat) == "brief"} {	$itk_component(month) configure -width 3 -fixed 3	$itk_component(month) delete 0 end	$itk_component(month) insert 0 [clock format $clicks -format "%b"]	set _monthFormatStr "%b"

⌨️ 快捷键说明

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