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)
16 XABSearchPanel::XABSearchPanel( wxWindow* parent )
18 XABSearchPanelADT( parent )
21 // Setup the images for the add and delete buttons.
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);
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.
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"));
53 chkActive->SetValue(FALSE);
57 choOption->SetSelection(0);
61 void XABSearchPanel::UpdateOptions( wxCommandEvent& event )
64 if (choOption->GetSelection() == 12 ||
65 choOption->GetSelection() == 13 ||
66 choOption->GetSelection() == 14 ){
76 chkActive->SetValue(FALSE);
84 void XABSearchPanel::AddSearchWidget( wxCommandEvent& event )
87 frmSearch *SCHWin = static_cast<frmSearch*>(SCHWinPtr);
89 wxCommandEvent eventsend(SE_ADDSEARCHSETTING);
90 wxPostEvent(SCHWin, eventsend);
94 void XABSearchPanel::RemoveSearchWidget( wxCommandEvent& event )
97 frmSearch *SCHWin = static_cast<frmSearch*>(SCHWinPtr);
99 wxCommandEvent eventsend(SE_REMOVESEARCHSETTING);
100 eventsend.SetInt(this->GetInteger());
101 wxPostEvent(SCHWin, eventsend);
105 void XABSearchPanel::EnableButtons(bool AddButton, bool DeleteButton)
108 if (AddButton == TRUE){
114 if (DeleteButton == TRUE){
117 btnDelete->Disable();
122 void XABSearchPanel::SetupPointers(void* SCHWinPtrInc){
124 SCHWinPtr = SCHWinPtrInc;
128 void XABSearchPanel::SetupInteger(int IntInc){
134 int XABSearchPanel::GetInteger(){
140 void XABSearchPanel::DisableControls(wxCommandEvent &event){
142 choOption->Disable();
143 chkActive->Disable();
144 txtSearch->Disable();
146 btnDelete->Disable();
150 void XABSearchPanel::EnableControls(wxCommandEvent &event){
160 int XABSearchPanel::GetSelectionOption(){
162 return choOption->GetSelection();
166 bool XABSearchPanel::GetCheckboxSetting(){
168 return chkActive->IsChecked();
172 wxString XABSearchPanel::GetStringSetting(){
174 return txtSearch->GetValue();