1 #ifndef SPRINGLOBBY_PlaybackListCtrl_H_INCLUDED
2 #define SPRINGLOBBY_PlaybackListCtrl_H_INCLUDED
3 
4 #include "../customvirtlistctrl.h"
5 
6 class wxMenu;
7 class wxListEvent;
8 class wxCommandEvent;
9 
10 template <class PlaybackImp>
11 class PlaybackListCtrl : public CustomVirtListCtrl< const PlaybackImp*, PlaybackListCtrl<PlaybackImp> >
12 {
13     protected:
14         typedef PlaybackListCtrl<PlaybackImp>
15             ThisType;
16         typedef CustomVirtListCtrl< const PlaybackImp*,PlaybackListCtrl<PlaybackImp> >
17             ParentType;
18         typedef typename ParentType::DataType
19             DataType;
20         typedef PlaybackImp
21             PlaybackType;
22 
23     using ParentType::AddColumn;
24     using ParentType::m_sortorder;
25     using ParentType::PopupMenu;
26     using ParentType::m_data;
27     using ParentType::m_selected_data;
28     using ParentType::m_selected_index;
29     using ParentType::SaveSelection;
30     using ParentType::RestoreSelection;
31     using ParentType::HitTest;
32     using ParentType::m_comparator;
33     using ParentType::m_tiptimer;
34     using ParentType::m_tiptext;
35     using ParentType::m_colinfovec;
36     using ParentType::m_tooltip_delay;
37     using ParentType::m_tooltip_duration;
38 	using ParentType::RemoveItem;
39 	using ParentType::AddItem;
40 	using ParentType::compareSimple;
41 	using ParentType::SetItemCount;
42 //    using ParentType::DataVector;
43     typedef typename ParentType::DataVector::const_iterator
44         DataCIter; //! TODO (koshi) i'd be mighty thankful if some could explain to me why the import with using ParentType::DataCIter doesn't work here;
45     using ParentType::getColumnFromPosition;
46 
47   public:
48     PlaybackListCtrl( wxWindow* parent );
49     ~PlaybackListCtrl();
50 
51     void AddPlayback( const PlaybackType& replay );
52     void RemovePlayback( const PlaybackType& replay );
53     void RemovePlayback( const int index );
54     void OnListRightClick( wxListEvent& event );
55     void OnDLMap( wxCommandEvent& event );
56     void OnDLMod( wxCommandEvent& event );
57     void OnColClick( wxListEvent& event );
58 
59     virtual void SetTipWindowText( const long item_hit, const wxPoint& position);
60 
HighlightItem(long)61 	virtual void HighlightItem( long /*unused*/ ){}
62 
63     //these are overloaded to use list in virtual style
64     wxString GetItemText(long item, long column) const;
65     int GetItemImage(long item) const;
66     int GetItemColumnImage(long item, long column) const;
67     wxListItemAttr * GetItemAttr(long item) const;
68     int GetIndexFromData( const DataType& data ) const;
69 
70     using ParentType::RefreshVisibleItems;
71     using ParentType::GetDataFromIndex;
72 
73   protected:
74 	int CompareOneCrit( DataType u1, DataType u2, int col, int dir ) const;
75 	void OnChar(wxKeyEvent & event);
76 
77     virtual void Sort();
78 
79     wxMenu* m_popup;
80 
81     DECLARE_EVENT_TABLE()
82 };
83 
84 enum
85 {
86     RLIST_LIST,
87     RLIST_DLMOD,
88     RLIST_DLMAP
89 };
90 
91 #include "playbacklistctrl.cpp"
92 #endif // SPRINGLOBBY_PlaybackListCtrl_H_INCLUDED
93 
94 /**
95     This file is part of SpringLobby,
96     Copyright (C) 2007-2011
97 
98     SpringLobby is free software: you can redistribute it and/or modify
99     it under the terms of the GNU General Public License version 2 as published by
100     the Free Software Foundation.
101 
102     SpringLobby is distributed in the hope that it will be useful,
103     but WITHOUT ANY WARRANTY; without even the implied warranty of
104     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
105     GNU General Public License for more details.
106 
107     You should have received a copy of the GNU General Public License
108     along with SpringLobby.  If not, see <http://www.gnu.org/licenses/>.
109 **/
110 
111