Permalink
Browse files

Throw all the wxCheckBox/wxToggleButton abstractions into controls.h.

  • Loading branch information...
specing committed Aug 20, 2018
1 parent d8f5d2b commit feeae18bd229f561744bf3facc447f94d228707b
@@ -15,18 +15,11 @@
#include <set>
#include <stdexcept>

#if wxUSE_TOGGLEBTN
#define EVT_TOGGLEORCHECK EVT_TOGGLEBUTTON
#else
#define EVT_TOGGLEORCHECK EVT_CHECKBOX
#endif

#include "aui/auimanager.h"
#include "battledataviewctrl.h"
#include "battlelistfilter.h"
#include "exception.h"
#include "gui/chatpanel.h"
#include "gui/controls.h"
#include "gui/customdialogs.h"
#include "gui/hosting/hostbattledialog.h"
#include "gui/hosting/mainjoinbattletab.h"
@@ -4,13 +4,8 @@
#define SPRINGLOBBY_HEADERGUARD_BATTLELISTTAB_H

#include <wx/scrolwin.h>
#include "gui/controls.h"
#include "utils/mixins.h"
#if wxUSE_TOGGLEBTN
class wxToggleButton;
#define wxToggleOrCheck wxToggleButton
#else
#define wxToggleOrCheck wxCheckBox
#endif

class Battle;
class BattleDataViewCtrl;
@@ -15,4 +15,12 @@ static const int SCROLL_RATE = 3;
//! call this function everytime map app loses/acquires focus to enable/disable tooltips
void UpdateMainAppHasFocus(bool focus);

#if wxUSE_TOGGLEBTN
#define EVT_TOGGLEORCHECK EVT_TOGGLEBUTTON
#define wxToggleOrCheck wxToggleButton
#else
#define EVT_TOGGLEORCHECK EVT_CHECKBOX
#define wxToggleOrCheck wxCheckBox
#endif

#endif // SPRINGLOBBY_HEADERGUARD_CONTROLS_H
@@ -11,9 +11,7 @@
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/textdlg.h>
#if wxUSE_TOGGLEBTN
#include <wx/tglbtn.h>
#endif

#include "exception.h"
#include "gui/chatpanel.h"
@@ -34,21 +32,14 @@
#include "utils/slconfig.h"

BEGIN_EVENT_TABLE(PlaybackTab, wxPanel)

EVT_BUTTON(PLAYBACK_WATCH, PlaybackTab::OnWatch)
EVT_BUTTON(PLAYBACK_RELOAD, PlaybackTab::OnReload)
EVT_BUTTON(PLAYBACK_DELETE, PlaybackTab::OnDelete)
EVT_DATAVIEW_SELECTION_CHANGED(PlaybackDataView::REPLAY_DATAVIEW_ID, PlaybackTab::OnSelect)
EVT_CHECKBOX(PLAYBACK_LIST_FILTER_ACTIV, PlaybackTab::OnFilterActiv)
EVT_COMMAND(wxID_ANY, PlaybackLoader::PlaybacksLoadedEvt, PlaybackTab::AddAllPlaybacks)
EVT_KEY_DOWN(PlaybackTab::OnChar)

#if wxUSE_TOGGLEBTN
EVT_TOGGLEBUTTON(PLAYBACK_LIST_FILTER_BUTTON, PlaybackTab::OnFilter)
#else
EVT_CHECKBOX(PLAYBACK_LIST_FILTER_BUTTON, PlaybackTab::OnFilter)
#endif

EVT_TOGGLEORCHECK(PLAYBACK_LIST_FILTER_BUTTON, PlaybackTab::OnFilter)
END_EVENT_TABLE()

PlaybackTab::PlaybackTab(wxWindow* parent, bool replay)
@@ -84,11 +75,7 @@ PlaybackTab::PlaybackTab(wxWindow* parent, bool replay)
m_info_sizer->Add(m_players, 2, wxALL | wxEXPAND, 0);


#if wxUSE_TOGGLEBTN
m_filter_show = new wxToggleButton(this, PLAYBACK_LIST_FILTER_BUTTON, _(" Filter "), wxDefaultPosition, wxSize(-1, 28), 0);
#else
m_filter_show = new wxCheckBox(this, PLAYBACK_LIST_FILTER_BUTTON, _(" Filter "), wxDefaultPosition, wxSize(-1, 28), 0);
#endif
m_filter_show = new wxToggleOrCheck(this, PLAYBACK_LIST_FILTER_BUTTON, _(" Filter "), wxDefaultPosition, wxSize(-1, 28), 0);
m_filter_activ = new wxCheckBox(this, PLAYBACK_LIST_FILTER_ACTIV, _("Activated"), wxDefaultPosition, wxDefaultSize, 0);
m_watch_btn = new wxButton(this, PLAYBACK_WATCH, replay ? _("Watch") : _("Load"), wxDefaultPosition, wxSize(-1, 28), 0);
m_delete_btn = new wxButton(this, PLAYBACK_DELETE, _("Delete"), wxDefaultPosition, wxSize(-1, 28), 0);
@@ -5,9 +5,11 @@

#include <wx/scrolwin.h>
#include <vector>
#include "gui/controls.h"
class Ui;
class MapCtrl;
class BattleroomListCtrl;
class wxCheckBox;
class wxCommandEvent;
class wxDataViewEvent;
class wxStaticText;
@@ -16,7 +18,6 @@ class wxButton;
class wxBoxSizer;
class wxStaticText;
class wxStaticLine;
class wxCheckBox;
class wxToggleButton;
struct StoredGame;
class PlaybackLoader;
@@ -91,11 +92,7 @@ class PlaybackTab : public wxPanel

wxCheckBox* m_filter_activ;
bool m_isreplay;
#if wxUSE_TOGGLEBTN
wxToggleButton* m_filter_show;
#else
wxCheckBox* m_filter_show;
#endif
wxToggleOrCheck* m_filter_show;

void AskForceWatch(StoredGame& rep) const;

0 comments on commit feeae18

Please sign in to comment.