creaImageIO_lib
creaImageIO::WxAttributeSelectionPanel Class Reference

#include <creaImageIOWxAttributeSelectionPanel.h>

Inheritance diagram for creaImageIO::WxAttributeSelectionPanel:
Collaboration diagram for creaImageIO::WxAttributeSelectionPanel:

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. More...
 
void OnSaveConfig (wxCommandEvent &event)
 Saves the configuration. More...
 
void OnAdd (wxCommandEvent &event)
 Changes items from shown to notShown. More...
 
void OnRemove (wxCommandEvent &event)
 Changes items from notShown to shown. More...
 
void OnComboChange (wxCommandEvent &event)
 

Private Member Functions

void LoadCtrls ()
 Loads the information on the vectors onto the lists. More...
 

Private Attributes

std::vector< std::string > shownA
 
std::vector< std::string > notShownA
 
wxComboBox * levels
 
wxListCtrl * shownAtts
 
wxListCtrl * notShownAtts
 
wxDialog * dialog
 
WxGimmickViewmView
 

Detailed Description

Definition at line 45 of file creaImageIOWxAttributeSelectionPanel.h.

Constructor & Destructor Documentation

creaImageIO::WxAttributeSelectionPanel::WxAttributeSelectionPanel ( )
creaImageIO::WxAttributeSelectionPanel::WxAttributeSelectionPanel ( wxWindow *  parent,
wxDialog *  dial,
WxGimmickView view,
std::vector< std::string >  sAtts,
std::vector< std::string >  nsAtts,
int  numLev 
)

fix warning: unused variable aa

fix warning: unused variable na

Definition at line 40 of file creaImageIOWxAttributeSelectionPanel.cpp.

References GimmickDebugMessage, creaImageIO::ID_COMBO, levels, LoadCtrls(), notShownAtts, OnAdd(), OnRemove(), OnSaveConfig(), and shownAtts.

46  : wxPanel( parent,
47  -1, wxDefaultPosition,
48  wxDefaultSize,
49  wxRESIZE_BORDER |
50  wxSYSTEM_MENU |
51  wxCLOSE_BOX |
52  wxMAXIMIZE_BOX |
53  wxMINIMIZE_BOX |
54  wxCAPTION
55  ),
56  dialog(dial),
57  shownA(sAtts),
58  notShownA(nsAtts),
59  mView(view)
60  {
61  GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
62  <<std::endl);
64  wxStaticText * aa = new wxStaticText(this,-1,_T(" Currently shown attributes for level: "), wxPoint(5,10));
65  wxArrayString as;
66  std::stringstream out;
67  for(int i=1;i<=numLev;i++)
68  {
69  out<<i;
70  as.Add(crea::std2wx(out.str()));
71  out.str("");
72  }
73  levels=new wxComboBox(this, ID_COMBO,_T("1"),wxPoint(190, 5),wxDefaultSize,as);
75  wxStaticText * na=new wxStaticText(this,-1,_T(" Currently hidden attributes: "), wxPoint(255,10));
76 
77  shownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(5,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
78 
79  shownAtts->InsertColumn(0,
80  crea::std2wx(""),
81  wxLIST_FORMAT_LEFT);
82  shownAtts->SetColumnWidth(0,155);
83  shownAtts->Show();
84 
85  wxButton *add = new wxButton(this,wxID_ANY,_T(">>"), wxPoint(170,50) );
86  Connect( add->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnAdd );
87 
88  wxButton *remove = new wxButton(this,wxID_ANY,_T("<<"), wxPoint(170,70) );
89  Connect( remove->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnRemove );
90 
91  notShownAtts=new wxListCtrl(this, wxID_ANY, wxPoint(255,30), wxSize(160,90), wxLC_REPORT | wxLC_NO_HEADER );
92 
93  notShownAtts->InsertColumn(0,
94  crea::std2wx(""),
95  wxLIST_FORMAT_LEFT);
96  notShownAtts->SetColumnWidth(0,155);
97  notShownAtts->Show();
98  LoadCtrls();
99 
100  wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,130) );
101  Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxAttributeSelectionPanel::OnSaveConfig );
102 
103  Layout();
104  }

Here is the call graph for this function:

creaImageIO::WxAttributeSelectionPanel::~WxAttributeSelectionPanel ( )

Destructor.

Definition at line 107 of file creaImageIOWxAttributeSelectionPanel.cpp.

References GimmickDebugMessage.

108  {
109  GimmickDebugMessage(1,"WxAttributeSelectionPanel::~WxAttributeSelectionPanel"
110  <<std::endl);
111  }

Member Function Documentation

void creaImageIO::WxAttributeSelectionPanel::LoadCtrls ( )
private

Loads the information on the vectors onto the lists.

Definition at line 180 of file creaImageIOWxAttributeSelectionPanel.cpp.

References notShownA, notShownAtts, shownA, and shownAtts.

Referenced by OnAdd(), OnComboChange(), OnRemove(), and WxAttributeSelectionPanel().

