aboutsummaryrefslogtreecommitdiff
path: root/src/base_tab/BaseTab.cpp
blob: a2b720776b8f38b9fc3daadec340f689bb7d5663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "BaseTab.hpp"
#include "AppendGameDialog.hpp"
#include <wx/filename.h>

BaseTab::BaseTab(wxFrame *parent, std::string base_file)
    : TabBase(parent), TabInfos(TabInfos::BASE){

  // Games tab
  games_tab=new BaseGameTab((wxFrame *)notebook,base_file);
  notebook->AddPage(games_tab, "Games list",true); // true for selecting the tab
  // Import tab
  import_tab=new BaseImportTab((wxFrame *)notebook);
  notebook->AddPage(import_tab, "Import games");
  // Manage tab
  manage_tab=new BaseManageTab((wxFrame *)notebook);
  notebook->AddPage(manage_tab, "Manage database");

  RefreshLabel();
  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);
}

void BaseTab::ApplyPreferences() {}

void BaseTab::RefreshLabel(){
  SetLabel("Database XX");
}