]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed deprecated functions wxPGChoices::HasValue(), HasValues()
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 21 Oct 2008 15:17:06 +0000 (15:17 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 21 Oct 2008 15:17:06 +0000 (15:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
src/propgrid/advprops.cpp
src/propgrid/propgrid.cpp
src/propgrid/props.cpp

index 90494f078347899a4b98fbf1c4c2c675f964cf53..d47ba6881b5cc2a795d46630a84403b080a9a06b 100644 (file)
@@ -591,8 +591,6 @@ public:
 
     int GetValue() const { return m_value; }
 
 
     int GetValue() const { return m_value; }
 
-    bool HasValue() const { return (m_value != wxPG_INVALID_VALUE); }
-
 protected:
     int m_value;
 };
 protected:
     int m_value;
 };
@@ -672,6 +670,8 @@ private:
     Each entry can have label, value, bitmap, text colour, and background
     colour.
 
     Each entry can have label, value, bitmap, text colour, and background
     colour.
 
+    @remarks If you do not specify value for entry, index is used.
+
     @library{wxpropgrid}
     @category{propgrid}
 */
     @library{wxpropgrid}
     @category{propgrid}
 */
@@ -696,14 +696,30 @@ public:
         }
     }
 
         }
     }
 
-    /** Constructor. */
+    /**
+        Constructor.
+
+        @param labels
+            Labels for choices
+
+        @param values
+            Values for choices. If NULL, indexes are used.
+    */
     wxPGChoices( const wxChar** labels, const long* values = NULL )
     {
         Init();
         Set(labels,values);
     }
 
     wxPGChoices( const wxChar** labels, const long* values = NULL )
     {
         Init();
         Set(labels,values);
     }
 
