-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcDialogDimensions.cpp
More file actions
54 lines (40 loc) · 1.34 KB
/
cDialogDimensions.cpp
File metadata and controls
54 lines (40 loc) · 1.34 KB
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 "cDialogDimensions.h"
cDialogDimensions::cDialogDimensions(wxWindow* parent)
: wxDialog(parent, wxID_ANY, "New Sprite")
{
m_lblWidth = new wxStaticText(this, wxID_ANY, "Enter Width");
m_txtWidth = new wxTextCtrl(this, wxID_ANY, "");
m_lblHeight = new wxStaticText(this, wxID_ANY, "Enter Height");
m_txtHeight = new wxTextCtrl(this, wxID_ANY, "");
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->AddSpacer(5);
sizer->Add(m_lblWidth, 0, wxSTRETCH_NOT | wxRIGHT | wxALIGN_CENTER);
sizer->AddSpacer(5);
sizer->Add(m_txtWidth, 0, wxSTRETCH_NOT | wxRIGHT | wxALIGN_CENTER);
sizer->AddSpacer(5);
sizer->Add(m_lblHeight, 0, wxSTRETCH_NOT | wxRIGHT | wxALIGN_CENTER);
sizer->AddSpacer(5);
sizer->Add(m_txtHeight, 0, wxSTRETCH_NOT | wxRIGHT | wxALIGN_CENTER);
sizer->AddSpacer(5);
sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER | wxRIGHT);
sizer->AddSpacer(5);
this->SetSizerAndFit(sizer);
}
cDialogDimensions::~cDialogDimensions()
{
this->Close();
}
int cDialogDimensions::GetSpriteWidth()
{
int nWidth;
if (!m_txtWidth->GetValue().ToInt(&nWidth))
nWidth = 16;
return (nWidth > 0) ? nWidth : 16;
}
int cDialogDimensions::GetSpriteHeight()
{
int nHeight;
if (!m_txtHeight->GetValue().ToInt(&nHeight))
nHeight = 16;
return (nHeight > 0) ? nHeight : 16;
}