X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/249803fbcd1f73040e4b5457e341d8db2e5cb66e..44d0f703f9cba47009e33cd248f78bef941ba99b:/src/univ/themes/mono.cpp?ds=sidebyside diff --git a/src/univ/themes/mono.cpp b/src/univ/themes/mono.cpp index 9f77284de3..93cf4b94f8 100644 --- a/src/univ/themes/mono.cpp +++ b/src/univ/themes/mono.cpp @@ -24,14 +24,19 @@ #pragma hdrstop #endif +#include "wx/univ/theme.h" + +#if wxUSE_THEME_MONO + #ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/dc.h" #endif // WX_PRECOMP #include "wx/artprov.h" #include "wx/univ/stdrend.h" #include "wx/univ/inphand.h" #include "wx/univ/colschem.h" -#include "wx/univ/theme.h" class wxMonoColourScheme; @@ -58,11 +63,7 @@ public: int indexAccel = -1, wxRect *rectBounds = NULL); - virtual void DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rect, - int flags = 0, - wxRect *rectIn = NULL); + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, @@ -155,38 +156,6 @@ public: const wxMenuGeometryInfo& geomInfo); #endif // wxUSE_MENUS - virtual void DrawFrameTitleBar(wxDC& dc, - const wxRect& rect, - const wxString& title, - const wxIcon& icon, - int flags, - int specialButton = 0, - int specialButtonFlags = 0); - - virtual void DrawFrameBorder(wxDC& dc, - const wxRect& rect, - int flags); - - virtual void DrawFrameBackground(wxDC& dc, - const wxRect& rect, - int flags); - - virtual void DrawFrameTitle(wxDC& dc, - const wxRect& rect, - const wxString& title, - int flags); - - virtual void DrawFrameIcon(wxDC& dc, - const wxRect& rect, - const wxIcon& icon, - int flags); - - virtual void DrawFrameButton(wxDC& dc, - wxCoord x, wxCoord y, - int button, - int flags = 0); - - #if wxUSE_COMBOBOX virtual void GetComboBitmaps(wxBitmap *bmpNormal, wxBitmap *bmpFocus, @@ -240,17 +209,11 @@ public: const wxMenu& menu) const; #endif // wxUSE_MENUS - virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const; - - virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const; +#if wxUSE_STATUSBAR + virtual wxCoord GetStatusBarBorderBetweenFields() const; - virtual wxSize GetFrameMinSize(int flags) const; - - virtual wxSize GetFrameIconSize() const; - - virtual int HitTestFrame(const wxRect& rect, - const wxPoint& pt, - int flags = 0) const; + virtual wxSize GetStatusBarFieldMargins() const; +#endif // wxUSE_STATUSBAR protected: // override base class border drawing routines: we always draw just a @@ -264,8 +227,12 @@ protected: { DrawSimpleBorder(dc, rect); } virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } - virtual void DrawFrameBorder(wxDC& dc, wxRect *rect) + virtual void DrawBoxBorder(wxDC& dc, wxRect *rect) + { DrawSimpleBorder(dc, rect); } + virtual void DrawStaticBorder(wxDC& dc, wxRect *rect) { DrawSimpleBorder(dc, rect); } + virtual void DrawExtraBorder(wxDC& WXUNUSED(dc), wxRect * WXUNUSED(rect)) + { /* no extra borders for us */ } // all our XPMs are of this size static wxSize GetStdBmpSize() { return wxSize(8, 8); } @@ -277,6 +244,7 @@ protected: { return GetIndicator(IndicatorType_Radio, flags); } virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type); + virtual int GetFrameBorderWidth(int flags) const; private: // the bitmaps returned by GetIndicator() @@ -556,7 +524,7 @@ wxMonoTheme::~wxMonoTheme() { delete m_renderer; delete m_scheme; - wxArtProvider::RemoveProvider(m_artProvider); + delete m_artProvider; } wxRenderer *wxMonoTheme::GetRenderer() @@ -629,10 +597,11 @@ wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const case SCROLLBAR: case SCROLLBAR_PRESSED: case GAUGE: - case HIGHLIGHT: case TITLEBAR: case TITLEBAR_ACTIVE: + case HIGHLIGHT_TEXT: case DESKTOP: + case FRAME: return GetBg(); case MAX: @@ -647,9 +616,9 @@ wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const case CONTROL_TEXT: case CONTROL_TEXT_DISABLED: case CONTROL_TEXT_DISABLED_SHADOW: - case HIGHLIGHT_TEXT: case TITLEBAR_TEXT: case TITLEBAR_ACTIVE_TEXT: + case HIGHLIGHT: return GetFg(); } @@ -682,13 +651,14 @@ wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const case wxBORDER_STATIC: case wxBORDER_RAISED: case wxBORDER_SUNKEN: + case wxBORDER_THEME: width = 1; break; - + /* case wxBORDER_DOUBLE: width = 2; break; - + */ default: wxFAIL_MSG(_T("unknown border type")); // fall through @@ -708,40 +678,6 @@ wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const return rect; } -void wxMonoRenderer::DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rectTotal, - int WXUNUSED(flags), - wxRect *rectIn) -{ - wxRect rect = rectTotal; - - switch ( border ) - { - case wxBORDER_DOUBLE: - DrawSimpleBorder(dc, &rect); - // fall through - - case wxBORDER_SUNKEN: - case wxBORDER_STATIC: - case wxBORDER_RAISED: - case wxBORDER_SIMPLE: - DrawSimpleBorder(dc, &rect); - break; - - default: - wxFAIL_MSG(_T("unknown border type")); - // fall through - - case wxBORDER_DEFAULT: - case wxBORDER_NONE: - break; - } - - if ( rectIn ) - *rectIn = rect; -} - void wxMonoRenderer::DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags, @@ -768,6 +704,18 @@ wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2) dc.DrawLine(x, y1, x, y2 + 1); } +void wxMonoRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int flags) +{ + // no need to draw the focus rect for selected items, it would be invisible + // anyhow + if ( !(flags & wxCONTROL_SELECTED) ) + { + dc.SetPen(m_penFg); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRectangle(rect); + } +} + // ---------------------------------------------------------------------------- // label // ---------------------------------------------------------------------------- @@ -781,7 +729,6 @@ void wxMonoRenderer::DrawButtonLabel(wxDC& dc, int indexAccel, wxRect *rectBounds) { - dc.SetTextForeground(m_penFg.GetColour()); dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds); if ( flags & wxCONTROL_DISABLED ) @@ -856,18 +803,18 @@ wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type) #if wxUSE_TOOLBAR -void wxMonoRenderer::DrawToolBarButton(wxDC& dc, - const wxString& label, - const wxBitmap& bitmap, - const wxRect& rect, - int flags, - long style, - int tbarStyle) +void wxMonoRenderer::DrawToolBarButton(wxDC& WXUNUSED(dc), + const wxString& WXUNUSED(label), + const wxBitmap& WXUNUSED(bitmap), + const wxRect& WXUNUSED(rect), + int WXUNUSED(flags), + long WXUNUSED(style), + int WXUNUSED(tbarStyle)) { wxFAIL_MSG(_T("TODO")); } -wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *separator) const +wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *WXUNUSED(separator)) const { wxFAIL_MSG(_T("TODO")); @@ -889,13 +836,13 @@ wxSize wxMonoRenderer::GetToolBarMargin() const #if wxUSE_NOTEBOOK -void wxMonoRenderer::DrawTab(wxDC& dc, - const wxRect& rect, - wxDirection dir, - const wxString& label, - const wxBitmap& bitmap, - int flags, - int indexAccel) +void wxMonoRenderer::DrawTab(wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + wxDirection WXUNUSED(dir), + const wxString& WXUNUSED(label), + const wxBitmap& WXUNUSED(bitmap), + int WXUNUSED(flags), + int WXUNUSED(indexAccel)) { wxFAIL_MSG(_T("TODO")); } @@ -922,10 +869,10 @@ wxSize wxMonoRenderer::GetTabPadding() const #if wxUSE_COMBOBOX -void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal, - wxBitmap *bmpFocus, - wxBitmap *bmpPressed, - wxBitmap *bmpDisabled) +void wxMonoRenderer::GetComboBitmaps(wxBitmap *WXUNUSED(bmpNormal), + wxBitmap *WXUNUSED(bmpFocus), + wxBitmap *WXUNUSED(bmpPressed), + wxBitmap *WXUNUSED(bmpDisabled)) { wxFAIL_MSG(_T("TODO")); } @@ -938,43 +885,43 @@ void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal, #if wxUSE_MENUS -void wxMonoRenderer::DrawMenuBarItem(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags, - int indexAccel) +void wxMonoRenderer::DrawMenuBarItem(wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + const wxString& WXUNUSED(label), + int WXUNUSED(flags), + int WXUNUSED(indexAccel)) { wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawMenuItem(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& geometryInfo, - const wxString& label, - const wxString& accel, - const wxBitmap& bitmap, - int flags, - int indexAccel) +void wxMonoRenderer::DrawMenuItem(wxDC& WXUNUSED(dc), + wxCoord WXUNUSED(y), + const wxMenuGeometryInfo& WXUNUSED(geometryInfo), + const wxString& WXUNUSED(label), + const wxString& WXUNUSED(accel), + const wxBitmap& WXUNUSED(bitmap), + int WXUNUSED(flags), + int WXUNUSED(indexAccel)) { wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawMenuSeparator(wxDC& dc, - wxCoord y, - const wxMenuGeometryInfo& geomInfo) +void wxMonoRenderer::DrawMenuSeparator(wxDC& WXUNUSED(dc), + wxCoord WXUNUSED(y), + const wxMenuGeometryInfo& WXUNUSED(geomInfo)) { wxFAIL_MSG(_T("TODO")); } -wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& sizeText) const +wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& WXUNUSED(sizeText)) const { wxFAIL_MSG(_T("TODO")); return wxSize(); } -wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win, - const wxMenu& menu) const +wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *WXUNUSED(win), + const wxMenu& WXUNUSED(menu)) const { wxFAIL_MSG(_T("TODO")); @@ -989,36 +936,36 @@ wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win, #if wxUSE_SLIDER -void wxMonoRenderer::DrawSliderShaft(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int flags, - long style, - wxRect *rectShaft) +void wxMonoRenderer::DrawSliderShaft(wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + int WXUNUSED(lenThumb), + wxOrientation WXUNUSED(orient), + int WXUNUSED(flags), + long WXUNUSED(style), + wxRect *WXUNUSED(rectShaft)) { wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawSliderThumb(wxDC& dc, - const wxRect& rect, - wxOrientation orient, - int flags, - long style) +void wxMonoRenderer::DrawSliderThumb(wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + wxOrientation WXUNUSED(orient), + int WXUNUSED(flags), + long WXUNUSED(style)) { wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawSliderTicks(wxDC& dc, - const wxRect& rect, - int lenThumb, - wxOrientation orient, - int start, - int end, - int step, - int flags, - long style) +void wxMonoRenderer::DrawSliderTicks(wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + int WXUNUSED(lenThumb), + wxOrientation WXUNUSED(orient), + int WXUNUSED(start), + int WXUNUSED(end), + int WXUNUSED(step), + int WXUNUSED(flags), + long WXUNUSED(style)) { wxFAIL_MSG(_T("TODO")); } @@ -1038,19 +985,19 @@ wxCoord wxMonoRenderer::GetSliderTickLen() const } -wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& rect, - int lenThumb, - wxOrientation orient, - long style) const +wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& WXUNUSED(rect), + int WXUNUSED(lenThumb), + wxOrientation WXUNUSED(orient), + long WXUNUSED(style)) const { wxFAIL_MSG(_T("TODO")); return wxRect(); } -wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& rect, - int lenThumb, - wxOrientation orient) const +wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& WXUNUSED(rect), + int WXUNUSED(lenThumb), + wxOrientation WXUNUSED(orient)) const { wxFAIL_MSG(_T("TODO")); @@ -1094,7 +1041,18 @@ void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc, const wxRect& rect, int WXUNUSED(flags)) { - DrawSolidRect(dc, wxMONO_FG_COL, rect); + DrawSolidRect(dc, wxMONO_BG_COL, rect); + + // manually draw stipple pattern (wxDFB doesn't implement the wxSTIPPLE + // brush style): + dc.SetPen(m_penFg); + for ( wxCoord y = rect.GetTop(); y <= rect.GetBottom(); y++ ) + { + for ( wxCoord x = rect.GetLeft() + (y % 2); x <= rect.GetRight(); x+=2 ) + { + dc.DrawPoint(x, y); + } + } } void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, @@ -1106,86 +1064,33 @@ void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, } // ---------------------------------------------------------------------------- -// top level windows +// status bar // ---------------------------------------------------------------------------- -void wxMonoRenderer::DrawFrameTitleBar(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - const wxString& WXUNUSED(title), - const wxIcon& WXUNUSED(icon), - int WXUNUSED(flags), - int WXUNUSED(specialButton), - int WXUNUSED(specialButtonFlag)) -{ -} +#if wxUSE_STATUSBAR -void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - int WXUNUSED(flags)) +wxCoord wxMonoRenderer::GetStatusBarBorderBetweenFields() const { + return 1; } -void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - int WXUNUSED(flags)) +wxSize wxMonoRenderer::GetStatusBarFieldMargins() const { + return wxSize(1, 1); } -void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - const wxString& WXUNUSED(title), - int WXUNUSED(flags)) -{ -} - -void wxMonoRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - const wxIcon& WXUNUSED(icon), - int WXUNUSED(flags)) -{ -} - -void wxMonoRenderer::DrawFrameButton(wxDC& WXUNUSED(dc), - wxCoord WXUNUSED(x), - wxCoord WXUNUSED(y), - int WXUNUSED(button), - int WXUNUSED(flags)) -{ -} - -wxRect -wxMonoRenderer::GetFrameClientArea(const wxRect& rect, - int WXUNUSED(flags)) const -{ - return rect; -} +#endif // wxUSE_STATUSBAR -wxSize -wxMonoRenderer::GetFrameTotalSize(const wxSize& clientSize, - int WXUNUSED(flags)) const -{ - return clientSize; -} - -wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const -{ - return wxSize(0,0); -} - -wxSize wxMonoRenderer::GetFrameIconSize() const -{ - return wxSize(wxDefaultCoord, wxDefaultCoord); -} +// ---------------------------------------------------------------------------- +// top level windows +// ---------------------------------------------------------------------------- -int -wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect), - const wxPoint& WXUNUSED(pt), - int WXUNUSED(flags)) const +int wxMonoRenderer::GetFrameBorderWidth(int WXUNUSED(flags)) const { - return wxHT_TOPLEVEL_CLIENT_AREA; + // all our borders are simple + return 1; } - // ---------------------------------------------------------------------------- // wxMonoArtProvider // ---------------------------------------------------------------------------- @@ -1197,3 +1102,4 @@ wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id), return wxNullBitmap; } +#endif // wxUSE_THEME_MONO