/***********************************************************************/ /* Copyright (C) 2002 Definitive Solutions, Inc. All Rights Reserved. */ /* THIS COMPUTER PROGRAM IS PROPRIETARY AND CONFIDENTIAL TO DEFINITIVE */ /* SOLUTIONS, INC. AND ITS LICENSORS AND CONTAINS TRADE SECRETS OF */ /* DEFINITIVE SOLUTIONS, INC. THAT ARE PROVIDED PURSUANT TO A WRITTEN */ /* AGREEMENT CONTAINING RESTRICTIONS ON USE AND DISCLOSURE. ANY USE, */ /* REPRODUCTION, OR TRANSFER EXCEPT AS PROVIDED IN SUCH AGREEMENT */ /* IS STRICTLY PROHIBITED. */ /***********************************************************************/ ///////////////////////////////////////////////////////////////////////////// // How to add this class to your application. // // Add MyEdit.cpp, MyEdit.h, MyEditResource.h, MyEdit.rc2, and MyEdit.bmp // to your project in the usual folders. // // Add this line to the top of your RC2 file: // #include "MyEditResource.h" // MyEdit resources. // // Add this line to the end of your RC2 file: // #include "MyEdit.rc2" // MyEdit resources. // ///////////////////////////////////////////////////////////////////////////// #ifndef MYEDITH_9D2729A1_27B7_11d6_8AC8_00B0D0529ED2_INCLUDED_ #define MYEDITH_9D2729A1_27B7_11d6_8AC8_00B0D0529ED2_INCLUDED_ #pragma once #include "MyButton.h" #include "MyDialog.h" #include "MyEditResource.h" // MyEdit resources. ///////////////////////////////////////////////////////////////////////////// // NOTE! If you rename this class, you must also change where it is // referenced by name in MyDialog.cpp. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // MyEdit class // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyEdit : public CEdit { // Construction. public: MyEdit(const CString& sRegPlacementsKey); virtual ~MyEdit(); DECLARE_DYNAMIC(MyEdit) // Declared but not defined. private: MyEdit(const MyEdit& rhs); MyEdit& operator=(const MyEdit& rhs); // Operations. public: bool SetMask(const CString& sMask, const CString& sLiteral, const CString& sMaskLiteral, const CString& sValid); void SelectTheFont(const CString& sFace, int nPoints); CString GetValue() const; void SetFocusIndicator(bool b); // Implementation. protected: //{{AFX_MSG(MyEdit) afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnEditCut(); afx_msg void OnEditCopy(); afx_msg void OnEditPaste(); afx_msg void OnEditClearAll(); afx_msg void OnEditSelectAll(); afx_msg void OnEditFontUp(); afx_msg void OnEditFontDown(); afx_msg void OnEditEdit(); afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnKillFocus(CWnd* pNewWnd); //}}AFX_MSG DECLARE_MESSAGE_MAP() // Implementation. private: bool CheckChar(UINT uiChar, bool bBeepOnError); void SendChar(UINT uiChar); void CreateTheFont(); // Data, private: bool m_bUseMask; // Toggle whether it uses mask. bool m_bMaskKeyInProgress; // Infinite recursion guard when // sending WM_CHAR. CString m_sValid; // If populated, contains all the legal // chars. CString m_sMask; // The "LLLL LLLL" type mask. Not what // the user sees. CString m_sLiteral; // The "___ __" type mask, which // identifies where 'L', for example, // is a mask, and where it's a fixed // character. Not what the user sees. CString m_sMaskLiteral; // What the user sees as the mask. // The "****-****-****-****-****-****". CString m_sFaceName; // Name of the font: i.e., "Courier". CString m_sRegPlacementsKey; // Where to store placement of edit // dialog in Registry. int m_nPoints; // Point size of the font; i.e., 10. CFont* m_pFont; // Font for this control. Fixed pitch // is a good choice. bool m_bUseFocusIndicator; // Change the style of this contol when // it has focus. }; ///////////////////////////////////////////////////////////////////////////// // MyEditDlg dialog // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyEditDlg : public MyDialog { // Construction. public: MyEditDlg(CWnd* pParent, bool bReadOnly, int nPoints, const CString& sRegPlacementsKey, UINT uiDialogTitle = 0U); virtual ~MyEditDlg(); //{{AFX_DATA(MyEditDlg) enum { IDD = IDD_MYEDIT }; MyButton m_buttonOk; MyButton m_buttonCancel; CEdit m_editEdit; CString m_sEdit; //}}AFX_DATA //{{AFX_VIRTUAL(MyEditDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL // Implementation. protected: //{{AFX_MSG(MyEditDlg) virtual BOOL OnInitDialog(); afx_msg void OnDestroy(); //}}AFX_MSG DECLARE_MESSAGE_MAP() // Data. private: CFont* m_pFont; // Of the edit control only. int m_nPoints; // Of the edit control only. bool m_bReadOnly; // Edit control is read-only. UINT m_uiDialogTitle; // Text for title bar of the dialog box. }; #endif // MYEDITH_9D2729A1_27B7_11d6_8AC8_00B0D0529ED2_INCLUDED_