From a721fd82b7ca8c97048453d4aaff559e8f741d69 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Wed, 4 Feb 2009 16:55:28 +0000 Subject: [PATCH] in debug mode when clicking with the middle mouse button draw borders around all windows, not only those with a sizer; use different pen colours to distinguish among sizers, spacers and windows. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58653 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wincmn.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 5b3fb6b853..4dbab48a20 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -2539,11 +2539,12 @@ wxWindowBase::DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y) static void DrawSizers(wxWindowBase *win); -static void DrawBorder(wxWindowBase *win, const wxRect& rect, bool fill = false) +static void DrawBorder(wxWindowBase *win, const wxRect& rect, bool fill, const wxPen* pen) { wxClientDC dc((wxWindow *)win); - dc.SetPen(*wxRED_PEN); - dc.SetBrush(fill ? wxBrush(*wxRED, wxBRUSHSTYLE_CROSSDIAG_HATCH) : *wxTRANSPARENT_BRUSH); + dc.SetPen(*pen); + dc.SetBrush(fill ? wxBrush(pen->GetColour(), wxBRUSHSTYLE_CROSSDIAG_HATCH) : + *wxTRANSPARENT_BRUSH); dc.DrawRectangle(rect.Deflate(1, 1)); } @@ -2558,12 +2559,12 @@ static void DrawSizer(wxWindowBase *win, wxSizer *sizer) wxSizerItem *item = *i; if ( item->IsSizer() ) { - DrawBorder(win, item->GetRect().Deflate(2)); + DrawBorder(win, item->GetRect().Deflate(2), false, wxRED_PEN); DrawSizer(win, item->GetSizer()); } else if ( item->IsSpacer() ) { - DrawBorder(win, item->GetRect().Deflate(2), true); + DrawBorder(win, item->GetRect().Deflate(2), true, wxBLUE_PEN); } else if ( item->IsWindow() ) { @@ -2574,10 +2575,11 @@ static void DrawSizer(wxWindowBase *win, wxSizer *sizer) static void DrawSizers(wxWindowBase *win) { + DrawBorder(win, win->GetClientSize(), false, wxGREEN_PEN); + wxSizer *sizer = win->GetSizer(); if ( sizer ) { - DrawBorder(win, win->GetClientSize()); DrawSizer(win, sizer); } else // no sizer, still recurse into the children