1 #include <creaImageIOWxAttributeSelectionPanel.h>
2 #include <creaImageIOSystem.h>
6 const int ID_COMBO = 180;
8 WxAttributeSelectionPanel::WxAttributeSelectionPanel(wxWindow *parent,
11 std::vector<std::string> sAtts,
12 std::vector<std::string> nsAtts,
15 -1, wxDefaultPosition,
29 GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
31 wxStaticText * aa=new wxStaticText(this,-1,_T(" Currently shown attributes for level: "), wxPoint(5,10));
33 std::stringstream out;
34 for(int i=1;i<=numLev;i++)
40 levels=new wxComboBox(this, ID_COMBO,"1",wxPoint(190, 5),wxDefaultSize,as);
41 wxStaticText * na=new wxStaticText(this,-1,_T(" Currently hidden attributes: "), wxPoint(255,10));
43 shownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(5,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL );
45 shownAtts->InsertColumn(0,
48 shownAtts->SetColumnWidth(0,155);
51 wxButton *add = new wxButton(this,wxID_ANY,_T(">>"), wxPoint(170,50) );
52 Connect( add->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnAdd );
54 wxButton *remove = new wxButton(this,wxID_ANY,_T("<<"), wxPoint(170,70) );
55 Connect( remove->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnRemove );
57 notShownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(255,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL );
59 notShownAtts->InsertColumn(0,
62 notShownAtts->SetColumnWidth(0,155);
66 wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,130) );
67 Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnSaveConfig );
73 WxAttributeSelectionPanel::~WxAttributeSelectionPanel()
75 GimmickDebugMessage(1,"WxAttributeSelectionPanel::~WxAttributeSelectionPanel"
79 void WxAttributeSelectionPanel::OnSaveConfig(wxCommandEvent& event)
81 /*mView->OnSaveSettingsCallback(crea::wx2std(copyPath->GetValue()),
82 crea::wx2std(dbPath->GetValue()),
83 crea::wx2std(syncEvent->GetValue()),
84 crea::wx2std(syncFrequency->GetValue()));
89 void WxAttributeSelectionPanel::OnAdd(wxCommandEvent& event)
94 item = shownAtts->GetNextItem(item,
96 wxLIST_STATE_SELECTED);
100 std::string change=shownAtts->GetItemText(item);
101 std::vector<std::string>::iterator it;
103 for(it=shownA.begin();it!=shownA.end()&&!found;++it)
105 if((*it).compare(change)==0)
111 notShownA.push_back(change);
118 void WxAttributeSelectionPanel::OnRemove(wxCommandEvent& event)
124 item = notShownAtts->GetNextItem(item,
126 wxLIST_STATE_SELECTED);
130 std::string change=notShownAtts->GetItemText(item);
131 std::vector<std::string>::iterator it;
133 for(it=notShownA.begin();it!=notShownA.end()&&!found;++it)
135 if((*it).compare(change)==0)
140 notShownA.erase(it-1);
141 shownA.push_back(change);
149 void WxAttributeSelectionPanel::LoadCtrls()
153 item.SetMask(wxLIST_MASK_STATE |
155 // wxLIST_MASK_IMAGE |
157 // wxLIST_MASK_WIDTH |
160 std::vector<std::string>::iterator it;
161 shownAtts->DeleteAllItems();
162 notShownAtts->DeleteAllItems();
163 for(it=shownA.begin();it!=shownA.end();++it)
165 item.SetText(crea::std2wx(*it));
166 shownAtts->InsertItem(item);
170 for(it=notShownA.begin();it!=notShownA.end();++it)
172 item.SetText(crea::std2wx(*it));
173 notShownAtts->InsertItem(item);
177 void WxAttributeSelectionPanel::OnComboChange(wxCommandEvent& event)
179 int n=levels->GetSelection()+1;
180 mView->GetVisibleAttributes(shownA,notShownA,n);
184 //======================================================================
185 BEGIN_EVENT_TABLE(WxAttributeSelectionPanel, wxPanel)
186 EVT_COMBOBOX (ID_COMBO,WxAttributeSelectionPanel::OnComboChange)
188 //======================================================================
190 } // EO namespace creaImageIO