Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added copyright and license header to the C++ source and header files in the contacte...
[xestiaab/.git] / source / contacteditor / frmContactEditor-Events.cpp
1 // frmContactEditor-Events.cpp - frmContactEditor Events subroutines.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
21 bool frmContactEditor::ProcessEvent(wxEvent& event)
22 {
23     
24     // This section has been taken from the wxWidgets sample code of richtext.cpp
25     // so that simple Cut/Copy/Paste code can be made.
26     
27     // As this code comes from the samples of the wxWidgets library, this is licenced
28     // under the wxWindows Library Licence and is compatable with the LGPL and is
29     // compatable with Xestia Address Book's licence.
30     
31     if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
32     {
33         // Problem: we can get infinite recursion because the events
34         // climb back up to this frame, and repeat.
35         // Assume that command events don't cause another command event
36         // to be called, so we can rely on inCommand not being overwritten
37         
38         static int s_eventType = 0;
39         static wxWindowID s_id = 0;
40         
41         if (s_id != event.GetId() && s_eventType != event.GetEventType())
42         {
43             s_eventType = event.GetEventType();
44             s_id = event.GetId();
45             
46             wxWindow* focusWin = wxFindFocusDescendant(this);
47             if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
48             {
49                 //s_command = NULL;
50                 s_eventType = 0;
51                 s_id = 0;
52                 return true;
53             }
54             s_eventType = 0;
55             s_id = 0;
56         }
57         else
58         {
59             return false;
60         }
61     }
62     
63     return wxFrame::ProcessEvent(event);
64 }
66 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
67     
68     // Generate a drop down list of common names to use for the display as drop down box.
69     
70     wxString SetValue = cmbDisplayAs->GetValue();
71     
72     cmbDisplayAs->Clear();
73     cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
74     if (!txtOtherNames->GetValue().IsEmpty()){
75         
76         cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());     
77         
78     }
79     cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue()); 
80     if (!txtOtherNames->GetValue().IsEmpty()){
81         
82         cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
83         
84     }
85     if (!txtTitle->GetValue().IsEmpty()){
86         cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
87     }
88     
89     cmbDisplayAs->SetValue(SetValue);
90     
91     this->SetTitle(cmbDisplayAs->GetValue());
92     
93 }
95 void frmContactEditor::UpdateName( wxCommandEvent &event ){
96     
97     this->SetTitle(cmbDisplayAs->GetValue());
98     
99     WindowData *WData = new WindowData;
100     
101     WData->DataType = 1;
102     WData->WindowPointer = this;
103     WData->WindowID = ContactEditorUID;
104     
105     wxCommandEvent editevent(WINDOW_EDIT);
106     editevent.SetClientData(WData);
107     wxPostEvent(GetParent(), editevent);
108     
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