KiCad PCB EDA Suite
CONFIG_SAVE_RESTORE_WINDOW Class Reference

#include <dialog_create_array.h>

Inheritance diagram for CONFIG_SAVE_RESTORE_WINDOW:
DIALOG_CREATE_ARRAY

Classes

struct  CONFIG_CTRL_T
 

Protected Member Functions

 CONFIG_SAVE_RESTORE_WINDOW (bool &validFlag)
 
void Add (wxRadioBox *ctrl, int &dest)
 
void Add (wxCheckBox *ctrl, bool &dest)
 
void Add (wxTextCtrl *ctrl, wxString &dest)
 
void Add (UNIT_BINDER &ctrl, int &dest)
 
void Add (wxChoice *ctrl, int &dest)
 
void Add (wxNotebook *ctrl, int &dest)
 
void ReadConfigFromControls ()
 
void RestoreConfigToControls ()
 

Private Types

enum  CONFIG_CTRL_TYPE_T {
  CFG_CTRL_TEXT, CFG_CTRL_UNIT_BINDER, CFG_CTRL_CHECKBOX, CFG_CTRL_RADIOBOX,
  CFG_CTRL_CHOICE, CFG_CTRL_TAB
}
 

Private Attributes

std::vector< CONFIG_CTRL_Tctrls
 
bool & valid
 

Detailed Description

Definition at line 37 of file dialog_create_array.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CONFIG_SAVE_RESTORE_WINDOW::CONFIG_SAVE_RESTORE_WINDOW ( bool &  validFlag)
inlineprotected

Definition at line 62 of file dialog_create_array.h.

62  :
63  valid( validFlag )
64  {}

Member Function Documentation

void CONFIG_SAVE_RESTORE_WINDOW::Add ( wxRadioBox *  ctrl,
int &  dest 
)
inlineprotected

Definition at line 66 of file dialog_create_array.h.

References CFG_CTRL_RADIOBOX.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY().

