#ifndef _INPLACECTRLS_H #define _INPLACECTRLS_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define IPCMSGSTRING TEXT("AViewerCtrlMsg") #define IPEK_KEY 1 #define IPEK_ACTION 2 #define IPEK_KILLFOUCE 3 #ifndef WM_USER_CHILDVALUECHANGED #define WM_USER_CHILDVALUECHANGED WM_USER + 10 #endif #pragma pack( push, 1 ) typedef struct tagIPCENDINFO { HWND hwndSrc; // Event source UINT uKind; // Event (key press, focus change, etc ) union { UINT uID; // Control ID (for actions) UINT nVirtKey; // Virtual key HWND hNewWnd; // New window with focus }; POINT pt; // Event point, in screen coordinates } IPCENDINFO, FAR *LPIPCENDINFO; #pragma pack( pop ) ////////////////////////////////////////////// // CInPlaceEdit class ////////////////////////////////////////////// class CInPlaceEdit: public CEdit { DECLARE_DYNCREATE( CInPlaceEdit ) public: CInPlaceEdit(); virtual ~CInPlaceEdit(); void SetNum(BOOL bNum) {m_bIsNum = bNum;} BOOL IsNum() {return m_bIsNum;} void SetReal(BOOL bReal) {m_bReal = bReal;} BOOL IsReal() {return m_bReal;} public: static void CreateCtrl(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent, CString sValue, BOOL bIsNum = FALSE, BOOL bReal = FALSE); static void CreateCtrl1(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent, CString sValue, BOOL bNum, BOOL bReal = FALSE); //{{AFX_VIRTUAL(CInPlaceEdit) public: virtual BOOL PreTranslateMessage(MSG* pMsg); //}}AFX_VIRTUAL protected: private: BOOL m_bReal; BOOL m_bIsNum; HWND m_hParent; //{{AFX_MSG(CInPlaceEdit) afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct ); afx_msg void OnKillFocus( CWnd *pNewWnd ); afx_msg void OnChange(); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; // class CInPlaceEdit ////////////////////////////////////////////// // CInPlaceButton class ////////////////////////////////////////////// class CInPlaceButton: public CButton { DECLARE_DYNCREATE( CInPlaceButton ) public: CInPlaceButton(); virtual ~CInPlaceButton(); public: static void CreateCtrl(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent, CString sValue); static void CreateCtrl1(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent); //{{AFX_VIRTUAL(CInPlaceButton) public: virtual BOOL PreTranslateMessage(MSG* pMsg); virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); //}}AFX_VIRTUAL protected: private: HWND m_hParent; BOOL m_bInAction; //{{AFX_MSG(CInPlaceButton) afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct ); afx_msg void OnKillFocus( CWnd *pNewWnd ); afx_msg void OnClick(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: BOOL m_bMouseUp; }; // class CInPlaceButton ///////////////////////////////////////////////////////////////////////////// // CInPlaceComboBox window ///////////////////////////////////////////////////////////////////////////// class CInPlaceComboBox : public CComboBox { DECLARE_DYNCREATE( CInPlaceComboBox ) // Construction public: CInPlaceComboBox(); // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CInPlaceComboBox) public: virtual BOOL PreTranslateMessage(MSG* pMsg); protected: //}}AFX_VIRTUAL // Implementation public: static void CreateCtrl1(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent, CString sValue, CStringList* pStrList, UINT nHeight, BOOL bList); void SetFrameRect(CRect rect, BOOL bList); BOOL IsList() {return m_bList;} static void CreateCtrl(CWnd *&pWndCtrl, CRect rect, CWnd *pWndParent, CString sValue, CStringArray &strArr, UINT nHeight, BOOL bList); virtual ~CInPlaceComboBox(); // Generated message map functions protected: //{{AFX_MSG(CInPlaceComboBox) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg void OnPaint(); afx_msg void OnDropdown(); afx_msg void OnCloseup(); afx_msg void OnSelendok(); afx_msg void OnEditchange(); afx_msg void OnKillfocus(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: BOOL m_bList; BOOL m_bDrop; CRect m_rect; HWND m_hParent; }; #endif // _INPLACECTRLS_H