Click here to Skip to main content
15,897,704 members
Articles / Containers / Virtual Machine

TOOL

Rate me:
Please Sign up or sign in to vote.
4.98/5 (52 votes)
23 Oct 200676 min read 231.4K   5.4K   147  
TOOL (Tiny Object Oriented Language) is an easily-embedded, object-oriented, C++-like-language interpreter. The purpose of this article is to introduce the TOOL interpreter and language from the perspective of a person who has a desire to include a scripting solution as part of his project.
#ifndef XML_FORM_CALENDAR_CONTROL_H_INCLUDED
#define XML_FORM_CALENDAR_CONTROL_H_INCLUDED
/*****************************************************************************/
/*                              HEADER FILE                                  */
/*****************************************************************************/
/*
       $Archive:   $

      $Revision:   $
          $Date:   $
        $Author:   $

    Description: This class implements date edit window with ability
                 to visually pick a date from a calendar

                 To use it in resouce (for example, in CFormView or 
                 CDialog-derived classes you just place CStatic or CEdit
                 control with apropriate ID (rather than -1) on your form 
                 and replace ClassWizard-provided member variable type to 
                 CCalendar (don't forget include CCalendar.h header file)
                 Use Create member function to create it dynamically

                 When CCalendar receives input focus, it looks like drop-
                 down combo box showing current date in edit field. When 
                 user clicks the down arrow, a calendar window appears. 
                 It shows the days of the week on top. Then 6 lines to show 
                 the days of the month. The days of current month are shown 
                 in black. The days of the previous and next month are shown
                 in a lighter color
 
                 Now user can select a date by mouse clicking and jump to 
                 the previous or next month.Also he can select the date of 
                 today using button with same name. Other button can be used 
                 to select no date. In the latter case the combo box will also 
                 shows "None".

                 If user type a date in text field and click down arrow, 
                 calendar window initially will show a month contained this date.
                 If no text has been typed, it will show current month.

                      TOOL And XML FORMS License
                      ==========================

                      Except where otherwise noted, all of the documentation 
                      and software included in the TOOL package is 
                      copyrighted by Michael Swartzendruber.

                      Copyright (C) 2005 Michael John Swartzendruber. 
                      All rights reserved.

                      Access to this code, whether intentional or accidental,
                      does NOT IMPLY any transfer of rights.

                      This software is provided "as-is," without any express 
                      or implied warranty. In no event shall the author be held
                      liable for any damages arising from the use of this software.

                      Permission is granted to anyone to use this software for 
                      any purpose, including commercial applications, and to 
                      alter and redistribute it, provided that the following 
                      conditions are met:

                      1. All redistributions of source code files must retain 
                         all copyright notices that are currently in place, 
                         and this list of conditions without modification.

                      2. The origin of this software must not be misrepresented;
                         you must not claim that you wrote the original software.

                      3. If you use this software in another product, an acknowledgment
                         in the product documentation would be appreciated but is
                         not required.

                      4. Modified versions in source or binary form must be plainly 
                         marked as such, and must not be misrepresented as being 
                         the original software.
*/
/*****************************************************************************/


#include <vector>

#include "XMLFormControls.h"



class CXMLFormCalendarControl : public CDateTimeCtrl, CXMLFormControl
{
public:
  virtual void CreateToolTip( void );

  virtual void SetDDVHandler( P_FORM_CONTROL_DDV_TYPE pxMyDDV )
  {
    m_pxMyDDV = pxMyDDV;
  };

  virtual void SetDDXHandler( P_FORM_CONTROL_DDX_TYPE pxMyDDX )
  {
    m_pxMyDDX = pxMyDDX;
  };

  //{{AFX_VIRTUAL( CXMLFormCalendarControl )
  //}}AFX_VIRTUAL


protected:
   COLORREF               m_xTextFocusColor;
   COLORREF               m_xBackFocusColor;
   COLORREF               m_xTextColor;
   COLORREF               m_xBackColor;
   CBrush                 m_oBackBrush;
   CBrush                 m_oBackFocusBrush;
   bool                   m_bHasFocus;
                                                 // 0=Monday, 1=Tuesday, ... 6=Sunday
public:
   CXMLFormCalendarControl( void );

   bool         SetTextFocusColor( COLORREF xColor );
   bool         SetBackFocusColor( COLORREF xColor );
   bool         SetTextColor( COLORREF xColor );
   bool         SetBackColor( COLORREF xColor );
 
public:
   virtual ~CXMLFormCalendarControl( void );


protected:
   //{{AFX_MSG( CXMLFormCalendarControl )
   afx_msg void OnKillFocus( CWnd* poNewWnd );
   afx_msg void OnSetFocus( CWnd* pOldWnd );
   afx_msg HBRUSH CtlColor( CDC* pDC, UINT nCtlColor );
   //}}AFX_MSG
   afx_msg LONG OnValidateNow( WPARAM wParam, LPARAM lParam );
   afx_msg LONG OnDropToolTip( WPARAM wParam, LPARAM lParam );
   afx_msg LONG OnShowToolTip( WPARAM wParam, LPARAM lParam );

   DECLARE_MESSAGE_MAP()
};


#endif


/*****************************************************************************/
/* Check-in history */
/*
 *$Log:   $
*/
/*****************************************************************************/

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions