1 #include <creaImageIOWxEditFieldsPanel.h>
2 #include <creaImageIOSystem.h>
5 //using namespace tree;
8 const int ID_COMBO = 140;
10 WxEditFieldsPanel::WxEditFieldsPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view, tree::Node* nod,
11 const std::vector<std::string> name,
12 const std::vector<std::string> key)
14 -1, wxDefaultPosition,
29 GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
31 /// \TODO fix warning: unused variable cp
32 wxStaticText * cp=new wxStaticText(this,-1,_T(" Attribute to change: "), wxPoint(5,10));
34 std::vector<std::string>::const_iterator it;
35 for(it=names.begin();it!=names.end();++it)
37 as.Add(crea::std2wx(*it));
39 attributes=new wxComboBox(this, ID_COMBO, crea::std2wx(names.front()), wxPoint(110, 10), wxDefaultSize,as);
40 std::string val=node->GetAttribute(keys[0]);
41 if(val.compare("")==0){val="?";}
43 /// \TODO fix warning: unused variable av
44 wxStaticText * av=new wxStaticText(this,-1,_T(" Current Value: "), wxPoint(5,40));
45 actualVal=new wxStaticText(this,-1,crea::std2wx(val), wxPoint(110,40));
47 /// \TODO fix warning: unused variable nv
48 wxStaticText * nv=new wxStaticText(this,-1,_T(" New Value: "), wxPoint(5,70));
49 newVal=new wxTextCtrl(this, wxID_ANY, crea::std2wx(val), wxPoint(110,70), wxSize(220,20));
51 wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,100) );
52 Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxEditFieldsPanel::OnEdit );
58 WxEditFieldsPanel::~WxEditFieldsPanel()
60 GimmickDebugMessage(1,"WxEditFieldsPanel::~WxEditFieldsPanel"
64 void WxEditFieldsPanel::OnEdit(wxCommandEvent& event)
66 std::string val=crea::wx2std(newVal->GetValue());
67 int sel=attributes->GetSelection();
72 mView->OnFieldsEdited(node,names[sel],keys[sel],val);
76 void WxEditFieldsPanel::OnComboChange(wxCommandEvent& event)
78 std::string val=node->GetAttribute(keys[attributes->GetSelection()]);
79 if(val.compare("")==0){val="?";}
80 actualVal->SetLabel(crea::std2wx(val));
81 newVal->SetValue(crea::std2wx(val));
84 //======================================================================
85 BEGIN_EVENT_TABLE(WxEditFieldsPanel, wxPanel)
86 EVT_COMBOBOX (ID_COMBO,WxEditFieldsPanel::OnComboChange)
88 //======================================================================
90 } // EO namespace creaImageIO