1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Remere's Map Editor is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//////////////////////////////////////////////////////////////////////
17
18#ifndef RME_EDITOR_TABS_H_
19#define RME_EDITOR_TABS_H_
20
21#include "gui_ids.h"
22
23class EditorTab;
24
25class MapTabbook : public wxPanel {
26public:
27 MapTabbook(wxWindow* parent, wxWindowID id);
28 ~MapTabbook();
29
30 // Wrapper functions
31 void AddTab(EditorTab* tab, bool select);
32 void SetTabLabel(int idx, wxString label);
33 void SetFocusedTab(int idx);
34 void DeleteTab(int idx);
35 int GetTabCount();
36 int GetTabIndex(wxWindow* tab);
37 int GetSelection();
38 void CycleTab(bool forward = true);
39 wxWindow* GetCurrentPage();
40 EditorTab* GetCurrentTab();
41 EditorTab* GetTab(int idx);
42
43 // Events
44 void OnAllowNotebookDND(wxAuiNotebookEvent& evt);
45 void OnNotebookPageClose(wxAuiNotebookEvent& evt);
46 void OnNotebookPageChanged(wxAuiNotebookEvent& evt);
47 void OnSwitchEditorMode(EditorMode mode);
48
49protected:
50 EditorTab* GetInternalTab(int idx);
51 wxAuiNotebook* notebook;
52 std::map<wxWindow*, EditorTab*> conv;
53
54 DECLARE_EVENT_TABLE();
55};
56
57class EditorTab {
58public:
59 EditorTab();
60 virtual ~EditorTab();
61
62 // Properties
63 virtual wxWindow* GetWindow() const = 0;
64 virtual wxString GetTitle() const = 0;
65
66 //
67 virtual void OnSwitchEditorMode(EditorMode mode) { }
68};
69
70#endif
71