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
This commit is contained in:
Francesco Montorsi
2009-02-04 16:55:28 +00:00
parent 939dafa6d4
commit a721fd82b7

View File

@@ -2539,11 +2539,12 @@ wxWindowBase::DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y)
static void DrawSizers(wxWindowBase *win); 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); wxClientDC dc((wxWindow *)win);
dc.SetPen(*wxRED_PEN); dc.SetPen(*pen);
dc.SetBrush(fill ? wxBrush(*wxRED, wxBRUSHSTYLE_CROSSDIAG_HATCH) : *wxTRANSPARENT_BRUSH); dc.SetBrush(fill ? wxBrush(pen->GetColour(), wxBRUSHSTYLE_CROSSDIAG_HATCH) :
*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect.Deflate(1, 1)); dc.DrawRectangle(rect.Deflate(1, 1));
} }
@@ -2558,12 +2559,12 @@ static void DrawSizer(wxWindowBase *win, wxSizer *sizer)
wxSizerItem *item = *i; wxSizerItem *item = *i;
if ( item->IsSizer() ) if ( item->IsSizer() )
{ {
DrawBorder(win, item->GetRect().Deflate(2)); DrawBorder(win, item->GetRect().Deflate(2), false, wxRED_PEN);
DrawSizer(win, item->GetSizer()); DrawSizer(win, item->GetSizer());
} }
else if ( item->IsSpacer() ) else if ( item->IsSpacer() )
{ {
DrawBorder(win, item->GetRect().Deflate(2), true); DrawBorder(win, item->GetRect().Deflate(2), true, wxBLUE_PEN);
} }
else if ( item->IsWindow() ) else if ( item->IsWindow() )
{ {
@@ -2574,10 +2575,11 @@ static void DrawSizer(wxWindowBase *win, wxSizer *sizer)
static void DrawSizers(wxWindowBase *win) static void DrawSizers(wxWindowBase *win)
{ {
DrawBorder(win, win->GetClientSize(), false, wxGREEN_PEN);
wxSizer *sizer = win->GetSizer(); wxSizer *sizer = win->GetSizer();
if ( sizer ) if ( sizer )
{ {
DrawBorder(win, win->GetClientSize());
DrawSizer(win, sizer); DrawSizer(win, sizer);
} }
else // no sizer, still recurse into the children else // no sizer, still recurse into the children