From 94f0292941b6520afbabc999da698ef5fe576a46 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Sat, 7 Feb 2009 13:35:26 +0000 Subject: [PATCH] Fixed and refactored wxPropertyGridManager decsription text box painting git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/propgrid/manager.h | 9 ++++----- src/propgrid/manager.cpp | 38 ++++++++++++++++------------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index de264eecae..f0addd43ed 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -722,11 +722,10 @@ protected: void UpdateDescriptionBox( int new_splittery, int new_width, int new_height ); - void RepaintSplitter( wxDC& dc, - int new_splittery, - int new_width, - int new_height, - bool desc_too ); + void RepaintDescBoxDecorations( wxDC& dc, + int newSplitterY, + int newWidth, + int newHeight ); void SetDescribedProperty( wxPGProperty* p ); diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index e3487b5c80..d844503d38 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -981,26 +981,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); } // ----------------------------------------------------------------------- @@ -1143,11 +1141,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 ); } // ----------------------------------------------------------------------- -- 2.45.2