PlayerListCtrl.h

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #pragma once
00023 
00024 #define LVN_DOLABELEDIT (LVN_FIRST+1)
00025 
00026 class CInPlaceEdit : public CEdit
00027 {
00028 private:
00029         int m_iItem;
00030         int m_iSubItem;
00031         CString m_sInitText;
00032         BOOL m_bESC; // To indicate whether ESC key was pressed
00033 
00034 public:
00035         CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
00036         virtual ~CInPlaceEdit();
00037 
00038 protected:
00039         virtual BOOL PreTranslateMessage(MSG* pMsg);
00040 
00041         DECLARE_MESSAGE_MAP()
00042 
00043 public:
00044         afx_msg void OnKillFocus(CWnd* pNewWnd);
00045         afx_msg void OnNcDestroy();
00046         afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00047         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00048 };
00049 
00050 class CInPlaceComboBox : public CComboBox
00051 {
00052 private:
00053         int m_iItem;
00054         int m_iSubItem;
00055         CList<CString> m_lstItems;
00056         int m_nSel;
00057         BOOL m_bESC; // To indicate whether ESC key was pressed
00058 
00059 public:
00060         CInPlaceComboBox(int iItem, int iSubItem, CList<CString>& plstItems, int nSel);
00061         virtual ~CInPlaceComboBox();
00062 
00063 protected:
00064         virtual BOOL PreTranslateMessage(MSG* pMsg);
00065 
00066         DECLARE_MESSAGE_MAP()
00067 
00068 public:
00069         afx_msg void OnKillFocus(CWnd* pNewWnd);
00070         afx_msg void OnNcDestroy();
00071         afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00072         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00073         afx_msg void OnCloseup();
00074 };
00075 
00076 class CInPlaceListBox : public CListBox
00077 {
00078 private:
00079         int m_iItem;
00080         int m_iSubItem;
00081         CList<CString> m_lstItems;
00082         int m_nSel;
00083         BOOL m_bESC; // To indicate whether ESC key was pressed
00084 
00085 public:
00086         CInPlaceListBox(int iItem, int iSubItem, CList<CString>& plstItems, int nSel);
00087         virtual ~CInPlaceListBox();
00088 
00089 protected:
00090         virtual BOOL PreTranslateMessage(MSG* pMsg);
00091 
00092         DECLARE_MESSAGE_MAP()
00093 
00094 public:
00095         afx_msg void OnKillFocus(CWnd* pNewWnd);
00096         afx_msg void OnNcDestroy();
00097         afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00098         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00099 };
00100 
00101 // CPlayerListCtrl
00102 
00103 class CPlayerListCtrl : public CListCtrl
00104 {
00105         DECLARE_DYNAMIC(CPlayerListCtrl)
00106 
00107 private:
00108         int m_nItemClicked, m_nSubItemClicked;
00109         int m_tStartEditingDelay;
00110 
00111         bool PrepareInPlaceControl(int nRow, int nCol, CRect& rect);
00112 
00113 public:
00114         CPlayerListCtrl(int tStartEditingDelay = 500);
00115         virtual ~CPlayerListCtrl();
00116 
00117         int HitTestEx(CPoint& point, int* col) const;
00118         CImageList* CreateDragImageEx(LPPOINT lpPoint);
00119 
00120         int GetBottomIndex() const;
00121 
00122         CEdit* ShowInPlaceEdit(int nItem, int nCol);
00123         CComboBox* ShowInPlaceComboBox(int nItem, int nCol, CList<CString>& lstItems, int nSel);
00124         CListBox* ShowInPlaceListBox(int nItem, int nCol, CList<CString>& lstItems, int nSel);
00125 
00126         bool m_fInPlaceDirty;
00127 
00128 protected:
00129         virtual void PreSubclassWindow();
00130         virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
00131 
00132         DECLARE_MESSAGE_MAP()
00133 
00134 public:
00135         afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00136         afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00137         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00138         afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00139         afx_msg void OnTimer(UINT nIDEvent);
00140         afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00141         afx_msg void OnLvnMarqueeBegin(NMHDR* pNMHDR, LRESULT* pResult);
00142         afx_msg void OnLvnInsertitem(NMHDR* pNMHDR, LRESULT* pResult);
00143         afx_msg void OnLvnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00144         afx_msg void OnEnChangeEdit1();
00145         afx_msg void OnCbnDropdownCombo1();
00146         afx_msg void OnCbnSelendokCombo1();
00147         afx_msg void OnLbnSelChangeList1();
00148         afx_msg BOOL OnHdnItemchanging(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
00149         afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
00150 };

Generated on Tue Dec 13 14:46:58 2005 for guliverkli by  doxygen 1.4.5