#if !defined(AFX_PROPERTYLISTBOX_H__D0F6C79A_1140_11D4_943D_00AA006CE82B__INCLUDED_) #define AFX_PROPERTYLISTBOX_H__D0F6C79A_1140_11D4_943D_00AA006CE82B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CPropertyItem : public CObject { public: enum ItemStyle { EDT_NONE = 1, EDT_NUM = 2, EDT_REAL = 3, EDT_SPIN = 4, BTN_NONE = 5, BTN_EDIT = 6, BTN_EDIT_SELFILE= 7, BTN_EDIT_SELPATH= 8, CMB_LIST = 9, CMB_LIST_YESNO = 10, CMB_DOWN = 11, } m_eNameStyle, m_eValueStyle; CString m_sName; CString m_sValue; BOOL m_bNameEditable; BOOL m_bValueEditable; CString m_sFileFilter; CStringList* m_pNameStrList; CStringList* m_pValueStrList; DWORD_PTR m_dwUserData; DWORD_PTR m_dwUserDataEx; public: virtual ~CPropertyItem(); CPropertyItem(); CPropertyItem(CString sName, CString sValue, ItemStyle nStyle, BOOL bNameEditable = FALSE, BOOL bValueEditable = TRUE, CStringList* pStrList = NULL, CString sFileFilter = _T("")); CPropertyItem& operator = (const CPropertyItem& item); virtual CStringList* OnComboAskStringList(BOOL bName) {return NULL;} virtual void OnEditCtrlChange() {;} virtual void OnComboSelectChange() {;} virtual void OnComboEditChange() {;} virtual void OnButtonClicked() {;} protected: DECLARE_DYNAMIC(CPropertyItem) }; ///////////////////////////////////////////////////////////////////////////// // CPropertyItem class CPropertyItemTab : public CPropertyItem { public: BOOL m_bExpand; CList m_listItem; DWORD_PTR m_dwUserParam; public: virtual ~CPropertyItemTab(); CPropertyItemTab(); CPropertyItemTab(CString sName, BOOL bExpand = FALSE, CString sValue = _T(""), ItemStyle nStyle = EDT_NONE, BOOL bNameEditable = FALSE, BOOL bValueEditable = FALSE, CStringList* pStrList = NULL, CString sFileFilter = _T("")); CPropertyItemTab(CPropertyItem& item, BOOL bExpand = FALSE); CPropertyItemTab& operator = (const CPropertyItemTab& tab); protected: DECLARE_DYNAMIC(CPropertyItemTab) }; ///////////////////////////////////////////////////////////////////////////// // CPropertyListBox window #include "TitleTip.h" class CPropertyListBox : public CListBox { DECLARE_DYNAMIC(CPropertyListBox) public: virtual ~CPropertyListBox(); CPropertyListBox(); public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPropertyListBox) public: virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); protected: virtual void PreSubclassWindow(); //}}AFX_VIRTUAL public: CPropertyItemTab* AddTab(CString sName, BOOL bExpand = FALSE, BOOL bNameEditable = FALSE, CString sValue = _T(""), CPropertyItem::ItemStyle nStyle = CPropertyItem::EDT_NONE, BOOL bValueEditable = FALSE); CPropertyItemTab* AddTab(CPropertyItem& item, BOOL bExpand = FALSE); CPropertyItemTab* AddTab(CPropertyItemTab& tab); BOOL DeleteTab(UINT nTabIndex); BOOL DeleteTab(CString sTabName); BOOL DeleteTab(CPropertyItemTab*& pTab); CPropertyItemTab* InsertTab(int iTabIndex, CString sName, BOOL bExpand, BOOL bNameEditable, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable); CPropertyItemTab* InsertTab(CString sTabName, CString sName, BOOL bExpand, BOOL bNameEditable, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable); CPropertyItemTab* InsertTab(CPropertyItemTab*& pTab, CString sName, BOOL bExpand, BOOL bNameEditable, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable); CPropertyItemTab* InsertTab(int iTabIndex, CPropertyItem& item, BOOL bExpand); CPropertyItemTab* InsertTab(CString sTabName, CPropertyItem& item, BOOL bExpand); CPropertyItemTab* InsertTab(CPropertyItemTab*& pTab, CPropertyItem& item, BOOL bExpand); CPropertyItemTab* InsertTab(int iTabIndex, CPropertyItemTab& tab); CPropertyItemTab* InsertTab(CString sTabName, CPropertyItemTab& tab); CPropertyItemTab* InsertTab(CPropertyItemTab*& pTab, CPropertyItemTab& tab); BOOL AddItem(UINT nTabIndex, CString sName, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable = TRUE, BOOL bNameEditable = FALSE, CStringList* pStrList = NULL, CString sFileFilter = _T("")); BOOL AddItem(CString sTabName, CString sName, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable = TRUE, BOOL bNameEditable = FALSE, CStringList* pStrList = NULL, CString sFileFilter = _T("")); BOOL AddItem(CPropertyItemTab*& pTab, CString sName, CString sValue, CPropertyItem::ItemStyle nStyle, BOOL bValueEditable = TRUE, BOOL bNameEditable = FALSE, CStringList* pStrList = NULL, CString sFileFilter = _T("")); BOOL AddItem(UINT nTabIndex, CPropertyItem& item); BOOL AddItem(CString sTabName, CPropertyItem& item); BOOL AddItem(CPropertyItemTab*& pTab, CPropertyItem& item); BOOL InsertItem(UINT nTabIndex, int iItemIndex, CPropertyItem& item); BOOL InsertItem(CPropertyItemTab*& pTab, int iItemIndex, CPropertyItem& item); BOOL InsertItem(UINT nTabIndex, CPropertyItem*& pItem, CPropertyItem& item); BOOL InsertItem(CPropertyItemTab*& pTab, CPropertyItem*& pItem, CPropertyItem& item); BOOL DeleteItem(UINT nTabIndex, UINT nItemIndex); BOOL DeleteItem(UINT nTabIndex, CString sItemName); BOOL DeleteItem(UINT nTabIndex, CPropertyItem*& pItem); BOOL DeleteItem(CString sTabName, UINT nItemIndex); BOOL DeleteItem(CString sTabName, CString sItemName); BOOL DeleteItem(CString sTabName, CPropertyItem*& pItem); BOOL DeleteItem(CPropertyItemTab*& pTab, UINT nItemIndex); BOOL DeleteItem(CPropertyItemTab*& pTab, CString sItemName); BOOL DeleteItem(CPropertyItemTab*& pTab, CPropertyItem*& pItem); POSITION GetFirstTabPositon(); POSITION GetLastTabPositon(); CPropertyItemTab* GetNextTab(POSITION& pos); CPropertyItemTab* GetPrevTab(POSITION& pos); POSITION GetTabPosition(CPropertyItemTab* pTab); POSITION FindTab(CPropertyItemTab*& pTab, CString sTabName); POSITION FindTab(CPropertyItemTab*& pTab, UINT nTabIndex); POSITION FindItem(CPropertyItem*& pItem, CPropertyItemTab*& pTab, CString sItemName); POSITION FindItem(CPropertyItem*& pItem, CPropertyItemTab*& pTab, UINT nItemIndex); int FindTabIndex(CString sTabName, UINT nStart = 0); int FindTabIndex(CPropertyItemTab* pTab, UINT nStart = 0); int FindItemIndex(CString sItemName, UINT nTabIndex, UINT nStart = 0); int FindIndex(CPropertyItem* pItem); int GetCurSel(); void GetCurSel(int& iTabIndex, int& iItemIndex); void GetCurSel(int& iTabIndex, CPropertyItem*& pItem); void GetCurSel(CPropertyItemTab*& pTab, int& iItemIndex); void GetCurSel(CPropertyItemTab*& pTab, CPropertyItem*& pItem); void SetCurSel(int iTabIndex, int iItemIndex); void SetCurSel(int iTabIndex, CPropertyItem*& pItem); void SetCurSel(CPropertyItemTab*& pTab, int iItemIndex); void SetCurSel(CPropertyItemTab*& pTab, CPropertyItem*& pItem); void CollapseTab(UINT nTabIndex); void CollapseTab(CString sTabName); void CollapseTab(CPropertyItemTab*& pTab); void ExpandTab(UINT nTabIndex); void ExpandTab(CString sTabName); void ExpandTab(CPropertyItemTab*& pTab); UINT GetTabCount(); UINT GetTotalItemCount(); UINT GetItemCount(UINT nTabIndex); UINT GetItemCount(CString sTabName); UINT GetItemCount(CPropertyItemTab*& pTab); UINT SetLeftBorder(UINT nSize); UINT GetLeftBorder(); UINT SetNameWidth(UINT nWidth); UINT GetNameWidth(); void EditName(); void UpdateCtrl(); CWnd* GetSubCtrl(); void ResetContent(); void Reflash(); int AddString(LPCTSTR lpszItem); int InsertString(int nIndex, LPCTSTR lpszItem); int DeleteString(UINT nIndex); int SetItemData(int nIndex, DWORD dwItemData); protected: //{{AFX_MSG(CPropertyListBox) afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnSelchange(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg LRESULT OnChildKillFoucs(WPARAM wParam, LPARAM lParam); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnCaptureChanged(CWnd *pWnd); afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); //}}AFX_MSG afx_msg LRESULT OnChildCtrlValueChanged(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() private: void HideCtrl() { if(m_pWndButton != NULL) m_pWndButton->ShowWindow(SW_HIDE); if(m_pWndSpin != NULL) m_pWndSpin->ShowWindow(SW_HIDE); if(m_pWndCtrl != NULL) m_pWndCtrl->ShowWindow(SW_HIDE); } void CreatSpinCtrl(CRect rect); void MoveCtrl(CPropertyItem*& pItem, CRect rect); void MoveCtrl(CPropertyItem*& pItem, CRect& rect, BOOL bName); void DoCollapseExpand(CPropertyItem*& pItem); CRect GetItemValueRect(CRect& rect); BOOL IsHitOnSeperator(CRect* pRect = NULL); void StartTracking(); void StopTracking(BOOL bCancel = FALSE); void DrawSeperator(); CTitleTip m_titletip; BOOL m_bEditName; BOOL m_bSeperate; CRect m_rcSeperator; CRect m_rcTrack; int m_iCurSel; UINT m_nLeftBorder; UINT m_nNameWidth; CWnd* m_pWndCtrl; CWnd* m_pWndButton; CSpinButtonCtrl* m_pWndSpin; CList m_listItemTab; }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_PROPERTYLISTBOX_H__D0F6C79A_1140_11D4_943D_00AA006CE82B__INCLUDED_)