-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathYesNoAllDialog.cpp
More file actions
118 lines (103 loc) · 3.23 KB
/
YesNoAllDialog.cpp
File metadata and controls
118 lines (103 loc) · 3.23 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "YesNoAllDialog.h"
#include "wx/settings.h"
//(*InternalHeaders(YesNoAllDialog)
#include <wx/string.h>
//*)
//(*IdInit(YesNoAllDialog)
const long YesNoAllDialog::ID_STATICTEXT1 = wxNewId();
const long YesNoAllDialog::ID_BUTTON1 = wxNewId();
const long YesNoAllDialog::ID_BUTTON2 = wxNewId();
const long YesNoAllDialog::ID_BUTTON3 = wxNewId();
const long YesNoAllDialog::ID_BUTTON4 = wxNewId();
//*)
BEGIN_EVENT_TABLE(YesNoAllDialog,wxDialog)
//(*EventTable(YesNoAllDialog)
//*)
END_EVENT_TABLE()
YesNoAllDialog::YesNoAllDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(YesNoAllDialog)
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, _T("id"));
SetClientSize(wxSize(307,67));
Move(wxDefaultPosition);
m_message = new wxStaticText(this, ID_STATICTEXT1, wxEmptyString, wxPoint(8,8), wxSize(288,24), 0, _T("ID_STATICTEXT1"));
m_bYes = new wxButton(this, ID_BUTTON1, _T("是"), wxPoint(5,38), wxSize(65,23), 0, wxDefaultValidator, _T("ID_BUTTON1"));
m_bYes->SetToolTip(_T("修改当前"));
m_bNo = new wxButton(this, ID_BUTTON2, _T("否"), wxPoint(84,38), wxSize(65,23), 0, wxDefaultValidator, _T("ID_BUTTON2"));
m_bNo->SetToolTip(_T("不修改当前"));
m_bAll = new wxButton(this, ID_BUTTON3, _T("后面全是"), wxPoint(162,38), wxSize(65,23), 0, wxDefaultValidator, _T("ID_BUTTON3"));
m_bCancle = new wxButton(this, ID_BUTTON4, _T("后面全否"), wxPoint(238,38), wxSize(65,23), 0, wxDefaultValidator, _T("ID_BUTTON4"));
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&YesNoAllDialog::Onm_bYesClick);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&YesNoAllDialog::Onm_bNoClick);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&YesNoAllDialog::Onm_bAllClick);
Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&YesNoAllDialog::Onm_bCancleClick);
//*)
}
void YesNoAllDialog::Set(const wxString &message, const wxString &title, const wxPoint& pos)
{
m_message->SetLabel(message);
SetTitle(title);
SetPosition(pos);
}
YesNoAllDialog::~YesNoAllDialog()
{
//(*Destroy(YesNoAllDialog)
//*)
}
void YesNoAllDialog::SetPosition(const wxPoint& position)
{
int maxX, maxY, width, height, minX, minY;
wxWindow *parent = this->GetParent();
if(parent)
{
parent->GetScreenPosition(&minX, &minY);
parent->GetSize(&maxX, &maxY);
maxX += minX;
maxY += minY;
}
else
{
maxX = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
maxX = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
minX = 0;
minY = 0;
}
//Add some margin
maxX -= 10;
maxY -= 10;
GetSize(&width, &height);
wxPoint pos = position;
if(pos.x + width > maxX)
{
pos.x = maxX - width;
}
if(pos.x < minX)
{
pos.x = minX;
}
if(pos.y + height > maxY)
{
pos.y = maxY - height;
}
if(pos.y < minY)
{
pos.y = minY;
}
Move(pos);
}
void YesNoAllDialog::Onm_bYesClick(wxCommandEvent& event)
{
EndModal(YES);
}
void YesNoAllDialog::Onm_bNoClick(wxCommandEvent& event)
{
EndModal(NO);
}
void YesNoAllDialog::Onm_bAllClick(wxCommandEvent& event)
{
EndModal(ALL);
}
void YesNoAllDialog::Onm_bCancleClick(wxCommandEvent& event)
{
EndModal(CANCLE);
}