+
+// ----------------------------------------------------------------------------
+// MyComboBoxValidator
+// ----------------------------------------------------------------------------
+
+bool MyComboBoxValidator::Validate(wxWindow *WXUNUSED(parent))
+{
+ wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxComboBox)));
+
+ wxComboBox* cb = (wxComboBox*)GetWindow();
+ if (cb->GetValue() == g_combobox_choices[1] ||
+ cb->GetValue() == g_combobox_choices[2])
+ {
+ // we accept any string != g_combobox_choices[1|2] !
+
+ wxLogError("Invalid combo box text!");
+ return false;
+ }
+
+ if (m_var)
+ *m_var = cb->GetValue();
+
+ return true;
+}
+
+bool MyComboBoxValidator::TransferToWindow()
+{
+ wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxComboBox)));
+
+ if ( m_var )
+ {
+ wxComboBox* cb = (wxComboBox*)GetWindow();
+ if ( !cb )
+ return false;
+
+ cb->SetValue(*m_var);
+ }
+
+ return true;
+}
+
+bool MyComboBoxValidator::TransferFromWindow()
+{
+ wxASSERT(GetWindow()->IsKindOf(CLASSINFO(wxComboBox)));
+
+ if ( m_var )
+ {
+ wxComboBox* cb = (wxComboBox*)GetWindow();
+ if ( !cb )
+ return false;
+
+ *m_var = cb->GetValue();
+ }
+
+ return true;
+}
+