-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewMapFrame.cpp
56 lines (42 loc) · 1.59 KB
/
NewMapFrame.cpp
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
51
52
53
54
55
#include "NewMapFrame.h"
wxBEGIN_EVENT_TABLE(NewMapFrame, wxFrame)
EVT_CLOSE(NewMapFrame::OnClose)
EVT_SLIDER(2001, NewMapFrame::OnZoomChange)
wxEND_EVENT_TABLE()
NewMapFrame::NewMapFrame(wxFrame* parent, int cols, int rows, int tw, int th, wxString name) : wxFrame(parent, wxID_ANY, name, wxDefaultPosition, wxSize(800, 600) )
{
wxSizer* vSizer = new wxBoxSizer(wxVERTICAL);
wxSizer* hSizer = new wxBoxSizer(wxHORIZONTAL);
assetsPanel = new LoadAssetsPanel(this, tw);
wxPanel* pb = new wxPanel(this);
pb->SetBackgroundColour("LightBlue");
hSizer->Add(vSizer, 3, wxEXPAND, 0);
hSizer->Add(pb, 1, wxEXPAND, 0);
m_canvas = new Canvas(this, cols, rows, tw);
m_statusBar = this->CreateStatusBar(2, wxSTB_DEFAULT_STYLE, wxID_ANY);
m_zoomSlider = new wxSlider(m_statusBar, 2001, 50, 1, 100);
m_canvas->setPixelSize(m_zoomSlider->GetValue() );
m_statusBar->SetStatusText(wxString("Zoom: ") << m_zoomSlider->GetValue() << wxString("%"), 1);
vSizer->Add(m_canvas, 3, wxEXPAND, 0);
vSizer->Add(assetsPanel, 1, wxEXPAND, 0);
SetSizer(hSizer);
Show(true);
};
NewMapFrame::~NewMapFrame(){};
void NewMapFrame::OnClose(wxCloseEvent& evt)
{
MainMenuFrame* m = (MainMenuFrame*) GetParent();
m->RemoveElementFromStack(this);
this->Destroy();
evt.Skip();
};
void NewMapFrame::OnZoomChange(wxCommandEvent& evt)
{
m_statusBar->SetStatusText(wxString("Zoom: ") << m_zoomSlider->GetValue() << wxString("%"), 1);
m_canvas->setPixelSize(m_zoomSlider->GetValue() );
evt.Skip();
};
Canvas* NewMapFrame::GetCanvas()
{
return m_canvas;
};