+#include <creaImageIOWxListenerPanel.h>
+#include <creaImageIOSystem.h>
+
+namespace creaImageIO
+{
+ // CTor
+ WxListenerPanel::WxListenerPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view, bool stat)
+ : wxPanel( parent,
+ -1, wxDefaultPosition,
+ wxDefaultSize,
+ wxRESIZE_BORDER |
+ wxSYSTEM_MENU |
+ wxCLOSE_BOX |
+ wxMAXIMIZE_BOX |
+ wxMINIMIZE_BOX |
+ wxCAPTION
+ ),
+ dialog(dial),
+ mView(view)
+ {
+ GimmickDebugMessage(1,"WxListener::WxListener"
+ <<std::endl);
+ state=stat;
+ wxStaticText * cp=new wxStaticText(this,-1,_T(" Drive to monitor: "), wxPoint(5,15));
+ const wxString choices[] = { _T("D:"),
+ _T("E:"),
+ _T("F:"),
+ _T("G:") };
+ drives=new wxComboBox(this, -1,"E:",wxPoint(100, 10),wxDefaultSize,4,choices);
+
+ addCheckBox = new wxCheckBox(this, -1, _T("Automatically add images to the database when CD/DVD is mounted?"), wxPoint(5,45) );
+ addCheckBox->SetValue(true);
+ removeCheckBox = new wxCheckBox(this, -1, _T("Automatically remove images from the database when CD/DVD is unmounted?"), wxPoint(5,75) );
+ removeCheckBox->SetValue(true);
+ Connect( addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxListenerPanel::OnAdd );
+ Connect( removeCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxListenerPanel::OnRemove );
+ std::string name;
+ if (state){name="Start Monitoring Drive";}
+ else {name="Stop Monitoring Drive";}
+ wxButton *start = new wxButton(this,wxID_ANY,_T(name), wxPoint(5,110) );
+ Connect( start->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxListenerPanel::OnChangeThreadState );
+
+ wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(130,110) );
+ Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxListenerPanel::OnChangeListenState );
+
+
+ //topsizer->Add( mView,1,wxGROW,0);
+
+// SetSizer( topsizer );
+ Layout();
+ }
+
+ /// Destructor
+ WxListenerPanel::~WxListenerPanel()
+ {
+ GimmickDebugMessage(1,"WxCustomizeConfigPanel::~WxCustomizeConfigPanel"
+ <<std::endl);
+ }
+
+ void WxListenerPanel::OnAdd(wxCommandEvent& event)
+ {
+ addFiles = addCheckBox->GetValue();
+ }
+
+ void WxListenerPanel::OnRemove(wxCommandEvent& event)
+ {
+ removeFiles = removeCheckBox->GetValue();
+ }
+
+ void WxListenerPanel::OnChangeListenState(wxCommandEvent& event)
+ {
+ mView->OnListenerCallback(crea::wx2std(drives->GetValue()),addFiles, removeFiles);
+ dialog->Destroy();
+ }
+
+ void WxListenerPanel::OnChangeThreadState(wxCommandEvent& event)
+ {
+ if(state)
+ {
+ mView->StartListeningThread();
+ }
+ else
+ {
+ mView->StopListeningThread();
+ }
+ dialog->Destroy();
+ }
+
+//======================================================================
+
+//======================================================================
+
+} // EO namespace creaImageIO
+
+