-    /** Constructor. */
+    /**
+        Constructor.
+
+        @param labels
+            Labels for choices
+
+        @param values
+            Values for choices. If empty, indexes are used.
+    */
     wxPGChoices( const wxArrayString& labels,
                  const wxArrayInt& values = wxArrayInt() )
     {
     wxPGChoices( const wxArrayString& labels,
                  const wxArrayInt& values = wxArrayInt() )
     {
@@ -730,6 +746,12 @@ public:
 
         If did not have own copies, creates them now. If was empty, identical
         to set except that creates copies.
 
         If did not have own copies, creates them now. If was empty, identical
         to set except that creates copies.
+
+        @param labels
+            Labels for added choices.
+
+        @param values
+            Values for added choices. If empty, relevant entry indexes are used.
     */
     void Add( const wxChar** labels, const ValArrItem* values = NULL );
 
     */
     void Add( const wxChar** labels, const ValArrItem* values = NULL );
 
@@ -739,7 +761,15 @@ public:
     /** Version that works with wxArrayString and wxArrayInt. */
     void Add( const wxArrayString& arr, const wxArrayInt& arrint );
 
     /** Version that works with wxArrayString and wxArrayInt. */
     void Add( const wxArrayString& arr, const wxArrayInt& arrint );
 
-    /** Adds single item. */
+    /**
+        Adds a single choice.
+
+        @param label
+            Label for added choice.
+
+        @param value
+            Value for added choice. If unspecified, index is used.
+    */
     wxPGChoiceEntry& Add( const wxString& label,
                           int value = wxPG_INVALID_VALUE );
 
     wxPGChoiceEntry& Add( const wxString& label,
                           int value = wxPG_INVALID_VALUE );
 
@@ -807,14 +837,6 @@ public:
     wxArrayInt GetIndicesForStrings( const wxArrayString& strings,
                                      wxArrayString* unmatched = NULL ) const;
 
     wxArrayInt GetIndicesForStrings( const wxArrayString& strings,
                                      wxArrayString* unmatched = NULL ) const;
 
-    /** Returns true if choices in general are likely to have values
-        (depens on that all entries have values or none has)
-    */
-    bool HasValues() const;
-
-    bool HasValue( unsigned int i ) const
-        { return (i < m_data->GetCount()) && m_data->Item(i)->HasValue(); }
-
     int Index( const wxString& str ) const;
     int Index( int val ) const;
 
     int Index( const wxString& str ) const;
     int Index( int val ) const;
 
index 9defd31b6ba1452e3b75dd914f9f094c4000a99b..60fda14f1b2fb70676da8bbb29841a062b5d927a 100644 (file)
@@ -951,10 +951,7 @@ void wxSystemColourProperty::OnSetValue()
 
         if ( cpv.m_type < wxPG_COLOUR_WEB_BASE )
         {
 
         if ( cpv.m_type < wxPG_COLOUR_WEB_BASE )
         {
-            if ( m_choices.HasValues() )
-                ind = GetIndexForValue(cpv.m_type);
-            else
-                ind = ColToInd(col);
+            ind = GetIndexForValue(cpv.m_type);
         }
         else
         {
         }
         else
         {
@@ -1086,13 +1083,8 @@ bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, int WXU
 {
     int index = number;
     int type = GetValueForIndex(index);
 {
     int index = number;
     int type = GetValueForIndex(index);
-    bool hasValue = m_choices[index].HasValue();
 
 
-    if ( ( hasValue && type == wxPG_COLOUR_CUSTOM ) ||
-         ( !hasValue && (index == (int)GetCustomColourIndex() &&
-                                      !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR))
-         )
-       )
+    if ( type == wxPG_COLOUR_CUSTOM )
     {
         QueryColourFromUser(variant);
     }
     {
         QueryColourFromUser(variant);
     }
@@ -1250,7 +1242,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
             if ( res && GetIndex() >= 0 )
             {
                 val.m_type = GetIndex();
             if ( res && GetIndex() >= 0 )
             {
                 val.m_type = GetIndex();
-                if ( val.m_type >= 0 && val.m_type < m_choices.GetCount() && m_choices[val.m_type].HasValue() )
+                if ( val.m_type >= 0 && val.m_type < m_choices.GetCount() )
                     val.m_type = m_choices[val.m_type].GetValue();
 
                 // Get proper colour for type.
                     val.m_type = m_choices[val.m_type].GetValue();
 
                 // Get proper colour for type.
@@ -1413,11 +1405,6 @@ wxString wxColourProperty::ValueToString( wxVariant& value,
 
 wxColour wxColourProperty::GetColour( int index ) const
 {
 
 wxColour wxColourProperty::GetColour( int index ) const
 {
-    if ( !m_choices.HasValue(index) )
-    {
-        wxASSERT( index < (int)GetItemCount() );
-        return gs_cp_es_normcolour_colours[index];
-    }
     return gs_cp_es_normcolour_colours[m_choices.GetValue(index)];
 }
 
     return gs_cp_es_normcolour_colours[m_choices.GetValue(index)];
 }
 
index a7522f7c1652739632fac724cacb46e83ab45fe5..7ea5b3aa9a10cd71a87a96748c9c0f3b23bde8f0 100644 (file)
@@ -5659,13 +5659,6 @@ wxArrayString wxPGChoices::GetLabels() const
 
 // -----------------------------------------------------------------------
 
 
 // -----------------------------------------------------------------------
 
-bool wxPGChoices::HasValues() const
-{
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
 wxArrayInt wxPGChoices::GetValuesForStrings( const wxArrayString& strings ) const
 {
     wxArrayInt arr;
 wxArrayInt wxPGChoices::GetValuesForStrings( const wxArrayString& strings ) const
 {
     wxArrayInt arr;
index a182229cc9f031ccf2dbec4fecb4d0fb8965b78e..1b61ba15df3a5e84f00bf96cfc23b4cecf264c96 100644 (file)
@@ -1138,12 +1138,9 @@ int wxEnumProperty::GetIndexForValue( int value ) const
     if ( !m_choices.IsOk() )
         return -1;
 
     if ( !m_choices.IsOk() )
         return -1;
 
-    if ( m_choices.HasValues() )
-    {
-        int intVal = m_choices.Index(value);
-        if ( intVal >= 0 )
-            return intVal;
-    }
+    int intVal = m_choices.Index(value);
+    if ( intVal >= 0 )
+        return intVal;
 
     return value;
 }
 
     return value;
 }
@@ -1156,9 +1153,7 @@ const wxString* wxEnumProperty::GetEntry( size_t index, int* pvalue ) const
 {
     if ( m_choices.IsOk() && index < m_choices.GetCount() )
     {
 {
     if ( m_choices.IsOk() && index < m_choices.GetCount() )
     {
-        int value = (int)index;
-        if ( m_choices.HasValue(index) )
-            value = m_choices.GetValue(index);
+        int value = m_choices.GetValue(index);
 
         if ( pvalue )
             *pvalue = value;
 
         if ( pvalue )
             *pvalue = value;
@@ -1264,10 +1259,7 @@ void wxFlagsProperty::Init()
         for ( i=0; i<GetItemCount(); i++ )
         {
             bool child_val;
         for ( i=0; i<GetItemCount(); i++ )
         {
             bool child_val;
-            if ( choices.HasValue(i) )
-                child_val = ( value & choices.GetValue(i) )?true:false;
-            else
-                child_val = ( value & (1<<i) )?true:false;
+            child_val = ( value & choices.GetValue(i) )?true:false;
 
             wxPGProperty* boolProp;
             wxString label = GetLabel(i);
 
             wxPGProperty* boolProp;
             wxString label = GetLabel(i);
@@ -1374,10 +1366,7 @@ void wxFlagsProperty::OnSetValue()
         const wxPGChoices& choices = m_choices;
         for ( i = 0; i < GetItemCount(); i++ )
         {
         const wxPGChoices& choices = m_choices;
         for ( i = 0; i < GetItemCount(); i++ )
         {
-            if ( choices.HasValue(i) )
-                fullFlags |= choices.GetValue(i);
-            else
-                fullFlags |= (1<<i);
+            fullFlags |= choices.GetValue(i);
         }
 
         val &= fullFlags;
         }
 
         val &= fullFlags;
@@ -1403,10 +1392,7 @@ void wxFlagsProperty::OnSetValue()
         {
             int flag;
 
         {
             int flag;
 
-            if ( choices.HasValue(i) )
-                flag = choices.GetValue(i);
-            else
-                flag = (1<<i);
+            flag = choices.GetValue(i);
 
             if ( (newFlags & flag) != (m_oldValue & flag) )
                 Item(i)->SetFlag( wxPG_PROP_MODIFIED );
 
             if ( (newFlags & flag) != (m_oldValue & flag) )
                 Item(i)->SetFlag( wxPG_PROP_MODIFIED );
@@ -1431,10 +1417,7 @@ wxString wxFlagsProperty::ValueToString( wxVariant& value,
     for ( i = 0; i < GetItemCount(); i++ )
     {
         int doAdd;
     for ( i = 0; i < GetItemCount(); i++ )
     {
         int doAdd;
-        if ( choices.HasValue(i) )
-            doAdd = ( flags & choices.GetValue(i) );
-        else
-            doAdd = ( flags & (1<<i) );
+        doAdd = ( flags & choices.GetValue(i) );
 
         if ( doAdd )
         {
 
         if ( doAdd )
         {
@@ -1496,9 +1479,7 @@ long wxFlagsProperty::IdToBit( const wxString& id ) const
     {
         if ( id == GetLabel(i) )
         {
     {
         if ( id == GetLabel(i) )
         {
-            if ( m_choices.HasValue(i) )
-                return m_choices.GetValue(i);
-            return (1<<i);
+            return m_choices.GetValue(i);
         }
     }
     return -1;
         }
     }
     return -1;
@@ -1516,10 +1497,7 @@ void wxFlagsProperty::RefreshChildren()
     {
         long flag;
 
     {
         long flag;
 
-        if ( choices.HasValue(i) )
-            flag = choices.GetValue(i);
-        else
-            flag = (1<<i);
+        flag = choices.GetValue(i);
 
         long subVal = flags & flag;
         wxPGProperty* p = Item(i);
 
         long subVal = flags & flag;
         wxPGProperty* p = Item(i);
@@ -1537,8 +1515,7 @@ void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVari
 {
     long oldValue = thisValue.GetLong();
     long val = childValue.GetLong();
 {
     long oldValue = thisValue.GetLong();
     long val = childValue.GetLong();
-    unsigned long vi = (1<<childIndex);
-    if ( m_choices.HasValue(childIndex) ) vi = m_choices.GetValue(childIndex);
+    unsigned long vi = m_choices.GetValue(childIndex);
     if ( val )
         thisValue = (long)(oldValue | vi);
     else
     if ( val )
         thisValue = (long)(oldValue | vi);
     else