]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/manager.cpp
move virtual GetPath() implementation out of line to work around an apparent Fedora...
[wxWidgets.git] / src / propgrid / manager.cpp
index 27f4e81ac793ecb65fa2f40314fe8d9caaa48152..096228ac5481a64c1e9fe29d7062bcc79040f45c 100644 (file)
@@ -281,6 +281,8 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
                                     long style,
                                     const wxString& name )
 {
+    if ( !m_pPropGrid )
+        m_pPropGrid = CreatePropertyGrid();
 
     bool res = wxPanel::Create( parent, id, pos, size,
                                 (style&0xFFFF0000)|wxWANTS_CHARS,
@@ -298,8 +300,7 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
 void wxPropertyGridManager::Init1()
 {
 
-    //m_pPropGrid = NULL;
-    m_pPropGrid = CreatePropertyGrid();
+    m_pPropGrid = NULL;
 
 #if wxUSE_TOOLBAR
     m_pToolbar = NULL;
@@ -656,6 +657,8 @@ wxPropertyGridPageState* wxPropertyGridManager::GetPageState( int page ) const
 
 void wxPropertyGridManager::Clear()
 {
+    m_pPropGrid->ClearSelection(false);
+
     m_pPropGrid->Freeze();
 
     int i;
@@ -980,26 +983,24 @@ bool wxPropertyGridManager::ProcessEvent( wxEvent& event )
 
 // -----------------------------------------------------------------------
 
-void wxPropertyGridManager::RepaintSplitter( wxDC& dc, int new_splittery, int new_width,
-                                             int new_height, bool desc_too )
+void wxPropertyGridManager::RepaintDescBoxDecorations( wxDC& dc,
+                                                       int newSplitterY,
+                                                       int newWidth,
+                                                       int newHeight )
 {
-    int use_hei = new_height;
-
     // Draw background
     wxColour bgcol = GetBackgroundColour();
-    dc.SetBrush( bgcol );
-    dc.SetPen( bgcol );
-    int rect_hei = use_hei-new_splittery;
-    if ( !desc_too )
-        rect_hei = m_splitterHeight;
-    dc.DrawRectangle(0,new_splittery,new_width,rect_hei);
-    dc.SetPen ( wxSystemSettings::GetColour ( wxSYS_COLOUR_3DDKSHADOW ) );
-    int splitter_bottom = new_splittery+m_splitterHeight - 1;
-    int box_height = use_hei-splitter_bottom;
-    if ( box_height > 1 )
-        dc.DrawRectangle(0,splitter_bottom,new_width,box_height);
+    dc.SetBrush(bgcol);
+    dc.SetPen(bgcol);
+    int rectHeight = m_splitterHeight;
+    dc.DrawRectangle(0, newSplitterY, newWidth, rectHeight);
+    dc.SetPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW) );
+    int splitterBottom = newSplitterY + m_splitterHeight - 1;
+    int boxHeight = newHeight - splitterBottom;
+    if ( boxHeight > 1 )
+        dc.DrawRectangle(0, splitterBottom, newWidth, boxHeight);
     else
-        dc.DrawLine(0,splitter_bottom,new_width,splitter_bottom);
+        dc.DrawLine(0, splitterBottom, newWidth, splitterBottom);
 }
 
 // -----------------------------------------------------------------------
@@ -1060,24 +1061,7 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
 #if wxUSE_TOOLBAR
     if ( m_pToolbar )
     {
-        int tbHeight;
-
-    #if ( wxMINOR_VERSION < 6 || (wxMINOR_VERSION == 6 && wxRELEASE_NUMBER < 2) )
-        tbHeight = -1;
-    #else
-        // In wxWidgets 2.6.2+, Toolbar default height may be broken
-        #if defined(__WXMSW__)
-            tbHeight = 24;
-        #elif defined(__WXGTK__)
-            tbHeight = -1; // 22;
-        #elif defined(__WXMAC__)
-            tbHeight = 22;
-        #else
-            tbHeight = 22;
-        #endif
-    #endif
-
-        m_pToolbar->SetSize(0,0,width,tbHeight);
+        m_pToolbar->SetSize(0, 0, width, -1);
         propgridY += m_pToolbar->GetSize().y;
     }
 #endif
@@ -1117,6 +1101,8 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
     if ( m_iFlags & wxPG_FL_INITIALIZED )
     {
         int pgh = propgridBottomY - propgridY;
+        if ( pgh < 0 )
+            pgh = 0;
         m_pPropGrid->SetSize( 0, propgridY, width, pgh );
 
         m_extraHeight = height - pgh;
@@ -1157,11 +1143,9 @@ void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) )
     // Update everything inside the box
     wxRect r = GetUpdateRegion().GetBox();
 
-    // Repaint splitter?
-    int r_bottom = r.y + r.height;
-    int splitter_bottom = m_splitterY + m_splitterHeight;
-    if ( r.y < splitter_bottom && r_bottom >= m_splitterY )
-        RepaintSplitter( dc, m_splitterY, m_width, m_height, false );
+    // Repaint splitter and any other description box decorations
+    if ( (r.y + r.height) >= m_splitterY )
+        RepaintDescBoxDecorations( dc, m_splitterY, m_width, m_height );
 }
 
 // -----------------------------------------------------------------------
@@ -1205,6 +1189,7 @@ void wxPropertyGridManager::RecreateControls()
                                        wxDefaultPosition,wxDefaultSize,
                                        ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT)
                                         /*| wxTB_HORIZONTAL | wxNO_BORDER*/ );
+            m_pToolbar->SetToolBitmapSize(wxSize(16, 15));
 
         #if defined(__WXMSW__)
             // Eliminate toolbar flicker on XP
@@ -1496,7 +1481,7 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
     else
     {
         wxClientDC dc(this);
-        dc.SetFont(m_pPropGrid->m_font);
+        dc.SetFont(m_pPropGrid->GetFont());
 
         int highest = 0;
         unsigned int i;