aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/right_panel/editor/EditorCanvas.hpp
blob: 0858dbb9d24c17d8aaf863d2300ab00ad574554f (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
#pragma once

#include "../../HalfMove.hpp"
#include "CGEditor.hpp"
#include "ochess.hpp"
#include "../../left_panel/board/Theme.hpp"

// Foreign events
wxDECLARE_EVENT(GOTO_MOVE_EVENT, wxCommandEvent);
wxDECLARE_EVENT(PREVIOUS_MOVE_EVENT, wxCommandEvent);
wxDECLARE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
wxDECLARE_EVENT(DELETE_MOVE_EVENT, wxCommandEvent);
wxDECLARE_EVENT(PROMOTE_MOVE_EVENT, wxCommandEvent);
wxDECLARE_EVENT(SET_AS_MAINLINE_EVENT, wxCommandEvent);

class EditorCanvas : public wxPanel, public cgeditor::CGEditor {
  wxPaintDC *dc;
  bool NeedRedraw;
  wxPoint Middle(cgeditor::Element e);
  wxBitmap hide_icon;
  Theme t;
  wxFont default_font;

public:
  EditorCanvas(wxFrame *parent);
  void OnPaint(wxPaintEvent &event);
  void MouseEvent(wxMouseEvent &event);
  void DrawElement(const cgeditor::Element &e);
  void HandleEvent(const cgeditor::Event &e);
  void SetMoves(HalfMove *moves, HalfMove *current);
  void OnKeyEvent(wxKeyEvent &event);

  DECLARE_EVENT_TABLE()
};