Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

GridCellCombo.h

00001 #if !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
00002 #define AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
00003 
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007 
00009 // GridCellCombo.h : header file
00010 //
00011 // MFC Grid Control - Grid combo cell class header file
00012 //
00013 // Written by Chris Maunder <cmaunder@mail.com>
00014 // Copyright (c) 1998-2002. All Rights Reserved.
00015 //
00016 // This code may be used in compiled form in any way you desire. This
00017 // file may be redistributed unmodified by any means PROVIDING it is 
00018 // not sold for profit without the authors written consent, and 
00019 // providing that this notice and the authors name and all copyright 
00020 // notices remains intact. 
00021 //
00022 // An email letting me know how you are using it would be nice as well. 
00023 //
00024 // This file is provided "as is" with no expressed or implied warranty.
00025 // The author accepts no liability for any damage/loss of business that
00026 // this product may cause.
00027 //
00028 // For use with CGridCtrl v2.10
00029 //
00031 
00032 
00033 #include "GridCell.h"
00034 
00035 
00036 class CGridCellCombo : public CGridCell
00037 {
00038     friend class CGridCtrl;
00039     DECLARE_DYNCREATE(CGridCellCombo)
00040 
00041 public:
00042     CGridCellCombo();
00043 
00044 // editing cells
00045 public:
00046     virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
00047     virtual CWnd* GetEditWnd() const;
00048     virtual void  EndEdit();
00049 
00050 // Operations
00051 public:
00052         virtual CSize GetCellExtent(CDC* pDC);
00053 
00054 // CGridCellCombo specific calls
00055 public:
00056     void  SetOptions(CStringArray& ar);
00057     void  SetStyle(DWORD dwStyle)           { m_dwStyle = dwStyle; }
00058     DWORD GetStyle()                        { return m_dwStyle;    }
00059 
00060 protected:
00061     virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
00062 
00063     CStringArray m_Strings;
00064     DWORD        m_dwStyle;
00065 };
00066 
00067 
00068 
00070 // CComboEdit window
00071 
00072 #define IDC_COMBOEDIT 1001
00073 
00074 class CComboEdit : public CEdit
00075 {
00076 // Construction
00077 public:
00078         CComboEdit();
00079 
00080 // Attributes
00081 public:
00082 
00083 // Operations
00084 public:
00085 
00086 // Overrides
00087         // ClassWizard generated virtual function overrides
00088         //{{AFX_VIRTUAL(CComboEdit)
00089         virtual BOOL PreTranslateMessage(MSG* pMsg);
00090         //}}AFX_VIRTUAL
00091 
00092 // Implementation
00093 public:
00094         virtual ~CComboEdit();
00095 
00096         // Generated message map functions
00097 protected:
00098         //{{AFX_MSG(CComboEdit)
00099         afx_msg void OnKillFocus(CWnd* pNewWnd);
00100         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00101         afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00102         //}}AFX_MSG
00103 
00104         DECLARE_MESSAGE_MAP()
00105 };
00106 
00108 // CInPlaceList window
00109 
00110 class CInPlaceList : public CComboBox
00111 {
00112     friend class CComboEdit;
00113 
00114 // Construction
00115 public:
00116         CInPlaceList(CWnd* pParent,         // parent
00117                  CRect& rect,           // dimensions & location
00118                  DWORD dwStyle,         // window/combobox style
00119                  UINT nID,              // control ID
00120                  int nRow, int nColumn, // row and column
00121                  COLORREF crFore, COLORREF crBack,  // Foreground, background colour
00122                                  CStringArray& Items,   // Items in list
00123                  CString sInitText,     // initial selection
00124                                  UINT nFirstChar);      // first character to pass to control
00125 
00126 // Attributes
00127 public:
00128    CComboEdit m_edit;  // subclassed edit control
00129 
00130 // Operations
00131 public:
00132 
00133 // Overrides
00134         // ClassWizard generated virtual function overrides
00135         //{{AFX_VIRTUAL(CInPlaceList)
00136         protected:
00137         virtual void PostNcDestroy();
00138         //}}AFX_VIRTUAL
00139 
00140 // Implementation
00141 public:
00142         virtual ~CInPlaceList();
00143     void EndEdit();
00144 
00145 protected:
00146     int GetCorrectDropWidth();
00147 
00148 // Generated message map functions
00149 protected:
00150         //{{AFX_MSG(CInPlaceList)
00151         afx_msg void OnKillFocus(CWnd* pNewWnd);
00152         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00153         afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00154         afx_msg void OnDropdown();
00155         afx_msg UINT OnGetDlgCode();
00156         afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
00157         //}}AFX_MSG
00158         //afx_msg void OnSelendOK();
00159 
00160         DECLARE_MESSAGE_MAP()
00161 
00162 private:
00163         int              m_nNumLines;
00164         CString  m_sInitText;
00165         int              m_nRow;
00166         int              m_nCol;
00167         UINT     m_nLastChar; 
00168         BOOL     m_bExitOnArrows; 
00169     COLORREF m_crForeClr, m_crBackClr;
00170 };
00171 
00173 
00174 //{{AFX_INSERT_LOCATION}}
00175 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00176 
00177 #endif // !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)

Generated on Tue Feb 17 02:03:03 2004 for harlem by doxygen 1.3.6