#include <creaImageIOWxAttributeSelectionPanel.h>

Public Member Functions | |
| WxAttributeSelectionPanel () | |
| WxAttributeSelectionPanel (wxWindow *parent, wxDialog *dial, WxGimmickView *view, std::vector< std::string > sAtts, std::vector< std::string > nsAtts, int numLev) | |
| ~WxAttributeSelectionPanel () | |
| Destructor. | |
| void | OnSaveConfig (wxCommandEvent &event) |
| Saves the configuration. | |
| void | OnAdd (wxCommandEvent &event) |
| Changes items from shown to notShown. | |
| void | OnRemove (wxCommandEvent &event) |
| Changes items from notShown to shown. | |
| void | OnComboChange (wxCommandEvent &event) |
Private Member Functions | |
| void | LoadCtrls () |
| Loads the information on the vectors onto the lists. | |
Private Attributes | |
| std::vector< std::string > | shownA |
| std::vector< std::string > | notShownA |
| wxComboBox * | levels |
| wxListCtrl * | shownAtts |
| wxListCtrl * | notShownAtts |
| wxDialog * | dialog |
| WxGimmickView * | mView |
Definition at line 17 of file creaImageIOWxAttributeSelectionPanel.h.
| creaImageIO::WxAttributeSelectionPanel::WxAttributeSelectionPanel | ( | ) |
| creaImageIO::WxAttributeSelectionPanel::WxAttributeSelectionPanel | ( | wxWindow * | parent, | |
| wxDialog * | dial, | |||
| WxGimmickView * | view, | |||
| std::vector< std::string > | sAtts, | |||
| std::vector< std::string > | nsAtts, | |||
| int | numLev | |||
| ) |
Definition at line 12 of file creaImageIOWxAttributeSelectionPanel.cpp.
References GimmickDebugMessage, creaImageIO::ID_COMBO, levels, LoadCtrls(), notShownAtts, OnAdd(), OnRemove(), OnSaveConfig(), and shownAtts.
: wxPanel( parent,
-1, wxDefaultPosition,
wxDefaultSize,
wxRESIZE_BORDER |
wxSYSTEM_MENU |
wxCLOSE_BOX |
wxMAXIMIZE_BOX |
wxMINIMIZE_BOX |
wxCAPTION
),
dialog(dial),
shownA(sAtts),
notShownA(nsAtts),
mView(view)
{
GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
<<std::endl);
wxStaticText * aa=new wxStaticText(this,-1,_T(" Currently shown attributes for level: "), wxPoint(5,10));
wxArrayString as;
std::stringstream out;
for(int i=1;i<=numLev;i++)
{
out<<i;
as.Add(crea::std2wx(out.str()));
out.str("");
}
levels=new wxComboBox(this, ID_COMBO,_T("1"),wxPoint(190, 5),wxDefaultSize,as);
wxStaticText * na=new wxStaticText(this,-1,_T(" Currently hidden attributes: "), wxPoint(255,10));
shownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(5,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
shownAtts->InsertColumn(0,
crea::std2wx(""),
wxLIST_FORMAT_LEFT);
shownAtts->SetColumnWidth(0,155);
shownAtts->Show();
wxButton *add = new wxButton(this,wxID_ANY,_T(">>"), wxPoint(170,50) );
Connect( add->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnAdd );
wxButton *remove = new wxButton(this,wxID_ANY,_T("<<"), wxPoint(170,70) );
Connect( remove->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnRemove );
notShownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(255,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
notShownAtts->InsertColumn(0,
crea::std2wx(""),
wxLIST_FORMAT_LEFT);
notShownAtts->SetColumnWidth(0,155);
notShownAtts->Show();
LoadCtrls();
wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,130) );
Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnSaveConfig );
Layout();
}

| creaImageIO::WxAttributeSelectionPanel::~WxAttributeSelectionPanel | ( | ) |
Destructor.
Definition at line 77 of file creaImageIOWxAttributeSelectionPanel.cpp.
References GimmickDebugMessage.
{
GimmickDebugMessage(1,"WxAttributeSelectionPanel::~WxAttributeSelectionPanel"
<<std::endl);
}
| void creaImageIO::WxAttributeSelectionPanel::LoadCtrls | ( | ) | [private] |
Loads the information on the vectors onto the lists.
Definition at line 150 of file creaImageIOWxAttributeSelectionPanel.cpp.
References notShownA, notShownAtts, shownA, and shownAtts.
Referenced by OnAdd(), OnComboChange(), OnRemove(), and WxAttributeSelectionPanel().
{
wxListItem item;
item.SetMask(wxLIST_MASK_STATE |
wxLIST_MASK_TEXT |
// wxLIST_MASK_IMAGE |
wxLIST_MASK_DATA |
// wxLIST_MASK_WIDTH |
wxLIST_MASK_FORMAT
);
std::vector<std::string>::iterator it;
shownAtts->DeleteAllItems();
notShownAtts->DeleteAllItems();
for(it=shownA.begin();it!=shownA.end();++it)
{
item.SetText(crea::std2wx(*it));
shownAtts->InsertItem(item);
}
for(it=notShownA.begin();it!=notShownA.end();++it)
{
item.SetText(crea::std2wx(*it));
notShownAtts->InsertItem(item);
}
}

