Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmPreferences: Removed std::cout printing contact background colour
[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 {
24         // Process the cut/copy/paste events.
26         // This section has been taken from the wxWidgets sample code of richtext.cpp
27         // so that simple Cut/Copy/Paste code can be made.
28     
29         // As this code comes from the samples of the wxWidgets library, this is licenced
30         // under the wxWindows Library Licence and is compatable with the LGPL and is
31         // compatable with Xestia Address Book's licence.
32     
33         if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent))){
34                 // Problem: we can get infinite recursion because the events
35                 // climb back up to this frame, and repeat.
36                 // Assume that command events don't cause another command event
37                 // to be called, so we can rely on inCommand not being overwritten
38         
39                 static int s_eventType = 0;
40                 static wxWindowID s_id = 0;
41         
42                 if (s_id != event.GetId() && s_eventType != event.GetEventType()){
43                         
44                         s_eventType = event.GetEventType();
45                         s_id = event.GetId();
46             
47                         wxWindow* focusWin = wxFindFocusDescendant(this);
48                         if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)){
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     
64         return wxFrame::ProcessEvent(event);
65         
66 }
68 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
69     
70         // Generate a drop down list of common names to 
71         // use for the display as drop down box.
72     
73         wxString SetValue = cmbDisplayAs->GetValue();
74     
75         cmbDisplayAs->Clear();
76         cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
77         if (!txtOtherNames->GetValue().IsEmpty()){
78         
79                 cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());     
80         
81         }
82         cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());
83         if (!txtOtherNames->GetValue().IsEmpty()){
84         
85                 cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
86         
87         }
88         if (!txtTitle->GetValue().IsEmpty()){
89                 cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
90         }
91         cmbDisplayAs->SetValue(SetValue);
92     
93         this->SetTitle(cmbDisplayAs->GetValue());
94     
95 }
97 void frmContactEditor::UpdateName( wxCommandEvent &event ){
99         // Update the window title and main window menu item
100         // with the new name.
102         this->SetTitle(cmbDisplayAs->GetValue());
103     
104         WindowData *WData = new WindowData;
105     
106         if (StartupEditMode == FALSE){
107     
108                 WData->DataType = 1;
109                 WData->WindowPointer = this;
110                 WData->WindowID = ContactEditorUID;
111     
112                 wxCommandEvent editevent(WINDOW_EDIT);
113                 editevent.SetClientData(WData);
114                 wxPostEvent(GetParent(), editevent);
115     
116         }
117     
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