aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.hpp
blob: 4bb96dd4507923c07f2d6207fefc04d0554c5f3c (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "base_tab/BaseTab.hpp"
#include "game_tab/GameTab.hpp"
#include <wx/aui/auibook.h>
#include <wx/filedlg.h>
#include <wx/preferences.h>
#include <wx/textdlg.h>
#include "config.h"
#include "binres/binres.hpp"

wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
wxDECLARE_EVENT(NEW_GAME_EVENT, wxCommandEvent);
wxDECLARE_EVENT(CLOSE_TAB_EVENT, wxCommandEvent);
wxDECLARE_EVENT(REFRESH_ENGINE_LIST, wxCommandEvent);
wxDECLARE_EVENT(CLOSE_LINKED_TAB, wxCommandEvent);

/**
 * @brief Main GUI window of OChess
 * 
 */
class MainWindow : public MainFrame {
  /// @brief Preference popup window
  wxPreferencesEditor *prefsEditor;
  /// @brief Menu to manage existing chess engines
  wxMenu *manageMenu;
  /// @brief Store the number of available chess engines (to create entries in the menus)
  int engine_count;

  void OnClose(wxCloseEvent &e);
  void NewGame(bool useFen);
  void OnPageChange(wxAuiNotebookEvent &event);
  void OnRefreshTabTitle(wxCommandEvent &event);
  void OpenSettings();
  /// @brief Setting up a new chess engine (select executable and open engine tab)
  void NewEngine();
  void OnCloseTabEvent(wxCommandEvent &event);
  void OnRefreshEngineList(wxCommandEvent &event);
  void OnMenuItemClick(wxCommandEvent &event);
  void OnAuiNotebookPageClosed(wxAuiNotebookEvent& event);
  void OnAuiNotebookPageCheck(wxAuiNotebookEvent& event);
  void OnCloseTabLinkedTo(wxCommandEvent &event);
  void AddPage(wxWindow* window, TabInfos* infos);
  void ShowAbout();
public:
  MainWindow();
  TabInfos* NewGame(std::shared_ptr<Game> game);
  /// @brief Apply preferences to MainWindow and all the opened tabs
  void ApplyPreferences();
};