1 // frmContactEditor-Category.cpp - frmContactEditor Category tab subroutines.
3 // (c) 2012-2016 Xestia Software Development.
5 // This file is part of Xestia Address Book.
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.
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.
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"
20 #include "frmContactEditorCategory.h"
22 void frmContactEditor::AddCategory( wxCommandEvent& event )
25 // Bring up the window to add a category.
27 frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
28 frameCECategory->SetEditorMode(FALSE);
29 frameCECategory->SetupPointers(&ContactEditorData.CategoriesList,
30 &ContactEditorData.CategoriesListAltID,
31 &ContactEditorData.CategoriesListPID,
32 &ContactEditorData.CategoriesListType,
33 &ContactEditorData.CategoriesListTokens,
34 &ContactEditorData.CategoriesListPref,
37 frameCECategory->ShowModal();
38 delete frameCECategory;
39 frameCECategory = NULL;
44 void frmContactEditor::ModifyCategory( wxCommandEvent& event )
47 // Bring up the window to edit a category.
49 long longSelected = -1;
50 int intSelectedData = 0;
52 if (lboCategories->GetItemCount() == 0 || !GetSelectedItem(lboCategories,
60 frmContactEditorCategory *frameCECategory = new frmContactEditorCategory ( this );
61 frameCECategory->SetupPointers(&ContactEditorData.CategoriesList,
62 &ContactEditorData.CategoriesListAltID,
63 &ContactEditorData.CategoriesListPID,
64 &ContactEditorData.CategoriesListType,
65 &ContactEditorData.CategoriesListTokens,
66 &ContactEditorData.CategoriesListPref,
69 frameCECategory->SetEditorMode(TRUE);
70 frameCECategory->ShowModal();
71 delete frameCECategory;
72 frameCECategory = NULL;
76 void frmContactEditor::DeleteCategory( wxCommandEvent& event )
79 // Bring up the window to delete the category.
81 long longSelected = -1;
82 int intSelectedData = 0;
84 if (lboCategories->GetItemCount() == 0 || !GetSelectedItem(lboCategories,
92 lboCategories->DeleteItem(longSelected);
94 DeleteMapData(intSelectedData, &ContactEditorData.CategoriesList,
95 &ContactEditorData.CategoriesListAltID, &ContactEditorData.CategoriesListPID,
96 &ContactEditorData.CategoriesListType, &ContactEditorData.CategoriesListTokens,
97 &ContactEditorData.CategoriesListPref);