Corrected some combobox-related code, changed ordering and added wxSpinCtrl

support as per bug report


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2000-07-21 15:43:14 +00:00
parent 264de0cc03
commit a55e0ebc56

View File

@ -44,11 +44,14 @@
#include "wx/slider.h" #include "wx/slider.h"
#endif #endif
#ifndef __WIN16__ #if wxUSE_SPINCTRL && !defined(__WIN16__)
#include "wx/spinbutt.h" #include "wx/spinctrl.h"
#if wxUSE_CHECKLISTBOX
#include "wx/checklst.h"
#endif #endif
#if wxUSE_SPINBTN && !defined(__WIN16__)
#include "wx/spinbutt.h"
#endif
#if wxUSE_CHECKLISTBOX && !defined(__WIN16__)
#include "wx/checklst.h"
#endif #endif
#include "wx/valgen.h" #include "wx/valgen.h"
@ -162,8 +165,18 @@ bool wxGenericValidator::TransferToWindow(void)
} }
} else } else
#endif #endif
#if wxUSE_SPINBTN #if wxUSE_SPINCTRL && !defined(__WIN16__)
#ifndef __WIN16__ if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
{
wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
if (m_pInt)
{
pControl->SetValue(*m_pInt);
return TRUE;
}
} else
#endif
#if wxUSE_SPINBTN && !defined(__WIN16__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
{ {
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
@ -174,7 +187,6 @@ bool wxGenericValidator::TransferToWindow(void)
} }
} else } else
#endif #endif
#endif
#if wxUSE_SLIDER #if wxUSE_SLIDER
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
{ {
@ -188,7 +200,6 @@ bool wxGenericValidator::TransferToWindow(void)
#endif #endif
// string controls // string controls
#if 1
if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
{ {
wxButton* pControl = (wxButton*) m_validatorWindow; wxButton* pControl = (wxButton*) m_validatorWindow;
@ -198,16 +209,23 @@ bool wxGenericValidator::TransferToWindow(void)
return TRUE; return TRUE;
} }
} else } else
#endif
#if wxUSE_COMBOBOX #if wxUSE_COMBOBOX
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{ {
wxComboBox* pControl = (wxComboBox*) m_validatorWindow; wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pString) if (m_pInt)
{ {
pControl->SetValue(*m_pString) ; pControl->SetSelection(*m_pInt) ;
return TRUE; return TRUE;
} }
else if (m_pString)
{
if (pControl->FindString(* m_pString) > -1)
{
pControl->SetStringSelection(* m_pString);
}
return TRUE;
}
} else } else
#endif #endif
#if wxUSE_CHOICE #if wxUSE_CHOICE
@ -229,23 +247,6 @@ bool wxGenericValidator::TransferToWindow(void)
} }
} else } else
#endif #endif
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
{
pControl->SetSelection(*m_pInt) ;
return TRUE;
}
else if (m_pString)
{
if (pControl->FindString(* m_pString) > -1)
{
pControl->SetStringSelection(* m_pString);
}
return TRUE;
}
} else
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
{ {
wxStaticText* pControl = (wxStaticText*) m_validatorWindow; wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@ -383,8 +384,18 @@ bool wxGenericValidator::TransferFromWindow(void)
} }
} else } else
#endif #endif
#if wxUSE_SPINBTN #if wxUSE_SPINCTRL && !defined(__WIN16__)
#ifndef __WIN16__ if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
{
wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
if (m_pInt)
{
*m_pInt=pControl->GetValue();
return TRUE;
}
} else
#endif
#if wxUSE_SPINBTN && !defined(__WIN16__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
{ {
wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow; wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
@ -395,7 +406,6 @@ bool wxGenericValidator::TransferFromWindow(void)
} }
} else } else
#endif #endif
#endif
#if wxUSE_SLIDER #if wxUSE_SLIDER
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
{ {
@ -450,20 +460,6 @@ bool wxGenericValidator::TransferFromWindow(void)
} }
} else } else
#endif #endif
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
{
*m_pInt = pControl->GetSelection() ;
return TRUE;
}
else if (m_pString)
{
*m_pString = pControl->GetStringSelection();
return TRUE;
}
} else
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
{ {
wxStaticText* pControl = (wxStaticText*) m_validatorWindow; wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@ -536,6 +532,7 @@ bool wxGenericValidator::TransferFromWindow(void)
/* /*
Called by constructors to initialize ALL data members Called by constructors to initialize ALL data members
Last change: JAC 21 Jul 100 5:00 pm
*/ */
void wxGenericValidator::Initialize() void wxGenericValidator::Initialize()
{ {