// CJDateTimeCtrl.h : header file
// Copyright � 1998-1999 CodeJock.com, All Rights Reserved.
// See ReadMe.txt for TERMS OF USE.
//
// Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
// users, with some ideas taken from Luis Barreira's article 'Classes for new
// IE4 controls' http://www.codeguru.com/controls/ie4_controls_classes.shtml
//
/////////////////////////////////////////////////////////////////////////////
/****************************************************************************
*
* $Date: 8/31/99 1:11a $
* $Revision: 7 $
* $Archive: /CodeJockey/Include/CJDateTimeCtrl.h $
*
* $History: CJDateTimeCtrl.h $
*
* ***************** Version 7 *****************
* User: Kirk Stowell Date: 8/31/99 Time: 1:11a
* Updated in $/CodeJockey/Include
* Updated copyright and contact information.
*
* ***************** Version 6 *****************
* User: Kirk Stowell Date: 7/31/99 Time: 4:27p
* Updated in $/CodeJockey/Include
*
* ***************** Version 4 *****************
* User: Kirk Stowell Date: 7/25/99 Time: 12:42a
* Updated in $/CodeJockey/Include
*
* ***************** Version 3 *****************
* User: Kirk Stowell Date: 6/23/99 Time: 12:33a
* Updated in $/CodeJockey/Include
*
* ***************** Version 2 *****************
* User: Kirk Stowell Date: 7/18/99 Time: 10:17p
* Updated in $/CodeJockey/Include
* Cleaned up inline functions, and import/export macro so that class will
* be imported when linked to, and exported at compile time.
*
* ***************** Version 1 *****************
* User: Kirk Stowell Date: 6/23/99 Time: 12:04a
* Created in $/CodeJockey/Include
* Copied from MFC, Visual C++ 6 and vc5 Tech. Preview. Added to extend
* functionality to Visual C++ 5 users.
*
***************************************************************************/
/////////////////////////////////////////////////////////////////////////////
#ifndef __CJDATETIMECTRL_H__
#define __CJDATETIMECTRL_H__
class CCJMonthCalCtrl;
// A CCJDateTimeCtrl object encapsulates the functionality of a date and time picker
// control. The date and time picker control (DTP control) provides a simple interface
// to exchange date and time information with a user. This interface contains fields,
// each of which displays a part of the date and time information stored in the control.
// The user can change the information stored in the control by changing the content of
// the string in a given field. The user can move from field to field using the mouse or
// the keyboard.
class _CJX_EXT_CLASS CCJDateTimeCtrl : public CWnd
{
DECLARE_DYNAMIC(CCJDateTimeCtrl)
// Construction / destruction
public:
// Constructs a CDateTimeCtrl object.
//
CCJDateTimeCtrl();
// Destroys a CDateTimeCtrl object.
//
virtual ~CCJDateTimeCtrl();
// Initialization
public:
// Creates the date and time picker control and attaches it to the
// CDateTimeCtrl object. Returns nonzero if creation was successful;
// otherwise 0.
//
BOOL Create(
// Specifies the combination of date time control styles. SeeDate
// and Time Picker Control Styles in the Platform SDK for more information
//about date and time picker styles.
DWORD dwStyle,
// A reference to aRECT structure, which is the position and size of the
// date and time picker control.
const RECT& rect,
// A pointer to a CWnd object that is the parent window of the date and
// time picker control. It must not be NULL.
CWnd* pParentWnd,
// Specifies the date and time picker control's control ID.
UINT nID);
// Attributes
public:
// Retrieves the color for a given portion of the month calendar within the
// date and time picker control. Returns a COLORREF value that represents the
// color setting for the specified portion of the month calendar control if
// successful. The function returns -1 if unsuccessful.
//
COLORREF GetMonthCalColor(
// An int value specifying which color area of the month calendar to
// retrieve. For a list of values, see the iColor parameter for
// SetMonthCalColor.
int iColor) const;
// Sets the color for a given portion of the month calendar within a date
// and time picker control. Returns a COLORREF value that represents the
// previous color setting for the specified portion of the month calendar
// control if successful. Otherwise, the message returns -1.
//
COLORREF SetMonthCalColor(
// int value specifying which area of the month calendar control to set.
// This value can be one of the following.
//
// Value Meaning
// MCSC_BACKGROUND Set the background color displayed between months.
// MCSC_MONTHBK Set the background color displayed within a month.
// MCSC_TEXT Set the color used to display text within a month.
// MCSC_TITLEBK Set the background color displayed in the calendar's title.
// MCSC_TITLETEXT Set the color used to display text within the calendar's title.
// MCSC_TRAILINGTEXT Set the color used to display header and trailing-day text. Header and trailing days are the days from the previous and following months that appear on the current calendar.
int iColor,
// A COLORREF value representing the color that will be set for the specified
// area of the month calendar.
COLORREF ref);
// Sets the display of a date and time picker control based on a given format string.
// Returns nonzero if successful; otherwise 0.
//
BOOL SetFormat(
// A pointer to a zero-terminated format string that defines the desired display.
// Setting this parameter to NULL will reset the control to the default format
// string for the current style.
LPCTSTR pstrFormat);
// Retrieves the date and time picker's child month calendar control.
// Returns a pointer to a CMonthCalCtrl object, or NULL if unsuccessful or if
// the window is not visible.
//
CCJMonthCalCtrl* GetMonthCalCtrl() const;
// Retrieves the font currently used by the date and time picker control's child
// month calendar control. Returns a pointer to a CFont object, or NULL if unsuccessful.
//
CFont* GetMonthCalFont() const;
// Sets the font to be used by the date and time picker control's child month
// calendar control.
void SetMonthCalFont(
// Handle to the font that will be set.
HFONT hFont,
// Specifies whether the control should be redrawn immediately upon setting the
// font. Setting this parameter to TRUE causes the control to redraw itself.
BOOL bRedraw = TRUE);
// Sets the minimum and maximum allowable system times for a date and time
// picker control. Returns nonzero if successful; otherwise 0.
//
BOOL SetRange(
// A pointer to a COleDateTime object containing the
// earliest time allowed in the CDateTimeCtrl object.
const COleDateTime* pMinRange,
// A pointer to a COleDateTime object containing the
// latest time allowed in the CDateTimeCtrl object.
const COleDateTime* pMaxRange);
// Sets the minimum and maximum allowable system times for a date and time
// picker control. Returns nonzero if successful; otherwise 0.
//
BOOL SetRange(
// A pointer to a CTime object containing the
// earliest time allowed in the CDateTimeCtrl object.
const CTime* pMinRange,
// A pointer to a CTime object containing the
// latest time allowed in the CDateTimeCtrl object.
const CTime* pMaxRange);
// Retrieves the current minimum and maximum allowable system times for a date
// and time picker control. Returns a DWORD value containing flags that indicate
// which ranges are set.
//
DWORD GetRange(
// A pointer to a COleDateTime object containing the
// earliest time allowed in the CDateTimeCtrl object.
COleDateTime* pMinRange,
// A pointer to a COleDateTime object c
评论1