147 lines
4.0 KiB
C++
147 lines
4.0 KiB
C++
#if !defined(__CMFCGRIDCTRLCELLCOMBO_H__)
|
|
#define __CMFCGRIDCTRLCELLCOMBO_H__
|
|
|
|
#if _MSC_VER >= 1000
|
|
#pragma once
|
|
#endif // _MSC_VER >= 1000
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// GridCellCombo.h : header file
|
|
//
|
|
// MFC Grid Control - Grid combo cell class header file
|
|
//
|
|
// Written by Chris Maunder <cmaunder@mail.com>
|
|
// Copyright (c) 1998-2002. All Rights Reserved.
|
|
//
|
|
// This code may be used in compiled form in any way you desire. This
|
|
// file may be redistributed unmodified by any means PROVIDING it is
|
|
// not sold for profit without the authors written consent, and
|
|
// providing that this notice and the authors name and all copyright
|
|
// notices remains intact.
|
|
//
|
|
// An email letting me know how you are using it would be nice as well.
|
|
//
|
|
// This file is provided "as is" with no expressed or implied warranty.
|
|
// The author accepts no liability for any damage/loss of business that
|
|
// this product may cause.
|
|
//
|
|
// For use with CMfcGridCtrl v2.10
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "MfcGridCtrlCell.h"
|
|
#include "MfcGridCtrlCheckComboBox.h"
|
|
|
|
class THVAC_UIAPI CMfcGridCtrlCellCombo : public CMfcGridCtrlCell
|
|
{
|
|
friend class CMfcGridCtrl;
|
|
DECLARE_DYNCREATE(CMfcGridCtrlCellCombo)
|
|
|
|
public:
|
|
CMfcGridCtrlCellCombo();
|
|
|
|
// editing cells
|
|
public:
|
|
virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
|
|
virtual CWnd* GetEditWnd() const;
|
|
virtual void EndEdit();
|
|
|
|
// Operations
|
|
public:
|
|
virtual CSize GetCellExtent(CDC* pDC);
|
|
|
|
// CMfcGridCtrlCellCombo specific calls
|
|
public:
|
|
void SetOptions(CStringArray& ar);
|
|
void SetStyle(DWORD dwStyle) { m_dwStyle = dwStyle; }
|
|
DWORD GetStyle() { return m_dwStyle; }
|
|
|
|
protected:
|
|
virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
|
|
|
|
CStringArray m_Strings;
|
|
DWORD m_dwStyle;
|
|
};
|
|
|
|
|
|
#define IDC_COMBOEDIT 1001
|
|
|
|
class THVAC_UIAPI CMfcGridCtrlComboEdit : public CEdit
|
|
{
|
|
public:
|
|
CMfcGridCtrlComboEdit();
|
|
|
|
public:
|
|
//{{AFX_VIRTUAL(CMfcGridCtrlComboEdit)
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
|
//}}AFX_VIRTUAL
|
|
|
|
public:
|
|
virtual ~CMfcGridCtrlComboEdit();
|
|
|
|
protected:
|
|
//{{AFX_MSG(CMfcGridCtrlComboEdit)
|
|
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
|
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
|
|
class CMfcGridCtrlInPlaceList : public CMfcGridCtrlCheckComboBox
|
|
{
|
|
friend class CMfcGridCtrlComboEdit;
|
|
|
|
public:
|
|
CMfcGridCtrlInPlaceList(CWnd* pParent, // parent
|
|
CRect& rect, // dimensions & location
|
|
DWORD dwStyle, // window/combobox style
|
|
UINT nID, // control ID
|
|
int nRow, int nColumn, // row and column
|
|
COLORREF crFore, COLORREF crBack, // Foreground, background colour
|
|
CStringArray& Items, // Items in list
|
|
CString sInitText, // initial selection
|
|
UINT nFirstChar); // first character to pass to control
|
|
|
|
public:
|
|
CMfcGridCtrlComboEdit m_edit; // subclassed edit control
|
|
|
|
public:
|
|
//{{AFX_VIRTUAL(CMfcGridCtrlInPlaceList)
|
|
protected:
|
|
virtual void PostNcDestroy();
|
|
//}}AFX_VIRTUAL
|
|
|
|
public:
|
|
virtual ~CMfcGridCtrlInPlaceList();
|
|
void EndEdit();
|
|
|
|
protected:
|
|
int GetCorrectDropWidth();
|
|
|
|
protected:
|
|
//{{AFX_MSG(CMfcGridCtrlInPlaceList)
|
|
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
|
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
afx_msg void OnDropdown();
|
|
afx_msg UINT OnGetDlgCode();
|
|
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
private:
|
|
int m_nNumLines;
|
|
CString m_sInitText;
|
|
int m_nRow;
|
|
int m_nCol;
|
|
UINT m_nLastChar;
|
|
BOOL m_bExitOnArrows;
|
|
COLORREF m_crForeClr, m_crBackClr;
|
|
};
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
|
|
#endif // !defined(__CMfcGridCtrlCELLCOMBO_H__)
|