181  {
182 
183  wxListItem item;
184  item.SetMask(wxLIST_MASK_STATE |
185  wxLIST_MASK_TEXT |
186  // wxLIST_MASK_IMAGE |
187  wxLIST_MASK_DATA |
188  // wxLIST_MASK_WIDTH |
189  wxLIST_MASK_FORMAT
190  );
191  std::vector<std::string>::iterator it;
192  shownAtts->DeleteAllItems();
193  notShownAtts->DeleteAllItems();
194  for(it=shownA.begin();it!=shownA.end();++it)
195  {
196  item.SetText(crea::std2wx(*it));
197  shownAtts->InsertItem(item);
198  }
199 
200 
201  for(it=notShownA.begin();it!=notShownA.end();++it)
202  {
203  item.SetText(crea::std2wx(*it));
204  notShownAtts->InsertItem(item);
205  }
206 
207  }

Here is the caller graph for this function:

void creaImageIO::WxAttributeSelectionPanel::OnAdd ( wxCommandEvent &  event)

Changes items from shown to notShown.

Definition at line 121 of file creaImageIOWxAttributeSelectionPanel.cpp.

References LoadCtrls(), notShownA, shownA, and shownAtts.

Referenced by WxAttributeSelectionPanel().

122  {
123  long item = -1;
124  for ( ;; )
125  {
126  item = shownAtts->GetNextItem(item,
127  wxLIST_NEXT_ALL,
128  wxLIST_STATE_SELECTED);
129  if ( item == -1 )
130  break;
131 
132  std::string change = crea::wx2std(shownAtts->GetItemText(item));
133  std::vector<std::string>::iterator it;
134  bool found=false;
135  for(it=shownA.begin();it!=shownA.end()&&!found;++it)
136  {
137  if((*it).compare(change)==0)
138  {
139  found=true;
140  }
141  }
142  shownA.erase(it-1);
143  notShownA.push_back(change);
144  }
145  LoadCtrls();
146 
147  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxAttributeSelectionPanel::OnComboChange ( wxCommandEvent &  event)

Definition at line 208 of file creaImageIOWxAttributeSelectionPanel.cpp.

References creaImageIO::WxGimmickView::GetVisibleAttributes(), levels, LoadCtrls(), mView, notShownA, and shownA.

209  {
210  int n=levels->GetSelection()+1;
212  LoadCtrls();
213  }

Here is the call graph for this function:

void creaImageIO::WxAttributeSelectionPanel::OnRemove ( wxCommandEvent &  event)

Changes items from notShown to shown.

Definition at line 149 of file creaImageIOWxAttributeSelectionPanel.cpp.

References LoadCtrls(), notShownA, notShownAtts, and shownA.

Referenced by WxAttributeSelectionPanel().

150  {
151 
152  long item = -1;
153  for ( ;; )
154  {
155  item = notShownAtts->GetNextItem(item,
156  wxLIST_NEXT_ALL,
157  wxLIST_STATE_SELECTED);
158  if ( item == -1 )
159  break;
160 
161  std::string change = crea::wx2std(notShownAtts->GetItemText(item));
162  std::vector<std::string>::iterator it;
163  bool found=false;
164  for(it=notShownA.begin();it!=notShownA.end()&&!found;++it)
165  {
166  if((*it).compare(change)==0)
167  {
168  found=true;
169  }
170  }
171  notShownA.erase(it-1);
172  shownA.push_back(change);
173 
174  }
175  LoadCtrls();
176 
177  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxAttributeSelectionPanel::OnSaveConfig ( wxCommandEvent &  event)

Saves the configuration.

Definition at line 113 of file creaImageIOWxAttributeSelectionPanel.cpp.

References dialog, levels, mView, notShownA, and creaImageIO::WxGimmickView::OnAttributesChanged().

Referenced by WxAttributeSelectionPanel().

114  {
115  int n=levels->GetSelection();
116  if(n<0){n=0;}
118  dialog->Destroy();
119  }

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

wxDialog* creaImageIO::WxAttributeSelectionPanel::dialog
private

Definition at line 74 of file creaImageIOWxAttributeSelectionPanel.h.

Referenced by OnSaveConfig().

wxComboBox* creaImageIO::WxAttributeSelectionPanel::levels
private
WxGimmickView* creaImageIO::WxAttributeSelectionPanel::mView
private

Definition at line 75 of file creaImageIOWxAttributeSelectionPanel.h.

Referenced by OnComboChange(), and OnSaveConfig().

std::vector<std::string> creaImageIO::WxAttributeSelectionPanel::notShownA
private
wxListCtrl* creaImageIO::WxAttributeSelectionPanel::notShownAtts
private
std::vector<std::string> creaImageIO::WxAttributeSelectionPanel::shownA
private

Definition at line 69 of file creaImageIOWxAttributeSelectionPanel.h.

Referenced by LoadCtrls(), OnAdd(), OnComboChange(), and OnRemove().

wxListCtrl* creaImageIO::WxAttributeSelectionPanel::shownAtts
private

The documentation for this class was generated from the following files: