[go: up one dir, main page]

Menu

[r4]: / trunk / gui / contactdlg.h  Maximize  Restore  History

Download this file

157 lines (121 with data), 4.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#ifndef CONTACTDLG_H_INCLUDED
#define CONTACTDLG_H_INCLUDED
// This file is part of c'mon, a lightweight telephony monitor.
//
// Copyright (C) 2012 Peter Schaefer-Hutter ("THE AUTHOR")
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
// ----------------------------------------------------------------------------
// NOTE: This License does NOT permit incorporating this file (or parts or
// changed versions of it) into proprietary programs that are
// distributed to third-parties in binary form only.
// ----------------------------------------------------------------------------
// You can contact the original author by email at peter.schaefer@gmx.de
// if you need different license-terms or other modifications to c'mon.
// $Revision: 10 $ $Date: 2012-09-21 21:35:29 +0200 (Fri, 21 Sep 2012) $
#include "glob/contact.h"
// ----------------------------------------------------------------------------
// Phone number UI model
// ----------------------------------------------------------------------------
class CPhoneNumberModel : public wxDataViewVirtualListModel
{
public:
enum
{
Column_NumberType,
Column_Number,
Column_Info,
Column_Note,
Column_Count
};
CPhoneNumberModel(TPhoneList& rPhones);
void AddItem();
void DeleteItem(const wxDataViewItem &item);
wxString GetTitle(unsigned int col) const;
const TPhoneList& GetPhones() const
{
return m_Phones;
}
virtual unsigned int GetColumnCount() const
{
return Column_Count;
}
virtual wxString GetColumnType(unsigned int col) const
{
if (col == Column_NumberType) {
return wxT("integer");
}
return wxT("string");
}
virtual unsigned int GetRowCount()
{
return m_Phones.size();
}
virtual void GetValueByRow(wxVariant &variant, unsigned int row, unsigned int col) const;
virtual bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr &attr) const;
virtual bool SetValueByRow(const wxVariant &variant, unsigned int row, unsigned int col);
private:
TPhoneList& m_Phones;
};
// ----------------------------------------------------------------------------
class CPictureControl;
class CContactDialog : public wxDialog
{
class CPhoneListCtrl;
class DetailPage1 : public wxPanel
{
public:
DetailPage1(wxWindow* parent, TPhoneList& phones, wxWindowID id = wxID_ANY);
virtual ~DetailPage1();
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY);
void OnAddPhone(wxCommandEvent&);
void OnDelPhone(wxCommandEvent&);
void OnUpdateDelPhone(wxUpdateUIEvent&);
protected:
CPhoneNumberModel *m_pModel;
wxDataViewCtrl *m_dvPhones;
protected:
DECLARE_EVENT_TABLE()
};
// -------------
public:
CContactDialog(wxWindow* parent, CContact& rContact);
void OnNameChanged(wxCommandEvent&);
void OnUpdateOk(wxUpdateUIEvent&);
void OnAddPicture(wxCommandEvent&);
void OnDelPicture(wxCommandEvent&);
void OnUpdateDelPicture(wxUpdateUIEvent&);
virtual void EndModal(int retCode);
void GetData(CContact& c);
protected:
void SetData(const CContact& c);
bool findSN(const wxString&);
void updateSN();
protected:
CContactDialogData m_data;
wxTextCtrl* m_txtFN;
wxTextCtrl* m_txtMN;
wxTextCtrl* m_txtLN;
wxTextCtrl* m_txtTitle;
wxTextCtrl* m_txtNN;
wxComboBox* m_cbSN;
wxTextCtrl* m_txtOrg;
wxTextCtrl* m_txtMail;
CPictureControl* m_bmpPhoto;
wxNotebook* m_nbDetails;
wxArrayString m_Names;
protected:
DECLARE_EVENT_TABLE()
};
#endif /* CONTACTDLG_H_INCLUDED */