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

📄 dateentry.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 2 页
字号:
## Dateentry# ----------------------------------------------------------------------# Implements a quicken style date entry field with a popup calendar# by combining the datefield and calendar widgets together.  This# allows a user to enter the date via the keyboard or by using the# mouse by selecting the calendar icon which brings up a popup calendar.# ----------------------------------------------------------------------#   AUTHOR:  Mark L. Ulferts          E-mail: mulferts@austin.dsccc.com##   @(#) $Id: dateentry.itk,v 1.6 2002/09/05 19:33:58 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.# ======================================================================## ----------------------------------------------------------------------## Modified 2001-10-23 by Mark Alston to pass options to the datefield # constructor.  Needed to allow use of new option -int which lets the # user use dates in YYYY-MM-DD format as well as MM/DD/YYYY format.## option -int yes sets dates to YYYY-MM-DD format#        -int no sets dates to MM/DD/YYYY format.## ----------------------------------------------------------------------## Usual options.#itk::usual Dateentry {    keep -background -borderwidth -currentdatefont -cursor \	-datefont -dayfont -foreground -highlightcolor \	-highlightthickness -labelfont -textbackground -textfont \	-titlefont -int}# ------------------------------------------------------------------#                              DATEENTRY# ------------------------------------------------------------------itcl::class iwidgets::Dateentry {    inherit iwidgets::Datefield    constructor {args} {	eval Datefield::constructor $args    } {}    itk_option define -grab grab Grab "global"    itk_option define -icon icon Icon {}        #    # The calendar widget isn't created until needed, yet we need    # its options to be available upon creation of a dateentry widget.    # So, we'll define them in these class now so they can just be    # propagated onto the calendar later.    #    itk_option define -days days Days {Su Mo Tu We Th Fr Sa}    itk_option define -forwardimage forwardImage Image {}    itk_option define -backwardimage backwardImage Image {}    itk_option define -weekdaybackground weekdayBackground Background \#d9d9d9    itk_option define -weekendbackground weekendBackground Background \#d9d9d9    itk_option define -outline outline Outline \#d9d9d9    itk_option define -buttonforeground buttonForeground Foreground blue    itk_option define -foreground foreground Foreground black    itk_option define -selectcolor selectColor Foreground red    itk_option define -selectthickness selectThickness SelectThickness 3    itk_option define -titlefont titleFont Font \	-*-helvetica-bold-r-normal--*-140-*    itk_option define -dayfont dayFont Font \	-*-helvetica-medium-r-normal--*-120-*    itk_option define -datefont dateFont Font \	-*-helvetica-medium-r-normal--*-120-*    itk_option define -currentdatefont currentDateFont Font \	-*-helvetica-bold-r-normal--*-120-*    itk_option define -startday startDay Day sunday    itk_option define -height height Height 165    itk_option define -width width Width 200    itk_option define -state state State normal    protected {	method _getPopupDate {date}	method _releaseGrab {}	method _releaseGrabCheck {rootx rooty}	method _popup {}	method _getDefaultIcon {}        common _defaultIcon ""    }}## Provide a lowercased access method for the dateentry class.# proc ::iwidgets::dateentry {pathName args} {    uplevel ::iwidgets::Dateentry $pathName $args}# ------------------------------------------------------------------#                        CONSTRUCTOR# ------------------------------------------------------------------itcl::body iwidgets::Dateentry::constructor {args} {    #    # Create an icon label to act as a button to bring up the     # calendar popup.    #    itk_component add iconbutton {	label $itk_interior.iconbutton -relief raised    } {	keep -borderwidth -cursor -foreground     }    grid $itk_component(iconbutton) -row 0 -column 0 -sticky ns        #    # Initialize the widget based on the command line options.    #    eval itk_initialize $args}# ------------------------------------------------------------------#                             OPTIONS# ------------------------------------------------------------------# ------------------------------------------------------------------# OPTION: -icon## Specifies the calendar icon image to be used in the date.# Should one not be provided, then a default pixmap will be used# if possible, bitmap otherwise.# ------------------------------------------------------------------itcl::configbody iwidgets::Dateentry::icon {    if {$itk_option(-icon) == {}} {	$itk_component(iconbutton) configure -image [_getDefaultIcon]    } else {	if {[lsearch [image names] $itk_option(-icon)] == -1} {	    error "bad icon option \"$itk_option(-icon)\":\                   should be an existing image"	} else {	    $itk_component(iconbutton) configure -image $itk_option(-icon)	}    }}# ------------------------------------------------------------------# OPTION: -grab## Specifies the grab level, local or global, to be obtained when # bringing up the popup calendar.  The default is global.# ------------------------------------------------------------------itcl::configbody iwidgets::Dateentry::grab {    switch -- $itk_option(-grab) {	"local" - "global" {}	default {	    error "bad grab option \"$itk_option(-grab)\":\                   should be local or global"	}    }}# ------------------------------------------------------------------# OPTION: -state## Specifies the state of the widget which may be disabled or# normal.  A disabled state prevents selection of the date field# or date icon button.# ------------------------------------------------------------------itcl::configbody iwidgets::Dateentry::state {    switch -- $itk_option(-state) {	normal {	    bind $itk_component(iconbutton) <Button-1> [itcl::code $this _popup]	}	disabled {	    bind $itk_component(iconbutton) <Button-1> {}	}    }}# ------------------------------------------------------------------#                            METHODS# ------------------------------------------------------------------# ------------------------------------------------------------------# PROTECTED METHOD: _getDefaultIcon## This method is invoked uto retrieve the name of the default icon# image displayed in the icon button.# ------------------------------------------------------------------itcl::body iwidgets::Dateentry::_getDefaultIcon {} {    if {[lsearch [image types] pixmap] != -1} {      set _defaultIcon [image create pixmap -data {	  /* XPM */	  static char *calendar[] = {	  /* width height num_colors chars_per_pixel */	  "    25    20        6            1",	  /* colors */	  ". c #808080",

⌨️ 快捷键说明

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