Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Splitting frmContactEditor.cpp into 15 files to make it more manageable.
[xestiaab/.git] / source / contacteditor / frmContactEditor-Events.cpp
1 #include "frmContactEditor.h"
3 bool frmContactEditor::ProcessEvent(wxEvent& event)
4 {
5     
6     // This section has been taken from the wxWidgets sample code of richtext.cpp
7     // so that simple Cut/Copy/Paste code can be made.
8     
9     // As this code comes from the samples of the wxWidgets library, this is licenced
10     // under the wxWindows Library Licence and is compatable with the LGPL and is
11     // compatable with Xestia Address Book's licence.
12     
13     if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
14     {
15         // Problem: we can get infinite recursion because the events
16         // climb back up to this frame, and repeat.
17         // Assume that command events don't cause another command event
18         // to be called, so we can rely on inCommand not being overwritten
19         
20         static int s_eventType = 0;
21         static wxWindowID s_id = 0;
22         
23         if (s_id != event.GetId() && s_eventType != event.GetEventType())
24         {
25             s_eventType = event.GetEventType();
26             s_id = event.GetId();
27             
28             wxWindow* focusWin = wxFindFocusDescendant(this);
29             if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
30             {
31                 //s_command = NULL;
32                 s_eventType = 0;
33                 s_id = 0;
34                 return true;
35             }
36             s_eventType = 0;
37             s_id = 0;
38         }
39         else
40         {
41             return false;
42         }
43     }
44     
45     return wxFrame::ProcessEvent(event);
46 }
48 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
49     
50     // Generate a drop down list of common names to use for the display as drop down box.
51     
52     wxString SetValue = cmbDisplayAs->GetValue();
53     
54     cmbDisplayAs->Clear();
55     cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
56     if (!txtOtherNames->GetValue().IsEmpty()){
57         
58         cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());     
59         
60     }
61     cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue()); 
62     if (!txtOtherNames->GetValue().IsEmpty()){
63         
64         cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
65         
66     }
67     if (!txtTitle->GetValue().IsEmpty()){
68         cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
69     }
70     
71     cmbDisplayAs->SetValue(SetValue);
72     
73     this->SetTitle(cmbDisplayAs->GetValue());
74     
75 }
77 void frmContactEditor::UpdateName( wxCommandEvent &event ){
78     
79     this->SetTitle(cmbDisplayAs->GetValue());
80     
81     WindowData *WData = new WindowData;
82     
83     WData->DataType = 1;
84     WData->WindowPointer = this;
85     WData->WindowID = ContactEditorUID;
86     
87     wxCommandEvent editevent(WINDOW_EDIT);
88     editevent.SetClientData(WData);
89     wxPostEvent(GetParent(), editevent);
90     
91 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy