Click here to Skip to main content
15,896,496 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_SPINBUTTON_H_INCLUDED
#define XML_FORM_SPINBUTTON_H_INCLUDED
/*****************************************************************************/
/*                              HEADER FILE                                  */
/*****************************************************************************/
/*
          $Archive:   $

         $Revision:   $

      Last Checkin:
             $Date:   $
                By:
           $Author:   $

 Last Modification:
          $ModTime:   $

       Description:   This code based on a project found on the web. It has 
                      been significantly reworked, changed to fit the purpose
                      here and otherwise cleaned up, so this file may not
                      resemble the original code at all. Original author's
                      comments shown below:

                      Copyright � 1999 Oleg Lobach, All Rights Reserved.

                      mailto:oleglb@mail.ru
                      or
                      mailto:oleg@alexen.ru


                      This source file may be redistributed unmodified by 
                      any means PROVIDING it is NOT sold for profit without
                      the authors expressed written consent, and providing 
                      that this notice and the authors name and all copyright 
                      notices remain intact. This software is by no means to be 
                      included as part of any third party components library, 
                      or as part any development solution that offers MFC 
                      extensions that are sold for profit. 
 
                      If the source code is used in any commercial applications 
                      then a statement along the lines of:
 
                      "Portions Copyright � 1999 Oleg Lobach" must be included 
                      in the "Startup Banner", "About Box" or "Printed Documentation".
                      This software is provided "as is" without express or implied 
                      warranty. Use it at your own risk! The author(s) accepts no 
                      liability for any damage/loss of business that this product 
                      may cause.


                      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.
*/
/*****************************************************************************/



#if _MSC_VER > 1000
#pragma once
#endif


#include "XMLFormCoreStructures.h"


class CXMLFormSpinButton : public CSpinButtonCtrl
{
public:
  CXMLFormSpinButton( void );
  virtual ~CXMLFormSpinButton( void );

  bool SetAutoDisable( bool bSetOn );
  void SetBuddyValueType( eDataType eBuddyDataType )
  {
    m_eBuddyDataType = eBuddyDataType;
  };

  void SetPrecision( int iPrecision )
  {
    m_iPrecision = iPrecision;
  };


protected:	

  //{{AFX_VIRTUAL( CXMLFormSpinButton )
  protected:
  virtual void PreSubclassWindow();
  virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  //}}AFX_VIRTUAL

  virtual void Init( void );
  void CleanUpHook(void ) const;
  void DrawPressedRect( CDC& roDC,const CRect& roDownRect ) const;
  void DisableRect( CDC& roDC, const CRect& roDisableRect ) const;


  //{{AFX_MSG( CXMLFormSpinButton )
  afx_msg BOOL OnDeltapos( NMHDR* pxNMHDR, LRESULT* plResult );
  afx_msg void OnLButtonDown( UINT iFlags, CPoint oPoint );
  afx_msg BOOL OnEraseBkgnd( CDC* poDC );
  afx_msg void OnLButtonUp( UINT iFlags, CPoint oPoint );
  afx_msg void OnDestroy( void );
  afx_msg void OnChar( UINT iChar, UINT iRepeatCount, UINT iFlags );
  afx_msg void OnPaint( void );
  //}}AFX_MSG
  DECLARE_MESSAGE_MAP()


protected:
  HWND  m_hBuddyWindow;
  bool  m_bAutoDisable;
  bool  m_bBuddyIsEdit;
  bool  m_bDefaultDirection;
  bool  m_bActiveSpinPressed;
  bool  m_bVertical;
  CRect m_oPressedRect;
  CRect m_oClientRect;
  int   m_iPreviousPosition;
  int   m_iMinimumPosition;
  int   m_iMaximumPosition;

  enum eDisableState 
  {
    BothEnable = 0,
    DisableRight,
    DisableLeft,
    BothDisable
  };

  enum eRelativePosition
  {
    Outside = 0,
    OnRightInside,
    OnLeftInside
  };

  eRelativePosition  m_eSpinButtonAlignment;
  eDisableState      m_eSpinButtonEnableState;


private:
  void GetDeltaSetIntegerText( bool bUpDown, int iMinValue, int iMaxValue );
  void GetDeltaSetDecimalText( bool bUpDown, int iMinValue, int iMaxValue );


private:
  HPEN      m_hLightShadowPen;
  HPEN      m_hDarkShadowPen;
  HPEN      m_hShadowPen;
  HPEN      m_hLightPen;
  HPEN      m_hButtonFacePen;

  eDataType m_eBuddyDataType;
  bool      m_bUpDown;
  int       m_iPrecision;
};



#endif


/*****************************************************************************/
/* Check-in history 
   $WorkFile:   $
    $Archive:   $

 *$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