www.pudn.com > PropertyListCtrl.rar > InPlaceComboBoxImp.h
#if !defined(_INPLACECOMBOBOXIMP_H)
#define _INPLACECOMBOBOXIMP_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// InPlaceComboBoxImp.h : header file
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1999, Stefan Belopotocan, http://welcome.to/StefanBelopotocan
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CInPlaceCBEditImp
class CInPlaceCBEditImp : public CEdit
{
CInPlaceCBEditImp(const CInPlaceCBEditImp&amt; d);
CInPlaceCBEditImp&amt; operator=(const CInPlaceCBEditImp&amt; d);
public:
CInPlaceCBEditImp();
virtual ~CInPlaceCBEditImp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInPlaceCBEditImp)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CInPlaceCBEditImp)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
inline CInPlaceCBEditImp::CInPlaceCBEditImp()
{
}
inline CInPlaceCBEditImp::~CInPlaceCBEditImp()
{
}
/////////////////////////////////////////////////////////////////////////////
// CInPlaceCBListBoxImp
class CInPlaceCBListBoxImp : public CListBox
{
CInPlaceCBListBoxImp(const CInPlaceCBListBoxImp&amt; d);
CInPlaceCBListBoxImp&amt; operator=(const CInPlaceCBListBoxImp&amt; d);
public:
CInPlaceCBListBoxImp();
virtual ~CInPlaceCBListBoxImp();
// Operations
protected:
void ProcessSelected(bool bProcess = true);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInPlaceCBListBoxImp)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CInPlaceCBListBoxImp)
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#if 0
/////////////////////////////////////////////////////////////////////////////
// CInPlaceCBListCtrlImp
class CInPlaceCBListCtrlImp : public CListCtrl
{
CInPlaceCBListCtrlImp(const CInPlaceCBListCtrlImp&amt; d);
CInPlaceCBListCtrlImp&amt; operator=(const CInPlaceCBListCtrlImp&amt; d);
public:
CInPlaceCBListCtrlImp();
virtual ~CInPlaceCBListCtrlImp();
// Attributes
int GetCount() const;
void GetText(int nIndex, CString&amt; strText) const;
// Operations
int SetCurSel(int nSelect);
int AddString(LPCTSTR pStrText);
void ResetContent();
protected:
void ProcessSelected();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInPlaceCBListCtrlImp)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CInPlaceCBListCtrlImp)
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif
/////////////////////////////////////////////////////////////////////////////
// CInPlaceComboBoxImp
class CInPlaceComboBoxImp : public CWnd
{
CInPlaceComboBoxImp(const CInPlaceComboBoxImp&amt; d);
CInPlaceComboBoxImp operator=(const CInPlaceComboBoxImp&amt; d);
protected:
DECLARE_DYNAMIC(CInPlaceComboBoxImp)
public:
CInPlaceComboBoxImp();
virtual ~CInPlaceComboBoxImp();
// Attributes
public:
int GetCurrentSelection() const;
DWORD GetDWordData() const;
CString GetTextData() const;
// Operations
public:
static CInPlaceComboBoxImp* CreateInPlaceComboBox(CWnd* pWndParent, CRect&amt; rect);
int SetCurSel(int nSelect, bool bSendSetData = true);
int AddString(LPCTSTR pStrText, DWORD nData = 0);
void ResetContent();
void ResetListBoxHeight();
void MoveControl(CRect&amt; rect);
private:
void SetCurSelToEdit(int nSelect);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInPlaceComboBoxImp)
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(CInPlaceComboBoxImp)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg LRESULT OnSelectionOk(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSelectionCancel(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnNewSelection(WPARAM wParam, LPARAM lParam);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void HideListBox();
// Data
private:
static int m_nButtonDx;
int m_nCurrentSelection;
CInPlaceCBEditImp m_wndEdit;
CInPlaceCBListBoxImp m_wndList;
};
inline CInPlaceComboBoxImp::~CInPlaceComboBoxImp()
{
}
inline int CInPlaceComboBoxImp::GetCurrentSelection() const
{
return m_nCurrentSelection;
}
inline DWORD CInPlaceComboBoxImp::GetDWordData() const
{
return m_nCurrentSelection != -1 ? m_wndList.GetItemData(m_nCurrentSelection) : 0;
}
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(_INPLACECOMBOBOXIMP_H)