2022-02-24 11:50:16 +01:00
|
|
|
#include "BaseTab.hpp"
|
2022-02-26 12:30:07 +01:00
|
|
|
#include "AppendGameDialog.hpp"
|
2022-02-26 12:48:52 +01:00
|
|
|
#include <wx/filename.h>
|
2022-02-24 11:50:16 +01:00
|
|
|
|
2022-02-25 09:21:26 +01:00
|
|
|
BaseTab::BaseTab(wxFrame *parent, std::string base_file)
|
2022-12-23 16:49:33 +01:00
|
|
|
: TabBase(parent), TabInfos(TabInfos::BASE){
|
2022-02-24 12:09:21 +01:00
|
|
|
|
2022-12-23 16:49:33 +01:00
|
|
|
// Games tab
|
2022-12-24 22:30:20 +01:00
|
|
|
games_tab=new BaseGameTab((wxFrame *)notebook,base_file,this);
|
2022-12-24 10:26:05 +01:00
|
|
|
notebook->AddPage(games_tab, "Games list",true); // true for selecting the tab
|
2022-12-23 16:49:33 +01:00
|
|
|
// Import tab
|
2022-12-25 14:32:06 +01:00
|
|
|
import_tab=new BaseImportTab((wxFrame *)notebook,this);
|
2022-12-24 10:26:05 +01:00
|
|
|
notebook->AddPage(import_tab, "Import games");
|
2022-12-23 18:23:05 +01:00
|
|
|
// Manage tab
|
|
|
|
manage_tab=new BaseManageTab((wxFrame *)notebook);
|
2022-12-24 10:26:05 +01:00
|
|
|
notebook->AddPage(manage_tab, "Manage database");
|
2022-02-26 12:30:07 +01:00
|
|
|
|
2022-12-23 16:49:33 +01:00
|
|
|
RefreshLabel();
|
2022-12-24 12:46:59 +01:00
|
|
|
this->Bind(OPEN_GAME_EVENT, &BaseTab::OnNewGame, this, wxID_ANY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BaseTab::OnNewGame(wxCommandEvent &event){
|
|
|
|
std::shared_ptr<Game> *g = (std::shared_ptr<Game>*)event.GetClientData();
|
|
|
|
this->game=*g;
|
|
|
|
wxCommandEvent newGameEvent(NEW_GAME_EVENT, GetId());
|
|
|
|
newGameEvent.SetEventObject(this);
|
|
|
|
newGameEvent.SetClientData((TabInfos*)this);
|
|
|
|
ProcessEvent(newGameEvent);
|
2022-02-24 11:50:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseTab::ApplyPreferences() {}
|
|
|
|
|
2022-12-23 16:49:33 +01:00
|
|
|
void BaseTab::RefreshLabel(){
|
|
|
|
SetLabel("Database XX");
|
|
|
|
}
|