]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1435340 ] Add support of wxToggleButton to wxGenericValidator
authorJulian Smart <julian@anthemion.co.uk>
Sat, 11 Mar 2006 14:28:00 +0000 (14:28 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sat, 11 Mar 2006 14:28:00 +0000 (14:28 +0000)
With precomp header fix

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

src/common/valgen.cpp

index 0b5282829ba7c26036300219965670c544c42a54..505d8321a9fcfd385b70bf8d82b1f0af83d71693 100644 (file)
@@ -40,8 +40,7 @@
   #include "wx/slider.h"
 #endif
 
-
-  #include "wx/spinctrl.h"
+#include "wx/spinctrl.h"
 
 #if wxUSE_SPINBTN
   #include "wx/spinbutt.h"
@@ -49,6 +48,9 @@
 #if wxUSE_CHECKLISTBOX
   #include "wx/checklst.h"
 #endif
+#if wxUSE_TOGGLEBTN
+  #include "wx/tglbtn.h"
+#endif
 
 #include "wx/valgen.h"
 
@@ -125,6 +127,17 @@ bool wxGenericValidator::TransferToWindow(void)
         }
     } else
 #endif
+#if wxUSE_TOGGLEBTN
+    if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
+    {
+        wxToggleButton * pControl = (wxToggleButton *) m_validatorWindow;
+       if (m_pBool)
+       {
+           pControl->SetValue(*m_pBool);
+           return true;
+       }
+    } else
+#endif
 
     // int controls
 #if wxUSE_GAUGE
@@ -277,6 +290,7 @@ bool wxGenericValidator::TransferToWindow(void)
         }
     } else
 #endif
+
     // array controls
 #if wxUSE_CHECKLISTBOX
     // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first:
@@ -358,6 +372,17 @@ bool wxGenericValidator::TransferFromWindow(void)
         }
     } else
 #endif
+#if wxUSE_TOGGLEBTN
+    if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
+    {
+       wxToggleButton *pControl = (wxToggleButton *) m_validatorWindow;
+       if (m_pBool)
+       {
+           *m_pBool = pControl->GetValue() ;
+           return true;
+       }
+    } else
+#endif
 
     // INT CONTROLS ***************************************
 #if wxUSE_GAUGE