]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/valgen.cpp
use MoreFiles under Mac OS X
[wxWidgets.git] / src / common / valgen.cpp
index 5f687dd7ea5d57ca24b069314bbad412a3ba31ef..ee65e02c47fd54022d5b4d4ddaa30c5ce3c1ea16 100644 (file)
@@ -272,28 +272,30 @@ bool wxGenericValidator::TransferToWindow(void)
             return TRUE;
         }
     } else
             return TRUE;
         }
     } else
+    // array controls
 #if wxUSE_CHECKLISTBOX && !defined(__WIN16__)
 #if wxUSE_CHECKLISTBOX && !defined(__WIN16__)
-  // array controls
-  // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox
-  // MUST come first:
-  if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
-  {
-    wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
-        if (m_pArrayInt)
+    // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first:
+    if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
     {
     {
-      // clear all selections
-      int i;
-      for (i = 0 ; i < pControl->Number(); ++i)
-        pControl->Check(i, FALSE);
-      // select each item in our array
-      unsigned u;
-      for (u = 0; u < m_pArrayInt->Count(); ++u)
-        pControl->Check(m_pArrayInt->Item(u));
-      return TRUE;
-    }
+        wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
+        if (m_pArrayInt)
+        {
+            // clear all selections
+            size_t i,
+                   count = pControl->GetCount();
+            for ( i = 0 ; i < count; i++ )
+                pControl->Check(i, FALSE);
+
+            // select each item in our array
+            count = m_pArrayInt->GetCount();
+            for ( i = 0 ; i < count; i++ )
+                pControl->Check(m_pArrayInt->Item(i));
+
+            return TRUE;
+        }
         else
         else
-                return FALSE;
-  } else
+            return FALSE;
+    } else
 #endif
 #if wxUSE_LISTBOX
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
 #endif
 #if wxUSE_LISTBOX
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
@@ -302,13 +304,16 @@ bool wxGenericValidator::TransferToWindow(void)
         if (m_pArrayInt)
         {
             // clear all selections
         if (m_pArrayInt)
         {
             // clear all selections
-            int i;
-            for (i = 0 ; i < pControl->Number(); ++i)
+            size_t i,
+                   count = pControl->GetCount();
+            for ( i = 0 ; i < count; i++ )
                 pControl->Deselect(i);
                 pControl->Deselect(i);
+
             // select each item in our array
             // select each item in our array
-            unsigned u;
-            for (u = 0; u < m_pArrayInt->Count(); ++u)
-                pControl->SetSelection(m_pArrayInt->Item(u));
+            count = m_pArrayInt->GetCount();
+            for ( i = 0 ; i < count; i++ )
+                pControl->SetSelection(m_pArrayInt->Item(i));
+
             return TRUE;
         }
     } else
             return TRUE;
         }
     } else
@@ -410,7 +415,7 @@ bool wxGenericValidator::TransferFromWindow(void)
     wxSlider* pControl = (wxSlider*) m_validatorWindow;
     if (m_pInt)
     {
     wxSlider* pControl = (wxSlider*) m_validatorWindow;
     if (m_pInt)
     {
-      pControl->SetValue(*m_pInt) ;
+      *m_pInt = pControl->GetValue() ;
       return TRUE;
     }
   } else
       return TRUE;
     }
   } else
@@ -481,27 +486,31 @@ bool wxGenericValidator::TransferFromWindow(void)
         return TRUE;
     }
   } else
         return TRUE;
     }
   } else
+  // array controls
 #if wxUSE_CHECKLISTBOX
 #ifndef __WIN16__
 #if wxUSE_CHECKLISTBOX
 #ifndef __WIN16__
-  // array controls
-  // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox
-  // MUST come first:
+  // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
   if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
   {
     wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
   if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
   {
     wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
-        if (m_pArrayInt)
+    if (m_pArrayInt)
     {
       // clear our array
       m_pArrayInt->Clear();
     {
       // clear our array
       m_pArrayInt->Clear();
+
       // add each selected item to our array
       // add each selected item to our array
-      int i;
-      for (i = 0 ; i < pControl->Number(); ++i)
+      size_t i,
+             count = pControl->GetCount();
+      for ( i = 0; i < count; i++ )
+      {
         if (pControl->IsChecked(i))
           m_pArrayInt->Add(i);
         if (pControl->IsChecked(i))
           m_pArrayInt->Add(i);
+      }
+
       return TRUE;
     }
       return TRUE;
     }
-        else
-          return FALSE;
+    else
+      return FALSE;
   } else
 #endif
 #endif
   } else
 #endif
 #endif
@@ -513,11 +522,16 @@ bool wxGenericValidator::TransferFromWindow(void)
     {
       // clear our array
       m_pArrayInt->Clear();
     {
       // clear our array
       m_pArrayInt->Clear();
+
       // add each selected item to our array
       // add each selected item to our array
-      int i;
-      for (i = 0 ; i < pControl->Number(); ++i)
+      size_t i,
+             count = pControl->GetCount();
+      for ( i = 0; i < count; i++ )
+      {
         if (pControl->Selected(i))
           m_pArrayInt->Add(i);
         if (pControl->Selected(i))
           m_pArrayInt->Add(i);
+      }
+
       return TRUE;
     }
   } else
       return TRUE;
     }
   } else