2 /// \file ContactEditDlg.cc
3 /// Dialog class to handle the editing of the Contact record
7 Copyright (C) 2011-2012, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "ContactEditDlg.h"
23 #include "ContactPhotoWidget.h"
24 #include "windowids.h"
26 // begin wxGlade: ::extracode
30 //////////////////////////////////////////////////////////////////////////////
31 // ContactEditDlg class
33 ContactEditDlg::ContactEditDlg(wxWindow
*parent
,
36 : wxDialog(parent
, Dialog_ContactEdit
, _T("Contact Record"))
39 m_email_list
= Barry::Contact::Email2CommaString(m_rec
.EmailAddresses
);
42 bottom_buttons
= CreateButtonSizer(wxOK
| wxCANCEL
);
45 bottom_buttons
= CreateButtonSizer(wxCANCEL
);
48 // begin wxGlade: ContactEditDlg::ContactEditDlg
49 sizer_5_staticbox
= new wxStaticBox(this, -1, wxT("Home"));
50 sizer_6_staticbox
= new wxStaticBox(this, -1, wxT("Work"));
51 sizer_2_staticbox
= new wxStaticBox(this, -1, wxT("Misc"));
52 sizer_7_staticbox
= new wxStaticBox(this, -1, wxT("Mobile"));
53 sizer_8_staticbox
= new wxStaticBox(this, -1, wxT("Notes"));
54 sizer_9_staticbox
= new wxStaticBox(this, -1, wxT("Name"));
55 m_photo
= new ContactPhotoWidget(this, Dialog_ContactEdit_PhotoButton
, m_rec
);
56 label_13
= new wxStaticText(this, wxID_ANY
, wxT("Title"));
57 Prefix
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
58 FirstNameStatic
= new wxStaticText(this, wxID_ANY
, wxT("First"));
59 FirstName
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
60 LastNameStatic
= new wxStaticText(this, wxID_ANY
, wxT("Last"));
61 LastName
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
62 label_14
= new wxStaticText(this, wxID_ANY
, wxT("Company"));
63 Company
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
64 label_15
= new wxStaticText(this, wxID_ANY
, wxT("Job Title"));
65 JobTitle
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
66 label_9
= new wxStaticText(this, wxID_ANY
, wxT("Nickname"));
67 Nickname
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
68 label_1
= new wxStaticText(this, wxID_ANY
, wxT("Address"));
69 HomeAddress1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
70 HomeAddress2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
71 HomeAddress3
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
72 label_2
= new wxStaticText(this, wxID_ANY
, wxT("City"));
73 HomeCity
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
74 label_3
= new wxStaticText(this, wxID_ANY
, wxT("Province"));
75 HomeProvince
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
76 label_4
= new wxStaticText(this, wxID_ANY
, wxT("Postal Code"));
77 HomePostalCode
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
78 label_5
= new wxStaticText(this, wxID_ANY
, wxT("Country"));
79 HomeCountry
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
80 static_line_1
= new wxStaticLine(this, wxID_ANY
);
81 static_line_2
= new wxStaticLine(this, wxID_ANY
);
82 label_6
= new wxStaticText(this, wxID_ANY
, wxT("Phone"));
83 HomePhone
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
84 label_7
= new wxStaticText(this, wxID_ANY
, wxT("Phone 2"));
85 HomePhone2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
86 label_8
= new wxStaticText(this, wxID_ANY
, wxT("Fax"));
87 HomeFax
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
88 label_1_copy
= new wxStaticText(this, wxID_ANY
, wxT("Address"));
89 WorkAddress1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
90 WorkAddress2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
91 WorkAddress3
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
92 label_2_copy
= new wxStaticText(this, wxID_ANY
, wxT("City"));
93 WorkCity
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
94 label_3_copy
= new wxStaticText(this, wxID_ANY
, wxT("Province"));
95 WorkProvince
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
96 label_4_copy
= new wxStaticText(this, wxID_ANY
, wxT("Postal Code"));
97 WorkPostalCode
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
98 label_5_copy
= new wxStaticText(this, wxID_ANY
, wxT("Country"));
99 WorkCountry
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
100 static_line_1_copy
= new wxStaticLine(this, wxID_ANY
);
101 static_line_2_copy
= new wxStaticLine(this, wxID_ANY
);
102 label_6_copy
= new wxStaticText(this, wxID_ANY
, wxT("Phone"));
103 WorkPhone
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
104 label_7_copy
= new wxStaticText(this, wxID_ANY
, wxT("Phone 2"));
105 WorkPhone2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
106 label_8_copy
= new wxStaticText(this, wxID_ANY
, wxT("Fax"));
107 WorkFax
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
108 label_17
= new wxStaticText(this, wxID_ANY
, wxT("Email"));
109 text_ctrl_9
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
110 label_18
= new wxStaticText(this, wxID_ANY
, wxT("Other Phone"));
111 text_ctrl_1
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
112 label_19
= new wxStaticText(this, wxID_ANY
, wxT("Old Phone"));
113 text_ctrl_2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
114 label_20
= new wxStaticText(this, wxID_ANY
, wxT("Radio"));
115 text_ctrl_3
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
116 label_21
= new wxStaticText(this, wxID_ANY
, wxT("PIN"));
117 text_ctrl_4
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
118 label_22
= new wxStaticText(this, wxID_ANY
, wxT("User1"));
119 text_ctrl_5
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
120 label_23
= new wxStaticText(this, wxID_ANY
, wxT("User2"));
121 text_ctrl_6
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
122 label_24
= new wxStaticText(this, wxID_ANY
, wxT("User3"));
123 text_ctrl_7
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
124 label_25
= new wxStaticText(this, wxID_ANY
, wxT("User4"));
125 text_ctrl_8
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
126 label_10
= new wxStaticText(this, wxID_ANY
, wxT("Cell"));
127 MobilePhone
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
128 label_11
= new wxStaticText(this, wxID_ANY
, wxT("Cell 2"));
129 MobilePhone2
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
130 label_12
= new wxStaticText(this, wxID_ANY
, wxT("Pager"));
131 Pager
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
132 Notes
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxTE_PROCESS_ENTER
|wxTE_MULTILINE
);
133 label_16
= new wxStaticText(this, wxID_ANY
, wxT("URL"));
134 Url
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
);
141 BEGIN_EVENT_TABLE(ContactEditDlg
, wxDialog
)
142 EVT_BUTTON (Dialog_ContactEdit_PhotoButton
,
143 ContactEditDlg::OnPhotoButton
)
146 void ContactEditDlg::set_properties()
148 // begin wxGlade: ContactEditDlg::set_properties
149 SetTitle(wxT("Contact"));
150 Prefix
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Prefix
)));
151 FirstName
->SetMinSize(wxSize(100, -1));
152 FirstName
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.FirstName
)));
153 LastName
->SetMinSize(wxSize(100, -1));
154 LastName
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.LastName
)));
155 Company
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Company
)));
156 JobTitle
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.JobTitle
)));
157 Nickname
->SetMinSize(wxSize(100, -1));
158 Nickname
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Nickname
)));
159 HomeAddress1
->SetMinSize(wxSize(170, -1));
160 HomeAddress1
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.Address1
)));
161 HomeAddress2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.Address2
)));
162 HomeAddress3
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.Address3
)));
163 HomeCity
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.City
)));
164 HomeProvince
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.Province
)));
165 HomePostalCode
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.PostalCode
)));
166 HomeCountry
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeAddress
.Country
)));
167 HomePhone
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomePhone
)));
168 HomePhone2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomePhone2
)));
169 HomeFax
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.HomeFax
)));
170 WorkAddress1
->SetMinSize(wxSize(170, -1));
171 WorkAddress1
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.Address1
)));
172 WorkAddress2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.Address2
)));
173 WorkAddress3
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.Address3
)));
174 WorkCity
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.City
)));
175 WorkProvince
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.Province
)));
176 WorkPostalCode
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.PostalCode
)));
177 WorkCountry
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkAddress
.Country
)));
178 WorkPhone
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkPhone
)));
179 WorkPhone2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.WorkPhone2
)));
180 WorkFax
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Fax
)));
181 text_ctrl_9
->SetMinSize(wxSize(170, -1));
182 text_ctrl_9
->SetToolTip(wxT("Comma separated list of simple email addresses. Do not use <> characters."));
183 text_ctrl_9
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_email_list
)));
184 text_ctrl_1
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.OtherPhone
)));
185 text_ctrl_2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Phone
)));
186 text_ctrl_3
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Radio
)));
187 text_ctrl_4
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.PIN
)));
188 text_ctrl_5
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.UserDefined1
)));
189 text_ctrl_6
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.UserDefined2
)));
190 text_ctrl_7
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.UserDefined3
)));
191 text_ctrl_8
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.UserDefined4
)));
192 MobilePhone
->SetMinSize(wxSize(100, -1));
193 MobilePhone
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.MobilePhone
)));
194 MobilePhone2
->SetMinSize(wxSize(100, -1));
195 MobilePhone2
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.MobilePhone2
)));
196 Pager
->SetMinSize(wxSize(100, -1));
197 Pager
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Pager
)));
198 Notes
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.Notes
)));
199 Url
->SetValidator(wxTextValidator(wxFILTER_NONE
, m_strings
.Add(m_rec
.URL
)));
204 void ContactEditDlg::do_layout()
206 // begin wxGlade: ContactEditDlg::do_layout
207 wxBoxSizer
* sizer_1
= new wxBoxSizer(wxVERTICAL
);
208 wxStaticBoxSizer
* sizer_8
= new wxStaticBoxSizer(sizer_8_staticbox
, wxVERTICAL
);
209 wxBoxSizer
* sizer_10
= new wxBoxSizer(wxHORIZONTAL
);
210 wxStaticBoxSizer
* sizer_7
= new wxStaticBoxSizer(sizer_7_staticbox
, wxHORIZONTAL
);
211 wxBoxSizer
* sizer_4
= new wxBoxSizer(wxHORIZONTAL
);
212 wxStaticBoxSizer
* sizer_2
= new wxStaticBoxSizer(sizer_2_staticbox
, wxHORIZONTAL
);
213 wxFlexGridSizer
* grid_sizer_3
= new wxFlexGridSizer(10, 2, 1, 3);
214 wxStaticBoxSizer
* sizer_6
= new wxStaticBoxSizer(sizer_6_staticbox
, wxHORIZONTAL
);
215 wxFlexGridSizer
* grid_sizer_1_copy
= new wxFlexGridSizer(11, 2, 1, 3);
216 wxStaticBoxSizer
* sizer_5
= new wxStaticBoxSizer(sizer_5_staticbox
, wxHORIZONTAL
);
217 wxFlexGridSizer
* grid_sizer_1
= new wxFlexGridSizer(11, 2, 1, 3);
218 wxStaticBoxSizer
* sizer_9
= new wxStaticBoxSizer(sizer_9_staticbox
, wxHORIZONTAL
);
219 wxFlexGridSizer
* grid_sizer_2
= new wxFlexGridSizer(2, 6, 2, 3);
220 sizer_9
->Add(m_photo
, 0, wxRIGHT
|wxEXPAND
|wxALIGN_CENTER_VERTICAL
, 3);
221 grid_sizer_2
->Add(label_13
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
222 grid_sizer_2
->Add(Prefix
, 0, wxEXPAND
, 0);
223 grid_sizer_2
->Add(FirstNameStatic
, 0, wxLEFT
|wxALIGN_CENTER_VERTICAL
, 10);
224 grid_sizer_2
->Add(FirstName
, 1, wxEXPAND
, 0);
225 grid_sizer_2
->Add(LastNameStatic
, 0, wxLEFT
|wxALIGN_CENTER_VERTICAL
, 10);
226 grid_sizer_2
->Add(LastName
, 1, wxEXPAND
, 0);
227 grid_sizer_2
->Add(label_14
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
228 grid_sizer_2
->Add(Company
, 0, wxEXPAND
, 0);
229 grid_sizer_2
->Add(label_15
, 0, wxLEFT
|wxALIGN_CENTER_VERTICAL
, 10);
230 grid_sizer_2
->Add(JobTitle
, 0, wxEXPAND
, 0);
231 grid_sizer_2
->Add(label_9
, 0, wxLEFT
|wxALIGN_CENTER_VERTICAL
, 10);
232 grid_sizer_2
->Add(Nickname
, 1, wxEXPAND
, 0);
233 grid_sizer_2
->AddGrowableCol(1);
234 grid_sizer_2
->AddGrowableCol(3);
235 grid_sizer_2
->AddGrowableCol(5);
236 sizer_9
->Add(grid_sizer_2
, 1, wxBOTTOM
|wxEXPAND
, 3);
237 sizer_1
->Add(sizer_9
, 0, wxALL
|wxEXPAND
, 5);
238 grid_sizer_1
->Add(label_1
, 0, wxALIGN_CENTER_VERTICAL
, 0);
239 grid_sizer_1
->Add(HomeAddress1
, 0, 0, 0);
240 grid_sizer_1
->Add(20, 20, 0, 0, 0);
241 grid_sizer_1
->Add(HomeAddress2
, 0, wxEXPAND
, 0);
242 grid_sizer_1
->Add(20, 20, 0, 0, 0);
243 grid_sizer_1
->Add(HomeAddress3
, 0, wxEXPAND
, 0);
244 grid_sizer_1
->Add(label_2
, 0, wxALIGN_CENTER_VERTICAL
, 0);
245 grid_sizer_1
->Add(HomeCity
, 0, wxEXPAND
, 0);
246 grid_sizer_1
->Add(label_3
, 0, wxALIGN_CENTER_VERTICAL
, 0);
247 grid_sizer_1
->Add(HomeProvince
, 0, wxEXPAND
, 0);
248 grid_sizer_1
->Add(label_4
, 0, wxALIGN_CENTER_VERTICAL
, 0);
249 grid_sizer_1
->Add(HomePostalCode
, 0, wxEXPAND
, 0);
250 grid_sizer_1
->Add(label_5
, 0, wxALIGN_CENTER_VERTICAL
, 0);
251 grid_sizer_1
->Add(HomeCountry
, 0, wxEXPAND
, 0);
252 grid_sizer_1
->Add(static_line_1
, 0, wxEXPAND
, 0);
253 grid_sizer_1
->Add(static_line_2
, 0, wxEXPAND
, 0);
254 grid_sizer_1
->Add(label_6
, 0, wxALIGN_CENTER_VERTICAL
, 0);
255 grid_sizer_1
->Add(HomePhone
, 0, wxEXPAND
, 0);
256 grid_sizer_1
->Add(label_7
, 0, wxALIGN_CENTER_VERTICAL
, 0);
257 grid_sizer_1
->Add(HomePhone2
, 0, wxEXPAND
, 0);
258 grid_sizer_1
->Add(label_8
, 0, wxALIGN_CENTER_VERTICAL
, 0);
259 grid_sizer_1
->Add(HomeFax
, 0, wxEXPAND
, 0);
260 sizer_5
->Add(grid_sizer_1
, 1, wxEXPAND
, 0);
261 sizer_4
->Add(sizer_5
, 1, wxLEFT
|wxRIGHT
|wxEXPAND
, 2);
262 grid_sizer_1_copy
->Add(label_1_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
263 grid_sizer_1_copy
->Add(WorkAddress1
, 0, 0, 0);
264 grid_sizer_1_copy
->Add(20, 20, 0, 0, 0);
265 grid_sizer_1_copy
->Add(WorkAddress2
, 0, wxEXPAND
, 0);
266 grid_sizer_1_copy
->Add(20, 20, 0, 0, 0);
267 grid_sizer_1_copy
->Add(WorkAddress3
, 0, wxEXPAND
, 0);
268 grid_sizer_1_copy
->Add(label_2_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
269 grid_sizer_1_copy
->Add(WorkCity
, 0, wxEXPAND
, 0);
270 grid_sizer_1_copy
->Add(label_3_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
271 grid_sizer_1_copy
->Add(WorkProvince
, 0, wxEXPAND
, 0);
272 grid_sizer_1_copy
->Add(label_4_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
273 grid_sizer_1_copy
->Add(WorkPostalCode
, 0, wxEXPAND
, 0);
274 grid_sizer_1_copy
->Add(label_5_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
275 grid_sizer_1_copy
->Add(WorkCountry
, 0, wxEXPAND
, 0);
276 grid_sizer_1_copy
->Add(static_line_1_copy
, 0, wxEXPAND
, 0);
277 grid_sizer_1_copy
->Add(static_line_2_copy
, 0, wxEXPAND
, 0);
278 grid_sizer_1_copy
->Add(label_6_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
279 grid_sizer_1_copy
->Add(WorkPhone
, 0, wxEXPAND
, 0);
280 grid_sizer_1_copy
->Add(label_7_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
281 grid_sizer_1_copy
->Add(WorkPhone2
, 0, wxEXPAND
, 0);
282 grid_sizer_1_copy
->Add(label_8_copy
, 0, wxALIGN_CENTER_VERTICAL
, 0);
283 grid_sizer_1_copy
->Add(WorkFax
, 0, wxEXPAND
, 0);
284 sizer_6
->Add(grid_sizer_1_copy
, 1, wxEXPAND
, 0);
285 sizer_4
->Add(sizer_6
, 1, wxLEFT
|wxRIGHT
|wxEXPAND
, 2);
286 grid_sizer_3
->Add(label_17
, 0, wxALIGN_CENTER_VERTICAL
, 0);
287 grid_sizer_3
->Add(text_ctrl_9
, 0, 0, 0);
288 grid_sizer_3
->Add(label_18
, 0, wxALIGN_CENTER_VERTICAL
, 0);
289 grid_sizer_3
->Add(text_ctrl_1
, 0, wxEXPAND
, 0);
290 grid_sizer_3
->Add(label_19
, 0, 0, 0);
291 grid_sizer_3
->Add(text_ctrl_2
, 0, wxEXPAND
, 0);
292 grid_sizer_3
->Add(label_20
, 0, 0, 0);
293 grid_sizer_3
->Add(text_ctrl_3
, 0, wxEXPAND
, 0);
294 grid_sizer_3
->Add(label_21
, 0, 0, 0);
295 grid_sizer_3
->Add(text_ctrl_4
, 0, wxEXPAND
, 0);
296 grid_sizer_3
->Add(label_22
, 0, 0, 0);
297 grid_sizer_3
->Add(text_ctrl_5
, 0, wxEXPAND
, 0);
298 grid_sizer_3
->Add(label_23
, 0, 0, 0);
299 grid_sizer_3
->Add(text_ctrl_6
, 0, wxEXPAND
, 0);
300 grid_sizer_3
->Add(label_24
, 0, 0, 0);
301 grid_sizer_3
->Add(text_ctrl_7
, 0, wxEXPAND
, 0);
302 grid_sizer_3
->Add(label_25
, 0, 0, 0);
303 grid_sizer_3
->Add(text_ctrl_8
, 0, wxEXPAND
, 0);
304 sizer_2
->Add(grid_sizer_3
, 1, wxEXPAND
, 0);
305 sizer_4
->Add(sizer_2
, 1, wxEXPAND
, 0);
306 sizer_1
->Add(sizer_4
, 0, wxLEFT
|wxRIGHT
|wxBOTTOM
|wxEXPAND
, 5);
307 sizer_7
->Add(label_10
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
308 sizer_7
->Add(MobilePhone
, 1, 0, 0);
309 sizer_7
->Add(20, 20, 0, 0, 0);
310 sizer_7
->Add(label_11
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
311 sizer_7
->Add(MobilePhone2
, 1, 0, 0);
312 sizer_7
->Add(20, 20, 0, 0, 0);
313 sizer_7
->Add(label_12
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
314 sizer_7
->Add(Pager
, 1, 0, 0);
315 sizer_1
->Add(sizer_7
, 0, wxLEFT
|wxRIGHT
|wxBOTTOM
|wxEXPAND
, 5);
316 sizer_8
->Add(Notes
, 0, wxEXPAND
, 0);
317 sizer_10
->Add(label_16
, 0, wxRIGHT
|wxALIGN_CENTER_VERTICAL
, 1);
318 sizer_10
->Add(Url
, 1, wxALL
, 2);
319 sizer_8
->Add(sizer_10
, 0, wxEXPAND
, 0);
320 sizer_1
->Add(sizer_8
, 1, wxLEFT
|wxRIGHT
|wxBOTTOM
|wxEXPAND
, 5);
323 sizer_1
->Add(bottom_buttons
, 0, wxLEFT
|wxRIGHT
|wxBOTTOM
|wxEXPAND
, 5);
325 // NOTE: the code generator will generate these 3 calls above.
326 // They may be removed above, since it will probably slow
327 // down the GUI display.
334 int ContactEditDlg::ShowModal()
336 int ret
= wxDialog::ShowModal();
340 void ContactEditDlg::OnPhotoButton(wxCommandEvent
&event
)
342 if( m_rec
.Image
.size() ) {
343 // an image exists, prompt user what to do
344 wxArrayString choices
;
345 choices
.Add( _T("Load new photo") );
346 choices
.Add( _T("Save current photo to disk") );
347 choices
.Add( _T("Delete current photo") );
349 int choice
= wxGetSingleChoiceIndex(
350 _T("A photo currently exists. Would you like to:"),
351 _T("Photo Management"),
356 case 0: // load new photo
357 if( m_photo
->PromptAndLoad(this) ) {
362 case 1: // save photo
363 m_photo
->PromptAndSave(this);
366 case 2: // delete photo
367 m_photo
->DeletePhoto();
377 // no image exists, assume he wants to load a new one
378 if( m_photo
->PromptAndLoad(this) ) {
379 // FIXME - if the photo is wider than old button,
380 // this doesn't seem to work. Why?
386 bool ContactEditDlg::TransferDataFromWindow()
388 if( !wxDialog::TransferDataFromWindow() )
392 Barry::Contact::CommaString2Email(m_email_list
, m_rec
.EmailAddresses
);
394 // one final validation: make sure either the name field or the
395 // company field has data
396 if( !m_rec
.GetFullName().size() && !m_rec
.Company
.size() ) {
397 wxMessageBox(_T("A contact record must contain either a First/Last name, or a Company name."),
398 _T("Required Fields"),
399 wxOK
| wxICON_INFORMATION
, this);