| void creaImageIO::WxAttributeSelectionPanel::OnAdd | ( | wxCommandEvent & | event | ) |
Changes items from shown to notShown.
Definition at line 91 of file creaImageIOWxAttributeSelectionPanel.cpp.
References LoadCtrls(), notShownA, shownA, and shownAtts.
Referenced by WxAttributeSelectionPanel().
{
long item = -1;
for ( ;; )
{
item = shownAtts->GetNextItem(item,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if ( item == -1 )
break;
std::string change = crea::wx2std(shownAtts->GetItemText(item));
std::vector<std::string>::iterator it;
bool found=false;
for(it=shownA.begin();it!=shownA.end()&&!found;++it)
{
if((*it).compare(change)==0)
{
found=true;
}
}
shownA.erase(it-1);
notShownA.push_back(change);
}
LoadCtrls();
}


| void creaImageIO::WxAttributeSelectionPanel::OnComboChange | ( | wxCommandEvent & | event | ) |
Definition at line 178 of file creaImageIOWxAttributeSelectionPanel.cpp.
References creaImageIO::WxGimmickView::GetVisibleAttributes(), levels, LoadCtrls(), mView, notShownA, and shownA.

| void creaImageIO::WxAttributeSelectionPanel::OnRemove | ( | wxCommandEvent & | event | ) |
Changes items from notShown to shown.
Definition at line 119 of file creaImageIOWxAttributeSelectionPanel.cpp.
References LoadCtrls(), notShownA, notShownAtts, and shownA.
Referenced by WxAttributeSelectionPanel().
{
long item = -1;
for ( ;; )
{
item = notShownAtts->GetNextItem(item,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if ( item == -1 )
break;
std::string change = crea::wx2std(notShownAtts->GetItemText(item));
std::vector<std::string>::iterator it;
bool found=false;
for(it=notShownA.begin();it!=notShownA.end()&&!found;++it)
{
if((*it).compare(change)==0)
{
found=true;
}
}
notShownA.erase(it-1);
shownA.push_back(change);
}
LoadCtrls();
}


| void creaImageIO::WxAttributeSelectionPanel::OnSaveConfig | ( | wxCommandEvent & | event | ) |
Saves the configuration.
Definition at line 83 of file creaImageIOWxAttributeSelectionPanel.cpp.
References dialog, levels, mView, notShownA, and creaImageIO::WxGimmickView::OnAttributesChanged().
Referenced by WxAttributeSelectionPanel().
{
int n=levels->GetSelection();
if(n<0){n=0;}
mView->OnAttributesChanged(notShownA,n);
dialog->Destroy();
}


wxDialog* creaImageIO::WxAttributeSelectionPanel::dialog [private] |
Definition at line 46 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by OnSaveConfig().
wxComboBox* creaImageIO::WxAttributeSelectionPanel::levels [private] |
Definition at line 43 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by OnComboChange(), OnSaveConfig(), and WxAttributeSelectionPanel().
Definition at line 47 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by OnComboChange(), and OnSaveConfig().
std::vector<std::string> creaImageIO::WxAttributeSelectionPanel::notShownA [private] |
Definition at line 42 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by LoadCtrls(), OnAdd(), OnComboChange(), OnRemove(), and OnSaveConfig().
wxListCtrl* creaImageIO::WxAttributeSelectionPanel::notShownAtts [private] |
Definition at line 45 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by LoadCtrls(), OnRemove(), and WxAttributeSelectionPanel().
std::vector<std::string> creaImageIO::WxAttributeSelectionPanel::shownA [private] |
Definition at line 41 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by LoadCtrls(), OnAdd(), OnComboChange(), and OnRemove().
wxListCtrl* creaImageIO::WxAttributeSelectionPanel::shownAtts [private] |
Definition at line 44 of file creaImageIOWxAttributeSelectionPanel.h.
Referenced by LoadCtrls(), OnAdd(), and WxAttributeSelectionPanel().
1.7.1