]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/manager.cpp
Removed comment
[wxWidgets.git] / src / propgrid / manager.cpp
index 096228ac5481a64c1e9fe29d7062bcc79040f45c..a0b0cd755ee6521c39ec3e931d1c3852c5cc31da 100644 (file)
@@ -289,6 +289,11 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
                                 name );
     Init2(style);
 
+    // FIXME: this changes call ordering so wxPropertyGrid is created
+    // immediately, before SetExtraStyle has a chance to be called. However,
+    // without it, we may get assertions if size is wxDefaultSize.
+    //SetInitialSize(size);
+
     return res;
 }
 
@@ -329,15 +334,9 @@ void wxPropertyGridManager::Init1()
 // -----------------------------------------------------------------------
 
 // These flags are always used in wxPropertyGrid integrated in wxPropertyGridManager.
-#ifndef __WXMAC__
-  #define wxPG_MAN_PROPGRID_FORCED_FLAGS (wxSIMPLE_BORDER| \
+#define wxPG_MAN_PROPGRID_FORCED_FLAGS (  wxBORDER_THEME | \
                                           wxNO_FULL_REPAINT_ON_RESIZE| \
                                           wxCLIP_CHILDREN)
-#else
-  #define wxPG_MAN_PROPGRID_FORCED_FLAGS (wxNO_BORDER| \
-                                          wxNO_FULL_REPAINT_ON_RESIZE| \
-                                          wxCLIP_CHILDREN)
-#endif
 
 // Which flags can be passed to underlying wxPropertyGrid.
 #define wxPG_MAN_PASS_FLAGS_MASK       (0xFFF0|wxTAB_TRAVERSAL)
@@ -380,10 +379,23 @@ void wxPropertyGridManager::Init2( int style )
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
 #endif
 
+   long propGridFlags = (m_windowStyle&wxPG_MAN_PASS_FLAGS_MASK)
+                        |wxPG_MAN_PROPGRID_FORCED_FLAGS;
+
+   propGridFlags &= ~wxBORDER_MASK;
+
+   if ((style & wxPG_NO_INTERNAL_BORDER) == 0)
+   {
+       propGridFlags |= wxBORDER_THEME;
+   }
+   else
+   {
+       propGridFlags |= wxBORDER_NONE;
+       wxWindow::SetExtraStyle(wxPG_EX_TOOLBAR_SEPARATOR);
+   }
+
     // Create propertygrid.
-    m_pPropGrid->Create(this,baseId,wxPoint(0,0),csz,
-                        (m_windowStyle&wxPG_MAN_PASS_FLAGS_MASK)
-                            |wxPG_MAN_PROPGRID_FORCED_FLAGS);
+    m_pPropGrid->Create(this,baseId,wxPoint(0,0),csz, propGridFlags);
 
     m_pPropGrid->m_eventObject = this;
 
@@ -423,8 +435,9 @@ wxPropertyGridManager::~wxPropertyGridManager()
 {
     END_MOUSE_CAPTURE
 
-    m_pPropGrid->DoSelectProperty(NULL);
-    m_pPropGrid->m_pState = NULL;
+    //m_pPropGrid->ClearSelection();
+    delete m_pPropGrid;
+    m_pPropGrid = NULL;
 
     size_t i;
     for ( i=0; i<m_arrPages.size(); i++ )
@@ -528,6 +541,18 @@ void wxPropertyGridManager::SetWindowStyleFlag( long style )
 
 // -----------------------------------------------------------------------
 
+bool wxPropertyGridManager::Reparent( wxWindowBase *newParent )
+{
+    if ( m_pPropGrid )
+        m_pPropGrid->OnTLPChanging((wxWindow*)newParent);
+
+    bool res = wxPanel::Reparent(newParent);
+
+    return res;
+}
+
+// -----------------------------------------------------------------------
+
 // Actually shows given page.
 bool wxPropertyGridManager::DoSelectPage( int index )
 {
@@ -541,7 +566,7 @@ bool wxPropertyGridManager::DoSelectPage( int index )
     if ( m_selPage == index )
         return true;
 
-    if ( m_pPropGrid->m_selected )
+    if ( m_pPropGrid->GetSelection() )
     {
         if ( !m_pPropGrid->ClearSelection() )
             return false;
@@ -713,10 +738,10 @@ void wxPropertyGridManager::SetColumnCount( int colCount, int page )
 
 size_t wxPropertyGridManager::GetPageCount() const
 {
-       if ( !(m_iFlags & wxPG_MAN_FL_PAGE_INSERTED) )
-               return 0;
+    if ( !(m_iFlags & wxPG_MAN_FL_PAGE_INSERTED) )
+        return 0;
 
-       return m_arrPages.size();
+    return m_arrPages.size();
 }
 
 // -----------------------------------------------------------------------
@@ -871,6 +896,19 @@ bool wxPropertyGridManager::IsPageModified( size_t index ) const
 
 // -----------------------------------------------------------------------
 
+bool wxPropertyGridManager::IsPropertySelected( wxPGPropArg id ) const
+{
+    wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
+    for ( unsigned int i=0; i<GetPageCount(); i++ )
+    {
+        if ( GetPageState(i)->DoIsPropertySelected(p) )
+            return true;
+    }
+    return false;
+}
+
+// -----------------------------------------------------------------------
+
 wxPGProperty* wxPropertyGridManager::GetPageRoot( int index ) const
 {
     wxASSERT( index >= 0 );
@@ -1063,6 +1101,9 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
     {
         m_pToolbar->SetSize(0, 0, width, -1);
         propgridY += m_pToolbar->GetSize().y;
+
+        if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
+            propgridY += 1;
     }
 #endif
 
@@ -1143,8 +1184,20 @@ void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) )
     // Update everything inside the box
     wxRect r = GetUpdateRegion().GetBox();
 
+    if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR)
+    {
+        if (m_pToolbar && m_pPropGrid)
+        {
+            wxPen marginPen(m_pPropGrid->GetMarginColour());
+            dc.SetPen(marginPen);
+
+            int y = m_pPropGrid->GetPosition().y-1;
+            dc.DrawLine(0, y, GetClientSize().x, y);
+        }
+    }
+
     // Repaint splitter and any other description box decorations
-    if ( (r.y + r.height) >= m_splitterY )
+    if ( (r.y + r.height) >= m_splitterY && m_splitterY != -1)
         RepaintDescBoxDecorations( dc, m_splitterY, m_width, m_height );
 }
 
@@ -1185,10 +1238,13 @@ void wxPropertyGridManager::RecreateControls()
         // Has toolbar.
         if ( !m_pToolbar )
         {
+            long toolBarFlags = ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT);
+            if (GetExtraStyle() & wxPG_EX_NO_TOOLBAR_DIVIDER)
+                toolBarFlags |= wxTB_NODIVIDER;
+
             m_pToolbar = new wxToolBar(this,baseId+ID_ADVTOOLBAR_OFFSET,
                                        wxDefaultPosition,wxDefaultSize,
-                                       ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT)
-                                        /*| wxTB_HORIZONTAL | wxNO_BORDER*/ );
+                                       toolBarFlags);
             m_pToolbar->SetToolBitmapSize(wxSize(16, 15));
 
         #if defined(__WXMSW__)