X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..c5fc899bf29ca7d9c4e2a070e28228b430a68dd3:/src/common/valgen.cpp diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index ee65e02c47..b4d296e619 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "valgen.h" #endif @@ -44,18 +44,20 @@ #include "wx/slider.h" #endif -#if wxUSE_SPINCTRL && !defined(__WIN16__) + #include "wx/spinctrl.h" -#endif -#if wxUSE_SPINBTN && !defined(__WIN16__) + +#if wxUSE_SPINBTN #include "wx/spinbutt.h" #endif -#if wxUSE_CHECKLISTBOX && !defined(__WIN16__) +#if wxUSE_CHECKLISTBOX #include "wx/checklst.h" #endif #include "wx/valgen.h" +IMPLEMENT_CLASS(wxGenericValidator, wxValidator) + wxGenericValidator::wxGenericValidator(bool *val) { Initialize(); @@ -81,6 +83,7 @@ wxGenericValidator::wxGenericValidator(wxArrayInt *val) } wxGenericValidator::wxGenericValidator(const wxGenericValidator& val) + : wxValidator() { Copy(val); } @@ -165,7 +168,7 @@ bool wxGenericValidator::TransferToWindow(void) } } else #endif -#if wxUSE_SPINCTRL && !defined(__WIN16__) && !defined(__WXMOTIF__) +#if wxUSE_SPINCTRL && !defined(__WXMOTIF__) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) ) { wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow; @@ -176,7 +179,7 @@ bool wxGenericValidator::TransferToWindow(void) } } else #endif -#if wxUSE_SPINBTN && !defined(__WIN16__) +#if wxUSE_SPINBTN if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) { wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; @@ -200,6 +203,7 @@ bool wxGenericValidator::TransferToWindow(void) #endif // string controls +#if wxUSE_BUTTON if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) { wxButton* pControl = (wxButton*) m_validatorWindow; @@ -209,6 +213,7 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } else +#endif #if wxUSE_COMBOBOX if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) { @@ -224,6 +229,10 @@ bool wxGenericValidator::TransferToWindow(void) { pControl->SetStringSelection(* m_pString); } + else + { + pControl->SetValue(* m_pString); + } return TRUE; } } else @@ -256,6 +265,7 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } else +#if wxUSE_TEXTCTRL if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) { wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; @@ -272,8 +282,9 @@ bool wxGenericValidator::TransferToWindow(void) return TRUE; } } else +#endif // array controls -#if wxUSE_CHECKLISTBOX && !defined(__WIN16__) +#if wxUSE_CHECKLISTBOX // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first: if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) { @@ -387,7 +398,7 @@ bool wxGenericValidator::TransferFromWindow(void) } } else #endif -#if wxUSE_SPINCTRL && !defined(__WIN16__) && !defined(__WXMOTIF__) +#if wxUSE_SPINCTRL && !defined(__WXMOTIF__) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) ) { wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow; @@ -398,7 +409,7 @@ bool wxGenericValidator::TransferFromWindow(void) } } else #endif -#if wxUSE_SPINBTN && !defined(__WIN16__) +#if wxUSE_SPINBTN if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) { wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; @@ -421,6 +432,7 @@ bool wxGenericValidator::TransferFromWindow(void) } else #endif // string controls +#if wxUSE_BUTTON if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) { wxButton* pControl = (wxButton*) m_validatorWindow; @@ -429,8 +441,8 @@ bool wxGenericValidator::TransferFromWindow(void) *m_pString = pControl->GetLabel() ; return TRUE; } - } - else + } else +#endif #if wxUSE_COMBOBOX if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) { @@ -442,7 +454,7 @@ bool wxGenericValidator::TransferFromWindow(void) } else if (m_pString) { - *m_pString = pControl->GetStringSelection(); + *m_pString = pControl->GetValue(); return TRUE; } } else @@ -472,6 +484,7 @@ bool wxGenericValidator::TransferFromWindow(void) return TRUE; } } else +#if wxUSE_TEXTCTRL if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) ) { wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow; @@ -486,9 +499,9 @@ bool wxGenericValidator::TransferFromWindow(void) return TRUE; } } else +#endif // array controls #if wxUSE_CHECKLISTBOX -#ifndef __WIN16__ // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first: if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) ) { @@ -513,7 +526,6 @@ bool wxGenericValidator::TransferFromWindow(void) return FALSE; } else #endif -#endif #if wxUSE_LISTBOX if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) ) {