summary refs log tree commit diff stats
path: root/tools/mapedit/src/main.cpp
blob: 09be151629222b558dfdd9d7d983f576a3d17910 (plain) (blame)
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
#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include "map.h"

class MapeditApp : public wxApp {
  public:
    virtual bool OnInit();
};

class MapeditFrame : public wxFrame {
  public:
    MapeditFrame() : MapeditFrame(Map()) {}
    MapeditFrame(Map map);
    
  private:
    void OnExit(wxCommandEvent& event);
    
    Map map;
    
    wxDECLARE_EVENT_TABLE();
};

wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame)
  EVT_MENU(wxID_EXIT, MapeditFrame::OnExit)
wxEND_EVENT_TABLE()

wxIMPLEMENT_APP(MapeditApp);

bool MapeditApp::OnInit()
{
  MapeditFrame* frame = new MapeditFrame();
  frame->Show(true);
  return true;
}

MapeditFrame::MapeditFrame(Map map) : wxFrame(NULL, wxID_ANY, "Map Editor", wxPoint(50, 50), wxSize(450, 340)), map(map)
{
  wxMenu* menuFile = new wxMenu;
  menuFile->Append(wxID_EXIT);

  wxMenuBar* menuBar = new wxMenuBar;
  menuBar->Append(menuFile, "&File");
  
  SetMenuBar(menuBar);
}

void MapeditFrame::OnExit(wxCommandEvent& event)
{
  Close(true);
}