]> git.saurik.com Git - wxWidgets.git/commitdiff
Linup API of wxRadioBox::Show on all ports. Move wxRadioBox::IsValid from wxUniversal...
authorWłodzimierz Skiba <abx@abx.art.pl>
Wed, 23 Feb 2005 17:04:16 +0000 (17:04 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Wed, 23 Feb 2005 17:04:16 +0000 (17:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/radiobox.h
include/wx/mac/classic/radiobox.h
src/mac/carbon/radiobox.cpp
src/mac/classic/radiobox.cpp

index 663b8126c0b13840d486cec27211fb6d509ba9e2..2147e1c931bfd41898d7f51e1527475759f4aaa4 100644 (file)
@@ -68,7 +68,7 @@ public:
     virtual void SetString(int item, const wxString& label) ;
 
     virtual bool Enable(int item, bool enable = true);
-    virtual void Show(int item, bool show) ;
+    virtual bool Show(int item, bool show = true);
 
     virtual int GetColumnCount() const ;
     virtual int GetRowCount() const ;
index dc6d92ccb830dcaa4829cf2b6e86f461005888ea..7a60c2ec9a2ca3d7e72656e83d0429376febcef0 100644 (file)
@@ -68,7 +68,7 @@ public:
     virtual void SetString(int item, const wxString& label) ;
 
     virtual bool Enable(int item, bool enable = true);
-    virtual void Show(int item, bool show) ;
+    virtual bool Show(int item, bool show = true);
 
     virtual int GetColumnCount() const ;
     virtual int GetRowCount() const ;
index 9df4bb6cb4d419bcddbf461f07baa01eb0598029..07210463af8ebfb808090a9c3f8bae1dccf659e3 100644 (file)
@@ -37,7 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 //-------------------------------------------------------------------------------------
 // Default constructor
 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
-EVT_RADIOBUTTON( -1 , wxRadioBox::OnRadioButton )
+EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton )
 END_EVENT_TABLE()
 
 void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
@@ -199,7 +199,7 @@ bool wxRadioBox::Enable(int item, bool enable)
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return false;
 
     i = 0;
@@ -231,7 +231,7 @@ wxString wxRadioBox::GetString(int item) const
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return wxEmptyString;
 
     i = 0;
@@ -291,7 +291,7 @@ void wxRadioBox::SetString(int item,const wxString& label)
        int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return;
     i=0;
     current=m_radioButtonCycle;
@@ -313,7 +313,7 @@ void wxRadioBox::SetSelection(int item)
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return;
     i=0;
     current=m_radioButtonCycle;
@@ -338,7 +338,8 @@ bool wxRadioBox::Show(bool show)
     wxControl::Show(show);
 
     current=m_radioButtonCycle;
-       for (i=0;i<m_noItems;i++) {
+    for (i=0;i<m_noItems;i++)
+    {
         current->Show(show);
         current=current->NextInCycle();
     }
@@ -350,20 +351,20 @@ bool wxRadioBox::Show(bool show)
 //-------------------------------------------------------------------------------------
 // Shows or hides the given button
 
-void wxRadioBox::Show(int item, bool show)
+bool wxRadioBox::Show(int item, bool show)
 {
-       int i;
+    int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
-        return;
+    if (!IsValid(item))
+        return false;
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
         i++;
         current=current->NextInCycle();
     }
-    current->Show(show);
+    return current->Show(show);
 }
 
 //-------------------------------------------------------------------------------------
@@ -419,9 +420,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     x_offset = x;
     y_offset = y;
     GetPosition(&x_current, &y_current);
-    if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if ((x == wxDefaultCoord) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         x_offset = x_current;
-    if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if ((y == wxDefaultCoord)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         y_offset = y_current;
 
     // define size
@@ -444,7 +445,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         eachHeight[i] = (int)((3*eachHeight[i])/2);
         if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
         if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
-          }
+    }
 
     totHeight = GetRowCount() * ( maxHeight ) ;
     totWidth  = GetColumnCount() * (maxWidth + charWidth) ;
@@ -452,7 +453,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth , totHeight ) ) ;
 
     // only change our width/height if asked for
-    if ( width == -1 )
+    if ( width == wxDefaultCoord )
     {
         if ( sizeFlags & wxSIZE_AUTO_WIDTH )
             width = sz.x ;
@@ -460,7 +461,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             width = widthOld;
     }
 
-    if ( height == -1 )
+    if ( height == wxDefaultCoord )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
             height = sz.y ;
index 9fe0e52e8f9ce657fa1a52de62927561c5d681ae..134c08c10cc4153e82c43ef1d98d3b83b9a7d5ce 100644 (file)
@@ -34,7 +34,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 //-------------------------------------------------------------------------------------
 // Default constructor
 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
-EVT_RADIOBUTTON( -1 , wxRadioBox::OnRadioButton )
+EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton )
 END_EVENT_TABLE()
 
 void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
@@ -188,7 +188,7 @@ bool wxRadioBox::Enable(int item, bool enable)
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return false;
 
     i = 0;
@@ -220,7 +220,7 @@ wxString wxRadioBox::GetString(int item) const
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return wxEmptyString;
 
     i = 0;
@@ -277,10 +277,10 @@ void wxRadioBox::SetLabel(const wxString& label)
 
 void wxRadioBox::SetString(int item,const wxString& label)
 {
-       int i;
+    int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return;
     i=0;
     current=m_radioButtonCycle;
@@ -302,7 +302,7 @@ void wxRadioBox::SetSelection(int item)
     int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
+    if (!IsValid(item))
         return;
     i=0;
     current=m_radioButtonCycle;
@@ -327,7 +327,8 @@ bool wxRadioBox::Show(bool show)
     wxControl::Show(show);
 
     current=m_radioButtonCycle;
-       for (i=0;i<m_noItems;i++) {
+    for (i=0;i<m_noItems;i++)
+    {
         current->Show(show);
         current=current->NextInCycle();
     }
@@ -339,20 +340,20 @@ bool wxRadioBox::Show(bool show)
 //-------------------------------------------------------------------------------------
 // Shows or hides the given button
 
-void wxRadioBox::Show(int item, bool show)
+bool wxRadioBox::Show(int item, bool show)
 {
-       int i;
+    int i;
     wxRadioButton *current;
 
-    if ((item < 0) || (item >= m_noItems))
-        return;
+    if (!IsValid(item))
+        return false;
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
         i++;
         current=current->NextInCycle();
     }
-    current->Show(show);
+    return current->Show(show);
 }
 
 //-------------------------------------------------------------------------------------
@@ -408,9 +409,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     x_offset = x;
     y_offset = y;
     GetPosition(&x_current, &y_current);
-    if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if ((x == wxDefaultCoord) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         x_offset = x_current;
-    if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if ((y == wxDefaultCoord)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         y_offset = y_current;
 
     // define size
@@ -439,7 +440,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
 
     // only change our width/height if asked for
-    if ( width == -1 )
+    if ( width == wxDefaultCoord )
     {
         if ( sizeFlags & wxSIZE_AUTO_WIDTH )
             width = totWidth ;
@@ -447,7 +448,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             width = widthOld;
     }
 
-    if ( height == -1 )
+    if ( height == wxDefaultCoord )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
             height = totHeight ;