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 wxStaticText * cp=new wxStaticText(this,-1,_T(" Attribute to change: "), wxPoint(5,10));
33 std::vector<std::string>::const_iterator it;
34 for(it=names.begin();it!=names.end();++it)
36 as.Add(crea::std2wx(*it));
38 attributes=new wxComboBox(this, ID_COMBO, crea::std2wx(names.front()), wxPoint(110, 10), wxDefaultSize,as);
39 std::string val=node->GetAttribute(keys[0]);
40 if(val.compare("")==0){val="?";}
42 wxStaticText * av=new wxStaticText(this,-1,_T(" Current Value: "), wxPoint(5,40));
43 actualVal=new wxStaticText(this,-1,crea::std2wx(val), wxPoint(110,40));
45 wxStaticText * nv=new wxStaticText(this,-1,_T(" New Value: "), wxPoint(5,70));
46 newVal=new wxTextCtrl(this, wxID_ANY, crea::std2wx(val), wxPoint(110,70), wxSize(220,20));
48 wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,100) );
49 Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxEditFieldsPanel::OnEdit );
55 WxEditFieldsPanel::~WxEditFieldsPanel()
57 GimmickDebugMessage(1,"WxEditFieldsPanel::~WxEditFieldsPanel"
61 void WxEditFieldsPanel::OnEdit(wxCommandEvent& event)
63 std::string val=crea::wx2std(newVal->GetValue());
64 int sel=attributes->GetSelection();
69 mView->OnFieldsEdited(node,names[sel],keys[sel],val);
73 void WxEditFieldsPanel::OnComboChange(wxCommandEvent& event)
75 std::string val=node->GetAttribute(keys[attributes->GetSelection()]);
76 if(val.compare("")==0){val="?";}
77 actualVal->SetLabel(crea::std2wx(val));
78 newVal->SetValue(crea::std2wx(val));
81 //======================================================================
82 BEGIN_EVENT_TABLE(WxEditFieldsPanel, wxPanel)
83 EVT_COMBOBOX (ID_COMBO,WxEditFieldsPanel::OnComboChange)
85 //======================================================================
87 } // EO namespace creaImageIO