]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/propgrid/propgridpagestate.h
Cleanly separate GUI socket-related code from net library.
[wxWidgets.git] / include / wx / propgrid / propgridpagestate.h
index 5e58483f1f3ea3e513c8663c8258c003374dec28..9aa0c11335aa659aafc08c9f652a223d3a819999 100644 (file)
@@ -314,28 +314,16 @@ protected:
 
 /** Base class to derive new viterators.
 */
-class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase
+class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase : public wxObjectRefData
 {
     friend class wxPGVIterator;
 public:
-    wxPGVIteratorBase() { m_refCount = 1; }
+    wxPGVIteratorBase() { }
     virtual void Next() = 0;
-    void IncRef()
-    {
-        m_refCount++;
-    }
-    void DecRef()
-    {
-        m_refCount--;
-        if ( m_refCount <= 0 )
-            delete this;
-    }
 protected:
     virtual ~wxPGVIteratorBase() { }
 
     wxPropertyGridIterator  m_it;
-private:
-    int     m_refCount;
 };
 
 /** @class wxPGVIterator
@@ -487,11 +475,6 @@ public:
         return (unsigned int) m_colWidths.size();
     }
 
-    wxPGProperty* GetSelection() const
-    {
-        return m_selected;
-    }
-
     int GetColumnMinWidth( int column ) const;
 
     int GetColumnWidth( unsigned int column ) const
@@ -512,6 +495,28 @@ public:
         return ((wxPropertyGridPageState*)this)->GetLastItem(flags);
     }
 
+    /**
+        Returns currently selected property.
+    */
+    wxPGProperty* GetSelection() const
+    {
+        if ( m_selection.size() == 0 )
+            return NULL;
+        return m_selection[0];
+    }
+
+    void DoSetSelection( wxPGProperty* prop )
+    {
+        m_selection.clear();
+        if ( prop )
+            m_selection.push_back(prop);
+    }
+
+    bool DoClearSelection()
+    {
+        return DoSelectProperty(NULL);
+    }
+
     wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const;
 
     wxPGProperty* GetPropertyByLabel( const wxString& name,
@@ -602,8 +607,6 @@ public:
 
     bool PrepareAfterItemsAdded();
 
-    void SetSelection( wxPGProperty* p ) { m_selected = p; }
-
     /** Called after virtual height needs to be recalculated.
     */
     void VirtualHeightChanged()
@@ -617,14 +620,11 @@ public:
     /** Returns property by its name. */
     wxPGProperty* BaseGetPropertyByName( const wxString& name ) const;
 
-    void DoClearSelection()
-    {
-        m_selected = NULL;
-    }
-
     /** Called in, for example, wxPropertyGrid::Clear. */
     void DoClear();
 
+    bool DoIsPropertySelected( wxPGProperty* prop ) const;
+
     bool DoCollapse( wxPGProperty* p );
 
     bool DoExpand( wxPGProperty* p );
@@ -671,8 +671,8 @@ protected:
     /** Most recently added category. */
     wxPropertyCategory*         m_currentCategory;
 
-    /** Pointer to selected property. */
-    wxPGProperty*               m_selected;
+    /** Array of selected property. */
+    wxArrayPGProperty           m_selection;
 
     /** Virtual width. */
     int                         m_width;