1 /* Author: Tobi Vollebregt */ 2 3 #ifndef MAPSELECTDIALOG_H 4 #define MAPSELECTDIALOG_H 5 6 #include <vector> 7 #include "gui/windowattributespickle.h" 8 #include "utils/globalevents.h" 9 //(*Headers(MapSelectDialog) 10 #include <wx/dialog.h> 11 class wxStdDialogButtonSizer; 12 class wxTextCtrl; 13 class MapGridCtrl; 14 class wxRadioButton; 15 class wxStaticText; 16 class wxListCtrl; 17 class wxBoxSizer; 18 class wxStaticBoxSizer; 19 class wxChoice; 20 //*) 21 class wxButton; 22 23 class Ui; 24 namespace LSL { 25 struct UnitsyncMap; 26 } 27 28 // FIXME: WindowAttributesPickle calls SetSize which causes an wx-assertion 29 class MapSelectDialog: public wxDialog, public GlobalEvent /*,public WindowAttributesPickle, */ 30 { 31 public: 32 33 MapSelectDialog( wxWindow* parent); 34 virtual ~MapSelectDialog(); 35 36 LSL::UnitsyncMap* GetSelectedMap() const; 37 38 void OnUnitsyncReloaded( wxCommandEvent& data ); 39 40 protected: 41 42 //(*Declarations(MapSelectDialog) 43 wxRadioButton* m_filter_recent; 44 wxStaticText* m_map_name; 45 wxRadioButton* m_filter_all; 46 MapGridCtrl* m_mapgrid; 47 wxChoice* m_vertical_choice; 48 wxChoice* m_horizontal_choice; 49 wxTextCtrl* m_filter_text; 50 wxListCtrl* m_map_opts_list; 51 wxRadioButton* m_filter_popular; 52 wxStaticBoxSizer* m_map_details; 53 //*) 54 wxButton* m_vertical_direction_button; 55 wxButton* m_horizontal_direction_button; 56 57 //(*Identifiers(MapSelectDialog) 58 static const long ID_STATICTEXT2; 59 static const long ID_VERTICAL_CHOICE; 60 static const long ID_STATICTEXT1; 61 static const long ID_HORIZONTAL_CHOICE; 62 static const long ID_FILTER_ALL; 63 static const long ID_FILTER_POPULAR; 64 static const long ID_FILTER_RECENT; 65 static const long ID_FILTER_TEXT; 66 static const long ID_MAP_NAME; 67 static const long ID_MAP_OPTS_LIST; 68 static const long ID_MAPGRID; 69 //*) 70 static const long ID_VERTICAL_DIRECTION; 71 static const long ID_HORIZONTAL_DIRECTION; 72 73 //(*Handlers(MapSelectDialog) 74 void OnInit(wxInitDialogEvent& event); 75 void OnSortKeySelect(wxCommandEvent& event); 76 void OnMapGridLeftDClick(wxMouseEvent& event); 77 void OnFilterAllSelect(wxCommandEvent& event); 78 void OnFilterPopularSelect(wxCommandEvent& event); 79 void OnFilterRecentSelect(wxCommandEvent& event); 80 void OnFilterTextChanged(wxCommandEvent& event); 81 //*) 82 83 void OnMapSelected( wxCommandEvent& event ); 84 void OnMapLoadingCompleted( wxCommandEvent& event ); 85 void OnVerticalDirectionClicked( wxCommandEvent& event ); 86 void OnHorizontalDirectionClicked( wxCommandEvent& event ); 87 88 void AppendSortKeys( wxChoice* choice ); 89 void UpdateSortAndFilter(); 90 91 void LoadAll(); 92 void LoadPopular(); 93 void LoadRecent(); 94 95 bool m_horizontal_direction; 96 bool m_vertical_direction; 97 wxArrayString m_maps; 98 wxArrayString m_replays; 99 100 static const wxString m_dialog_name; 101 static const unsigned int m_filter_all_sett = 0; 102 static const unsigned int m_filter_recent_sett = 1; 103 static const unsigned int m_filter_popular_sett = 2; 104 105 DECLARE_EVENT_TABLE() 106 }; 107 108 wxString mapSelectDialog(bool hidden=false, wxWindow* parent=NULL); 109 110 #endif 111 112 /** 113 This file is part of SpringLobby, 114 Copyright (C) 2007-2011 115 116 SpringLobby is free software: you can redistribute it and/or modify 117 it under the terms of the GNU General Public License version 2 as published by 118 the Free Software Foundation. 119 120 SpringLobby is distributed in the hope that it will be useful, 121 but WITHOUT ANY WARRANTY; without even the implied warranty of 122 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 123 GNU General Public License for more details. 124 125 You should have received a copy of the GNU General Public License 126 along with SpringLobby. If not, see <http://www.gnu.org/licenses/>. 127 **/ 128 129