From b13862ee62355f46a021b4e6d6d6a6bba47f5435 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Sep 2006 11:24:42 +0000 Subject: [PATCH] fix TLW borders width in mono theme git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/univ/stdrend.h | 8 ++++++++ src/univ/stdrend.cpp | 24 ++++++++---------------- src/univ/themes/mono.cpp | 6 ++++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/include/wx/univ/stdrend.h b/include/wx/univ/stdrend.h index 9aad13670f..f46b25792c 100644 --- a/include/wx/univ/stdrend.h +++ b/include/wx/univ/stdrend.h @@ -332,6 +332,14 @@ protected: // return the frame icon bitmap virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type) = 0; + // get the width of either normal or resizeable frame border depending on + // whether flags contains wxTOPLEVEL_RESIZEABLE bit + // + // notice that these methods only make sense with standard border drawing + // code which uses the borders of the same width on all sides, this is why + // they are only present here and not in wxRenderer itself + virtual int GetFrameBorderWidth(int flags) const; + #if wxUSE_TEXTCTRL // return the width of the border around the text area in the text control virtual int GetTextBorderWidth(const wxTextCtrl *text) const; diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index d29a4dc89b..54c3177883 100644 --- a/src/univ/stdrend.cpp +++ b/src/univ/stdrend.cpp @@ -38,8 +38,6 @@ // constants // ---------------------------------------------------------------------------- -static const int FRAME_BORDER_THICKNESS = 3; -static const int RESIZEABLE_FRAME_BORDER_THICKNESS = 4; static const int FRAME_TITLEBAR_HEIGHT = 18; static const int FRAME_BUTTON_WIDTH = 16; static const int FRAME_BUTTON_HEIGHT = 14; @@ -1415,6 +1413,11 @@ void wxStdRenderer::DrawFrameButton(wxDC& dc, dc.DrawBitmap(bmp, rectBmp.CentreIn(rectBtn).GetPosition(), true); } +int wxStdRenderer::GetFrameBorderWidth(int flags) const +{ + return flags & wxTOPLEVEL_RESIZEABLE ? 4 : 3; +} + wxRect wxStdRenderer::GetFrameClientArea(const wxRect& rect, int flags) const { @@ -1422,10 +1425,7 @@ wxRect wxStdRenderer::GetFrameClientArea(const wxRect& rect, int flags) const if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) ) { - int border = flags & wxTOPLEVEL_RESIZEABLE - ? RESIZEABLE_FRAME_BORDER_THICKNESS - : FRAME_BORDER_THICKNESS; - r.Inflate(-border); + r.Inflate(-GetFrameBorderWidth(flags)); } if ( flags & wxTOPLEVEL_TITLEBAR ) @@ -1444,11 +1444,7 @@ wxStdRenderer::GetFrameTotalSize(const wxSize& clientSize, int flags) const if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) ) { - int border = flags & wxTOPLEVEL_RESIZEABLE - ? RESIZEABLE_FRAME_BORDER_THICKNESS - : FRAME_BORDER_THICKNESS; - s.x += 2*border; - s.y += 2*border; + s.IncBy(2*GetFrameBorderWidth(flags)); } if ( flags & wxTOPLEVEL_TITLEBAR ) @@ -1463,11 +1459,7 @@ wxSize wxStdRenderer::GetFrameMinSize(int flags) const if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) ) { - int border = (flags & wxTOPLEVEL_RESIZEABLE) ? - RESIZEABLE_FRAME_BORDER_THICKNESS : - FRAME_BORDER_THICKNESS; - s.x += 2*border; - s.y += 2*border; + s.IncBy(2*GetFrameBorderWidth(flags)); } if ( flags & wxTOPLEVEL_TITLEBAR ) diff --git a/src/univ/themes/mono.cpp b/src/univ/themes/mono.cpp index a4ffd5f06d..b2d51f8ff6 100644 --- a/src/univ/themes/mono.cpp +++ b/src/univ/themes/mono.cpp @@ -232,6 +232,7 @@ protected: { return GetIndicator(IndicatorType_Radio, flags); } virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type); + virtual int GetFrameBorderWidth(int flags) const; private: // the bitmaps returned by GetIndicator() @@ -1030,6 +1031,11 @@ void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, // top level windows // ---------------------------------------------------------------------------- +int wxMonoRenderer::GetFrameBorderWidth(int WXUNUSED(flags)) const +{ + // all our borders are simple + return 1; +} // ---------------------------------------------------------------------------- // wxMonoArtProvider -- 2.45.2