Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / search / XABSearchPanel.cpp
1 #include "XABSearchPanel.h"
2 #include "../bitmaps.h"
4 #include <wx/mstream.h>
8 DEFINE_EVENT_TYPE(XABSP_ENABLECONTROLS);
9 DEFINE_EVENT_TYPE(XABSP_DISABLECONTROLS);
11 BEGIN_EVENT_TABLE(XABSearchPanel, wxPanel)
12   EVT_COMMAND(wxID_ANY, XABSP_ENABLECONTROLS, XABSearchPanel::EnableControls)
13   EVT_COMMAND(wxID_ANY, XABSP_DISABLECONTROLS, XABSearchPanel::DisableControls)
14 END_EVENT_TABLE()
16 XABSearchPanel::XABSearchPanel( wxWindow* parent )
17 :
18 XABSearchPanelADT( parent )
19 {
21         // Setup the images for the add and delete buttons.
22         
23         wxMemoryInputStream astream(buttons_add_png, sizeof(buttons_add_png));
24         wxImage buttons_add_png(astream, wxBITMAP_TYPE_PNG);
25         wxBitmap addbmp(buttons_add_png, -1);
26         
27         wxMemoryInputStream bstream(buttons_minus_png, sizeof(buttons_minus_png));
28         wxImage buttons_minus_png(bstream, wxBITMAP_TYPE_PNG);
29         wxBitmap delbmp(buttons_minus_png, -1);
31         btnAdd->SetBitmapLabel(addbmp);
32         btnDelete->SetBitmapLabel(delbmp);
34         // Insert the options into the combo box.
35         
36         choOption->Append(_("Forename begins with"));
37         choOption->Append(_("Forename ends with"));
38         choOption->Append(_("Forename contains"));
39         choOption->Append(_("Forename doesn't contain"));
40         choOption->Append(_("Surname begins with"));
41         choOption->Append(_("Surname ends with"));
42         choOption->Append(_("Surname contains"));
43         choOption->Append(_("Surname doesn't contain"));
44         choOption->Append(_("Nickname begins with"));
45         choOption->Append(_("Nickname ends with"));
46         choOption->Append(_("Nickname contains"));
47         choOption->Append(_("Nickname doesn't contain"));
48         choOption->Append(_("Does/Doesn't have photo"));
49         choOption->Append(_("Does/Doesn't have logo"));
50         choOption->Append(_("Does/Doesn't have sound"));
51         
52         chkActive->Hide();
53         chkActive->SetValue(FALSE);
54         txtSearch->Show();
55         szrSSet->Layout();
56         
57         choOption->SetSelection(0);
59 }
61 void XABSearchPanel::UpdateOptions( wxCommandEvent& event )
62 {
63         
64         if (choOption->GetSelection() == 12 ||
65         choOption->GetSelection() == 13 ||
66         choOption->GetSelection() == 14 ){
67         
68                 chkActive->Show();
69                 txtSearch->Hide();
70                 txtSearch->Clear();
71                 szrSSet->Layout();
72         
73         } else {
74         
75                 chkActive->Hide();
76                 chkActive->SetValue(FALSE);
77                 txtSearch->Show();
78                 szrSSet->Layout();
79         
80         }
81         
82 }
84 void XABSearchPanel::AddSearchWidget( wxCommandEvent& event )
85 {
87         frmSearch *SCHWin = static_cast<frmSearch*>(SCHWinPtr);
89         wxCommandEvent eventsend(SE_ADDSEARCHSETTING);
90         wxPostEvent(SCHWin, eventsend);
92 }
94 void XABSearchPanel::RemoveSearchWidget( wxCommandEvent& event )
95 {
97         frmSearch *SCHWin = static_cast<frmSearch*>(SCHWinPtr);
98         
99         wxCommandEvent eventsend(SE_REMOVESEARCHSETTING);
100         eventsend.SetInt(this->GetInteger());
101         wxPostEvent(SCHWin, eventsend);
102         
105 void XABSearchPanel::EnableButtons(bool AddButton, bool DeleteButton)
108         if (AddButton == TRUE){
109                 btnAdd->Enable();
110         } else {
111                 btnAdd->Disable();
112         }
113         
114         if (DeleteButton == TRUE){
115                 btnDelete->Enable();
116         } else {
117                 btnDelete->Disable();
118         }
122 void XABSearchPanel::SetupPointers(void* SCHWinPtrInc){
124         SCHWinPtr = SCHWinPtrInc;
128 void XABSearchPanel::SetupInteger(int IntInc){
130         SCHInt = IntInc;
134 int XABSearchPanel::GetInteger(){
136         return SCHInt;
140 void XABSearchPanel::DisableControls(wxCommandEvent &event){
142         choOption->Disable();
143         chkActive->Disable();
144         txtSearch->Disable();
145         btnAdd->Disable();
146         btnDelete->Disable();
150 void XABSearchPanel::EnableControls(wxCommandEvent &event){
152         choOption->Enable();
153         chkActive->Enable();
154         txtSearch->Enable();
155         btnAdd->Enable();
156         btnDelete->Enable();
160 int XABSearchPanel::GetSelectionOption(){
162         return choOption->GetSelection();
166 bool XABSearchPanel::GetCheckboxSetting(){
168         return chkActive->IsChecked();
172 wxString XABSearchPanel::GetStringSetting(){
174         return txtSearch->GetValue();
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