]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/manager.cpp
simplify Enable()
[wxWidgets.git] / src / propgrid / manager.cpp
index a0b0cd755ee6521c39ec3e931d1c3852c5cc31da..0c1d5a726a93de6532090a034b44e8dd3c321377 100644 (file)
@@ -76,7 +76,7 @@ const char wxPropertyGridManagerNameStr[] = "wxPropertyGridManager";
 
 
 // Categoric Mode Icon
 
 
 // Categoric Mode Icon
-static const char* gs_xpm_catmode[] = {
+static const char* const gs_xpm_catmode[] = {
 "16 16 5 1",
 ". c none",
 "B c black",
 "16 16 5 1",
 ". c none",
 "B c black",
@@ -102,7 +102,7 @@ static const char* gs_xpm_catmode[] = {
 };
 
 // Alphabetic Mode Icon
 };
 
 // Alphabetic Mode Icon
-static const char* gs_xpm_noncatmode[] = {
+static const char* const gs_xpm_noncatmode[] = {
 "16 16 5 1",
 ". c none",
 "B c black",
 "16 16 5 1",
 ". c none",
 "B c black",
@@ -128,7 +128,7 @@ static const char* gs_xpm_noncatmode[] = {
 };
 
 // Default Page Icon.
 };
 
 // Default Page Icon.
-static const char* gs_xpm_defpage[] = {
+static const char* const gs_xpm_defpage[] = {
 "16 16 5 1",
 ". c none",
 "B c black",
 "16 16 5 1",
 ". c none",
 "B c black",
@@ -815,6 +815,9 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
 
     pageObj->m_id = m_nextTbInd;
 
 
     pageObj->m_id = m_nextTbInd;
 
+    if ( !HasFlag(wxPG_SPLITTER_AUTO_CENTER) )
+        pageObj->m_dontCenterSplitter = true;
+
     if ( isPageInserted )
         m_arrPages.push_back( pageObj );
 
     if ( isPageInserted )
         m_arrPages.push_back( pageObj );
 
@@ -837,7 +840,7 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
                 m_pToolbar->AddTool(m_nextTbInd,label,bmp,label,wxITEM_RADIO);
                 //m_pToolbar->InsertTool(index+3,m_nextTbInd,bmp);
             else
                 m_pToolbar->AddTool(m_nextTbInd,label,bmp,label,wxITEM_RADIO);
                 //m_pToolbar->InsertTool(index+3,m_nextTbInd,bmp);
             else
-                m_pToolbar->AddTool(m_nextTbInd,label,wxBitmap( (const char**)gs_xpm_defpage ),
+                m_pToolbar->AddTool(m_nextTbInd,label,wxBitmap(gs_xpm_defpage),
                     label,wxITEM_RADIO);
 
             m_nextTbInd++;
                     label,wxITEM_RADIO);
 
             m_nextTbInd++;
@@ -1271,10 +1274,10 @@ void wxPropertyGridManager::RecreateControls()
                 wxString desc1(_("Categorized Mode"));
                 wxString desc2(_("Alphabetic Mode"));
                 m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+0,
                 wxString desc1(_("Categorized Mode"));
                 wxString desc2(_("Alphabetic Mode"));
                 m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+0,
-                    desc1,wxBitmap ( (const char**)gs_xpm_catmode ),
+                    desc1,wxBitmap (gs_xpm_catmode),
                     desc1,wxITEM_RADIO);
                 m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+1,
                     desc1,wxITEM_RADIO);
                 m_pToolbar->AddTool(baseId+ID_ADVTBITEMSBASE_OFFSET+1,
-                    desc2,wxBitmap ( (const char**)gs_xpm_noncatmode ),
+                    desc2,wxBitmap (gs_xpm_noncatmode),
                     desc2,wxITEM_RADIO);
                 m_pToolbar->Realize();
             }
                     desc2,wxITEM_RADIO);
                 m_pToolbar->Realize();
             }
@@ -1548,12 +1551,11 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
             maxW += m_pPropGrid->m_marginWidth;
             if ( maxW > highest )
                 highest = maxW;
             maxW += m_pPropGrid->m_marginWidth;
             if ( maxW > highest )
                 highest = maxW;
+            m_pState->m_dontCenterSplitter = true;
         }
 
         if ( highest > 0 )
             m_pPropGrid->SetSplitterPosition( highest );
         }
 
         if ( highest > 0 )
             m_pPropGrid->SetSplitterPosition( highest );
-
-        m_pPropGrid->m_iFlags |= wxPG_FL_DONT_CENTER_SPLITTER;
     }
 }
 
     }
 }
 
@@ -1575,12 +1577,30 @@ void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
 {
     int width, height;
 
 {
     int width, height;
 
-    GetClientSize(&width,&height);
+    GetClientSize(&width, &height);
 
     if ( m_width == -12345 )
         RecreateControls();
 
 
     if ( m_width == -12345 )
         RecreateControls();
 
-    RecalculatePositions(width,height);
+    RecalculatePositions(width, height);
+
+    if ( m_pPropGrid && m_pPropGrid->m_parent )
+    {
+        int pgWidth, pgHeight;
+        m_pPropGrid->GetClientSize(&pgWidth, &pgHeight);
+
+        // Regenerate splitter positions for non-current pages
+        for ( unsigned int i=0; i<GetPageCount(); i++ )
+        {
+            wxPropertyGridPage* page = GetPage(i);
+            if ( page != m_pPropGrid->GetState() )
+            {
+                page->OnClientWidthChange(pgWidth,
+                                          pgWidth - page->m_width,
+                                          true);
+            }
+        }
+    }
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
@@ -1718,9 +1738,8 @@ void wxPropertyGridManager::SetSplitterPosition( int pos, int splitterColumn )
     {
         wxPropertyGridPage* page = GetPage(i);
         page->DoSetSplitterPosition( pos, splitterColumn, false );
     {
         wxPropertyGridPage* page = GetPage(i);
         page->DoSetSplitterPosition( pos, splitterColumn, false );
+        page->m_isSplitterPreSet = true;
     }
     }
-
-    m_pPropGrid->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET);
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------