67  {
68  CONFIG_CTRL_T ctrlInfo = { ctrl, CFG_CTRL_RADIOBOX, (void*) &dest };
69 
70  ctrls.push_back( ctrlInfo );
71  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::Add ( wxCheckBox *  ctrl,
bool &  dest 
)
inlineprotected

Definition at line 73 of file dialog_create_array.h.

References CFG_CTRL_CHECKBOX.

74  {
75  CONFIG_CTRL_T ctrlInfo = { ctrl, CFG_CTRL_CHECKBOX, (void*) &dest };
76 
77  ctrls.push_back( ctrlInfo );
78  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::Add ( wxTextCtrl *  ctrl,
wxString &  dest 
)
inlineprotected

Definition at line 80 of file dialog_create_array.h.

References CFG_CTRL_TEXT.

81  {
82  CONFIG_CTRL_T ctrlInfo = { ctrl, CFG_CTRL_TEXT, (void*) &dest };
83 
84  ctrls.push_back( ctrlInfo );
85  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::Add ( UNIT_BINDER ctrl,
int &  dest 
)
inlineprotected

Definition at line 87 of file dialog_create_array.h.

References CFG_CTRL_UNIT_BINDER.

88  {
89  CONFIG_CTRL_T ctrlInfo = { &ctrl, CFG_CTRL_UNIT_BINDER, (void*) &dest };
90 
91  ctrls.push_back( ctrlInfo );
92  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::Add ( wxChoice *  ctrl,
int &  dest 
)
inlineprotected

Definition at line 95 of file dialog_create_array.h.

References CFG_CTRL_CHOICE.

96  {
97  CONFIG_CTRL_T ctrlInfo = { ctrl, CFG_CTRL_CHOICE, (void*) &dest };
98 
99  ctrls.push_back( ctrlInfo );
100  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::Add ( wxNotebook *  ctrl,
int &  dest 
)
inlineprotected

Definition at line 102 of file dialog_create_array.h.

References CFG_CTRL_TAB.

103  {
104  CONFIG_CTRL_T ctrlInfo = { ctrl, CFG_CTRL_TAB, (void*) &dest };
105 
106  ctrls.push_back( ctrlInfo );
107  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::ReadConfigFromControls ( )
inlineprotected

Definition at line 109 of file dialog_create_array.h.

References CFG_CTRL_CHECKBOX, CFG_CTRL_CHOICE, CFG_CTRL_RADIOBOX, CFG_CTRL_TAB, CFG_CTRL_TEXT, and CFG_CTRL_UNIT_BINDER.

Referenced by DIALOG_CREATE_ARRAY::TransferDataFromWindow().

110  {
111  for( std::vector<CONFIG_CTRL_T>::const_iterator iter = ctrls.begin(), iend = ctrls.end();
112  iter != iend; ++iter )
113  {
114  switch( iter->type )
115  {
116  case CFG_CTRL_CHECKBOX:
117  *(bool*) iter->dest = static_cast<wxCheckBox*>( iter->control )->GetValue();
118  break;
119 
120  case CFG_CTRL_TEXT:
121  *(wxString*) iter->dest = static_cast<wxTextCtrl*>( iter->control )->GetValue();
122  break;
123 
125  *(int*) iter->dest = static_cast<UNIT_BINDER*>( iter->control )->GetValue();
126  break;
127 
128  case CFG_CTRL_CHOICE:
129  *(int*) iter->dest = static_cast<wxChoice*>( iter->control )->GetSelection();
130  break;
131 
132  case CFG_CTRL_RADIOBOX:
133  *(int*) iter->dest = static_cast<wxRadioBox*>( iter->control )->GetSelection();
134  break;
135 
136  case CFG_CTRL_TAB:
137  *(int*) iter->dest = static_cast<wxNotebook*>( iter->control )->GetSelection();
138  break;
139 
140  default:
141  wxASSERT_MSG( false, wxString(
142  "Unhandled control type for config store: " ) << iter->type );
143  }
144  }
145 
146  valid = true;
147  }
std::vector< CONFIG_CTRL_T > ctrls
void CONFIG_SAVE_RESTORE_WINDOW::RestoreConfigToControls ( )
inlineprotected

Definition at line 149 of file dialog_create_array.h.

References CFG_CTRL_CHECKBOX, CFG_CTRL_CHOICE, CFG_CTRL_RADIOBOX, CFG_CTRL_TAB, CFG_CTRL_TEXT, and CFG_CTRL_UNIT_BINDER.

Referenced by DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY().

150  {
151  if( !valid )
152  return;
153 
154  for( std::vector<CONFIG_CTRL_T>::const_iterator iter = ctrls.begin(), iend = ctrls.end();
155  iter != iend; ++iter )
156  {
157  switch( iter->type )
158  {
159  case CFG_CTRL_CHECKBOX:
160  static_cast<wxCheckBox*>( iter->control )->SetValue( *(bool*) iter->dest );
161  break;
162 
163  case CFG_CTRL_TEXT:
164  static_cast<wxTextCtrl*>( iter->control )->SetValue( *(wxString*) iter->dest );
165  break;
166 
168  static_cast<UNIT_BINDER*>( iter->control )->SetValue( *(int*) iter->dest );
169  break;
170 
171  case CFG_CTRL_CHOICE:
172  static_cast<wxChoice*>( iter->control )->SetSelection( *(int*) iter->dest );
173  break;
174 
175  case CFG_CTRL_RADIOBOX:
176  static_cast<wxRadioBox*>( iter->control )->SetSelection( *(int*) iter->dest );
177  break;
178 
179  case CFG_CTRL_TAB:
180  static_cast<wxNotebook*>( iter->control )->SetSelection( *(int*) iter->dest );
181  break;
182 
183  default:
184  wxASSERT_MSG( false, wxString(
185  "Unhandled control type for config restore: " ) << iter->type );
186  }
187  }
188  }
std::vector< CONFIG_CTRL_T > ctrls

Member Data Documentation

std::vector<CONFIG_CTRL_T> CONFIG_SAVE_RESTORE_WINDOW::ctrls
private

Definition at line 58 of file dialog_create_array.h.

bool& CONFIG_SAVE_RESTORE_WINDOW::valid
private

Definition at line 59 of file dialog_create_array.h.


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