1 #ifndef SPRINGLOBBY_PlaybackTab_H_INCLUDED 2 #define SPRINGLOBBY_PlaybackTab_H_INCLUDED 3 4 #include <wx/scrolwin.h> 5 #include <vector> 6 #include "utils/globalevents.h" 7 8 class Ui; 9 class MapCtrl; 10 class BattleroomListCtrl; 11 class wxCommandEvent; 12 class wxListEvent; 13 class wxStaticText; 14 class wxComboBox; 15 class wxButton; 16 class wxBoxSizer; 17 class wxStaticText; 18 class wxStaticLine; 19 class wxCheckBox; 20 class wxToggleButton; 21 22 template <class PlaybackTabType> 23 class PlaybackListFilter; 24 25 template <class PlaybackType> 26 class PlaybackListCtrl; 27 28 template <class PlaybackType> 29 class PlaybackLoader; 30 31 template <class PlaybackTraitsImp> 32 class PlaybackTab : public GlobalEvent, public wxScrolledWindow 33 { 34 protected: 35 friend class BattleListFilter; //! WTF? 36 37 public: 38 typedef PlaybackTraitsImp 39 PlaybackTraits; 40 typedef typename PlaybackTraits::PlaybackType 41 PlaybackType; 42 typedef PlaybackTab<PlaybackTraits> 43 ThisType; 44 typedef typename PlaybackTraits::ListType 45 ListType; 46 typedef PlaybackListCtrl<PlaybackType> 47 ListCtrlType; 48 typedef PlaybackLoader<ThisType> 49 LoaderType; 50 51 static const bool IsReplayType = PlaybackTraits::IsReplayType; 52 53 public: 54 //! loads all replays into list and adds them to listctrl 55 PlaybackTab( wxWindow* parent ); 56 ~PlaybackTab(); 57 58 //! adds a single replay to listctrl 59 void AddPlayback( const PlaybackType& Replay ); 60 void RemovePlayback( const PlaybackType& Replay ); 61 void RemovePlayback( const int index ); 62 void UpdatePlayback( const PlaybackType& Replay ); 63 64 //! add all replays in m_replays to listctrl 65 void AddAllPlaybacks( wxCommandEvent& evt ); 66 void RemoveAllPlaybacks(); 67 void ReloadList(); 68 69 void UpdateList(); 70 71 //! calls ui::watch which executes spring 72 void OnWatch( wxCommandEvent& event ); 73 //! clears list and parses all replays anew 74 void OnReload( wxCommandEvent& event ); 75 //! does nothing yet 76 void OnDelete( wxCommandEvent& event ); 77 //! does nothing yet 78 void OnFilter( wxCommandEvent& event ); 79 //! does nothing yet 80 void OnFilterActiv( wxCommandEvent& event ); 81 82 //! sets m_sel_replay_id according to selected listitem 83 void OnSelect( wxListEvent& event ); 84 //! does nothing yet 85 void SetFilterActiv(bool activ); 86 87 void Deselect(); 88 void Deselected(); 89 void OnDeselect( wxListEvent& event ); 90 91 void OnSpringTerminated( wxCommandEvent& data ); 92 void OnUnitsyncReloaded( wxCommandEvent& data ); 93 94 protected: 95 PlaybackListFilter<ThisType>* m_filter; 96 ListCtrlType* m_replay_listctrl; 97 LoaderType* m_replay_loader; 98 MapCtrl* m_minimap; 99 wxStaticText* m_map_lbl; 100 wxStaticText* m_map_text; 101 wxStaticText* m_mod_lbl; 102 wxStaticText* m_mod_text; 103 wxStaticText* m_players_lbl; 104 wxStaticText* m_players_text; 105 106 wxStaticLine* m_buttons_sep; 107 wxButton* m_watch_btn; 108 wxButton* m_delete_btn; 109 wxButton* m_reload_btn; 110 111 BattleroomListCtrl* m_players; 112 113 wxCheckBox* m_filter_activ; 114 #if wxUSE_TOGGLEBTN 115 wxToggleButton* m_filter_show; 116 #else 117 wxCheckBox* m_filter_show; 118 #endif 119 120 void AskForceWatch( PlaybackType& rep ) const; 121 122 DECLARE_EVENT_TABLE() 123 }; 124 125 enum 126 { 127 PLAYBACK_WATCH = wxID_HIGHEST, 128 PLAYBACK_DELETE, 129 PLAYBACK_RELOAD, 130 PLAYBACK_LIST, 131 PLAYBACK_LIST_FILTER_BUTTON, 132 PLAYBACK_LIST_FILTER_ACTIV, 133 PLAYBACK_TIMER, 134 PLAYBACK_USER_LIST 135 }; 136 137 #include "playbacktab.cpp" 138 #endif // SPRINGLOBBY_PlaybackTab_H_INCLUDED 139 140 /** 141 This file is part of SpringLobby, 142 Copyright (C) 2007-2011 143 144 SpringLobby is free software: you can redistribute it and/or modify 145 it under the terms of the GNU General Public License version 2 as published by 146 the Free Software Foundation. 147 148 SpringLobby is distributed in the hope that it will be useful, 149 but WITHOUT ANY WARRANTY; without even the implied warranty of 150 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 151 GNU General Public License for more details. 152 153 You should have received a copy of the GNU General Public License 154 along with SpringLobby. If not, see <http://www.gnu.org/licenses/>. 155 **/ 156 157