From ce941c146aea7925bded6b9d2a0d0559d3156ad3 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 23 Feb 2022 18:11:55 +0100 Subject: Create repository --- src/game_tab/editor/EditorCanvas.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/game_tab/editor/EditorCanvas.hpp (limited to 'src/game_tab/editor/EditorCanvas.hpp') diff --git a/src/game_tab/editor/EditorCanvas.hpp b/src/game_tab/editor/EditorCanvas.hpp new file mode 100644 index 0000000..b3bb29f --- /dev/null +++ b/src/game_tab/editor/EditorCanvas.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include "../HalfMove.hpp" +#include "CGEditor.hpp" +#include "ochess.hpp" +#include "../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; + +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() +}; -- cgit v1.2.3