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