]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected some combobox-related code, changed ordering and added wxSpinCtrl
authorJulian Smart <julian@anthemion.co.uk>
Fri, 21 Jul 2000 15:43:14 +0000 (15:43 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 21 Jul 2000 15:43:14 +0000 (15:43 +0000)
support as per bug report

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/valgen.cpp

index ac9989bb615dfb8f15c07dc50ff1b4054e93fc74..2157d57e64888216c5cdb84f94d2e96b2985473e 100644 (file)
   #include "wx/slider.h"
 #endif
 
-#ifndef __WIN16__
+#if wxUSE_SPINCTRL && !defined(__WIN16__)
+  #include "wx/spinctrl.h"
+#endif
+#if wxUSE_SPINBTN && !defined(__WIN16__)
   #include "wx/spinbutt.h"
-#if wxUSE_CHECKLISTBOX
-  #include "wx/checklst.h"
 #endif
+#if wxUSE_CHECKLISTBOX && !defined(__WIN16__)
+  #include "wx/checklst.h"
 #endif
 
 #include "wx/valgen.h"
@@ -162,8 +165,18 @@ bool wxGenericValidator::TransferToWindow(void)
        }
     } else
 #endif
-#if wxUSE_SPINBTN
-#ifndef __WIN16__
+#if wxUSE_SPINCTRL && !defined(__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)) )
     {
         wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
@@ -174,7 +187,6 @@ bool wxGenericValidator::TransferToWindow(void)
        }
     } else
 #endif
-#endif
 #if wxUSE_SLIDER
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
     {
@@ -188,7 +200,6 @@ bool wxGenericValidator::TransferToWindow(void)
 #endif
 
   // string controls
-#if 1
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
     {
         wxButton* pControl = (wxButton*) m_validatorWindow;
@@ -198,22 +209,10 @@ bool wxGenericValidator::TransferToWindow(void)
            return TRUE;
        }
     } else
-#endif
 #if wxUSE_COMBOBOX
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
     {
         wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
-       if (m_pString)
-       {
-           pControl->SetValue(*m_pString) ;
-           return TRUE;
-       }
-    } else
-#endif
-#if wxUSE_CHOICE
-    if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
-    {
-        wxChoice* pControl = (wxChoice*) m_validatorWindow;
         if (m_pInt)
         {
             pControl->SetSelection(*m_pInt) ;
@@ -229,9 +228,10 @@ bool wxGenericValidator::TransferToWindow(void)
         }
     } else
 #endif
-    if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
+#if wxUSE_CHOICE
+    if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
     {
-        wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
+        wxChoice* pControl = (wxChoice*) m_validatorWindow;
         if (m_pInt)
         {
             pControl->SetSelection(*m_pInt) ;
@@ -246,6 +246,7 @@ bool wxGenericValidator::TransferToWindow(void)
             return TRUE;
         }
     } else
+#endif
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
     {
         wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@@ -383,8 +384,18 @@ bool wxGenericValidator::TransferFromWindow(void)
     }
   } else
 #endif
-#if wxUSE_SPINBTN
-#ifndef __WIN16__
+#if wxUSE_SPINCTRL && !defined(__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)) )
   {
     wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
@@ -395,7 +406,6 @@ bool wxGenericValidator::TransferFromWindow(void)
     }
   } else
 #endif
-#endif
 #if wxUSE_SLIDER
   if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
   {
@@ -450,20 +460,6 @@ bool wxGenericValidator::TransferFromWindow(void)
     }
   } else
 #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)) )
   {
     wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@@ -536,6 +532,7 @@ bool wxGenericValidator::TransferFromWindow(void)
 
 /*
   Called by constructors to initialize ALL data members
+       Last change:  JAC  21 Jul 100    5:00 pm
 */
 void wxGenericValidator::Initialize()
 {