123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #pragma once
- // CComboBoxExt
- #include "BaseComboBox.h"
- #include "ImageEx.h"
- class CComboBoxExt : public CWnd
- {
- DECLARE_DYNAMIC(CComboBoxExt)
- private:
- class combobox : public CBaseComboBox
- {
- public:
- combobox(){};
- ~combobox(){};
- protected:
- LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- return CComboBox::WindowProc(message, wParam, lParam);
- };
- };
- public:
- CComboBoxExt();
- virtual ~CComboBoxExt();
- CComboBox* GetCmbCtrl(){ return &m_combobox;}
- private:
- combobox m_combobox;
- protected:
- DWORD m_dwStyle, m_dwConfig;
- CFont m_font;
- CString m_lpszText, m_lpszIcon, m_lpszDefault;
- CRect m_rcClient, m_rcText, m_rcIcon, m_rcIconAction;
- CImageEx * m_pIcon;
- BOOL m_bError;
- ENUM_COMBOBOX_TYPE m_combo_type;
- public:
- BOOL GetValidate();
- void GetWindowText(CString& rString);
- void SetWindowText(CString rString);
- // ÖØÔØÔÉúComboBoxº¯Êý
- public:
- void ResetContent();
- int AddString(LPCTSTR lpszString);
- int InsertString(int nIndex, LPCTSTR lpszString);
- int SetItemDataPtr(int nIndex, void* pData);
- void* GetItemDataPtr(int nIndex) const;
- int SetItemData(int nIndex, DWORD_PTR dwItemData);
- DWORD_PTR GetItemData(int nIndex);
- int GetCount() const;
- int GetCurSel() const;
- int SetCurSel(int nSelect);
- void ShowDropDown(BOOL bShowIt = TRUE);
- BOOL GetDroppedState() const;
- void Clear();
- private:
- void OnCbnSelchange();
- protected:
- DECLARE_MESSAGE_MAP()
- virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- virtual void PreSubclassWindow();
- virtual BOOL InitComboBox();
- virtual void OnPaint(CDC *pDC){};
- public:
- virtual BOOL Create(
- CWnd* pParentWnd
- , UINT nID
- , CRect& rect
- , LPCTSTR lpszText = NULL
- , DWORD dwStyle = WS_VISIBLE
- , ENUM_COMBOBOX_TYPE combo_type = COMBOBOX_SELECT
- );
- virtual BOOL Create(
- CWnd* pParentWnd
- , UINT nID
- , CPoint& point
- , CSize& size
- , LPCTSTR lpszText = NULL
- , DWORD dwStyle = WS_VISIBLE
- , ENUM_COMBOBOX_TYPE combo_type = COMBOBOX_SELECT
- );
- afx_msg void OnPaint();
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- };
|