X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3a01afec26a05525dbbd0968c68cfc64ce4e74a7..85a94ef07bc7b67ce7c418bb672c51a0a54d6f73:/src/univ/themes/mono.cpp diff --git a/src/univ/themes/mono.cpp b/src/univ/themes/mono.cpp index 9182471270..090b85902f 100644 --- a/src/univ/themes/mono.cpp +++ b/src/univ/themes/mono.cpp @@ -25,6 +25,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/dc.h" #endif // WX_PRECOMP #include "wx/artprov.h" @@ -58,12 +59,6 @@ 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 DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, @@ -155,45 +150,6 @@ public: const wxMenuGeometryInfo& geomInfo); #endif // wxUSE_MENUS -#if wxUSE_STATUSBAR - virtual void DrawStatusField(wxDC& dc, - const wxRect& rect, - const wxString& label, - int flags = 0, int style = 0); -#endif // wxUSE_STATUSBAR - - 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, @@ -204,20 +160,18 @@ public: virtual wxRect GetBorderDimensions(wxBorder border) const; - virtual bool AreScrollbarsInsideBorder() const; - #if wxUSE_SCROLLBAR virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); } #endif // wxUSE_SCROLLBAR - virtual wxCoord GetListboxItemHeight(wxCoord fontHeight); - virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); } virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); } +#if wxUSE_TOOLBAR virtual wxSize GetToolBarButtonSize(wxCoord *separator) const; virtual wxSize GetToolBarMargin() const; +#endif // wxUSE_TOOLBAR #if wxUSE_NOTEBOOK virtual wxSize GetTabIndent() const; @@ -249,22 +203,6 @@ public: const wxMenu& menu) const; #endif // wxUSE_MENUS -#if wxUSE_STATUSBAR - virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; -#endif // wxUSE_STATUSBAR - - virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const; - - virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const; - - virtual wxSize GetFrameMinSize(int flags) const; - - virtual wxSize GetFrameIconSize() const; - - virtual int HitTestFrame(const wxRect& rect, - const wxPoint& pt, - int flags = 0) const; - protected: // override base class border drawing routines: we always draw just a // single simple border @@ -277,8 +215,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); } @@ -289,6 +231,8 @@ protected: virtual wxBitmap GetRadioBitmap(int flags) { return GetIndicator(IndicatorType_Radio, flags); } + virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type); + private: // the bitmaps returned by GetIndicator() wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl] @@ -304,6 +248,9 @@ private: static const char **ms_xpmArrows[Arrow_Max]; + // the close bitmap for the frame for GetFrameButtonBitmap() + wxBitmap m_bmpFrameClose; + // pen used for foreground drawing wxPen m_penFg; }; @@ -637,9 +584,9 @@ 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: return GetBg(); @@ -655,9 +602,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(); } @@ -681,25 +628,20 @@ wxMonoRenderer::wxMonoRenderer(const wxColourScheme *scheme) // borders // ---------------------------------------------------------------------------- -void wxMonoRenderer::DrawBorder(wxDC& dc, - wxBorder border, - const wxRect& rectTotal, - int WXUNUSED(flags), - wxRect *rectIn) +wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const { - wxRect rect = rectTotal; - + wxCoord width; switch ( border ) { - case wxBORDER_DOUBLE: - DrawSimpleBorder(dc, &rect); - // fall through - - case wxBORDER_SUNKEN: + case wxBORDER_SIMPLE: case wxBORDER_STATIC: case wxBORDER_RAISED: - case wxBORDER_SIMPLE: - DrawSimpleBorder(dc, &rect); + case wxBORDER_SUNKEN: + width = 1; + break; + + case wxBORDER_DOUBLE: + width = 2; break; default: @@ -708,11 +650,17 @@ void wxMonoRenderer::DrawBorder(wxDC& dc, case wxBORDER_DEFAULT: case wxBORDER_NONE: + width = 0; break; } - if ( rectIn ) - *rectIn = rect; + wxRect rect; + rect.x = + rect.y = + rect.width = + rect.height = width; + + return rect; } void wxMonoRenderer::DrawButtonBorder(wxDC& dc, @@ -768,7 +716,7 @@ void wxMonoRenderer::DrawButtonLabel(wxDC& dc, } // ---------------------------------------------------------------------------- -// check/radion buttons +// bitmaps // ---------------------------------------------------------------------------- wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags) @@ -791,6 +739,38 @@ wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags) return bmp; } +wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type) +{ + if ( type == FrameButton_Close ) + { + if ( !m_bmpFrameClose.Ok() ) + { + static const char *xpmFrameClose[] = { + /* columns rows colors chars-per-pixel */ + "8 8 2 1", + " c white", + "X c black", + /* pixels */ + " ", + " XX XX ", + " X X ", + " XX ", + " XX ", + " X X ", + " XX XX ", + " ", + }; + + m_bmpFrameClose = wxBitmap(xpmFrameClose); + } + + return m_bmpFrameClose; + } + + // we don't show any other buttons than close + return wxNullBitmap; +} + // ---------------------------------------------------------------------------- // toolbar // ---------------------------------------------------------------------------- @@ -808,6 +788,20 @@ void wxMonoRenderer::DrawToolBarButton(wxDC& dc, wxFAIL_MSG(_T("TODO")); } +wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *separator) const +{ + wxFAIL_MSG(_T("TODO")); + + return wxSize(); +} + +wxSize wxMonoRenderer::GetToolBarMargin() const +{ + wxFAIL_MSG(_T("TODO")); + + return wxSize(); +} + #endif // wxUSE_TOOLBAR // ---------------------------------------------------------------------------- @@ -827,6 +821,20 @@ void wxMonoRenderer::DrawTab(wxDC& dc, wxFAIL_MSG(_T("TODO")); } +wxSize wxMonoRenderer::GetTabIndent() const +{ + wxFAIL_MSG(_T("TODO")); + + return wxSize(); +} + +wxSize wxMonoRenderer::GetTabPadding() const +{ + wxFAIL_MSG(_T("TODO")); + + return wxSize(); +} + #endif // wxUSE_NOTEBOOK // ---------------------------------------------------------------------------- @@ -846,123 +854,182 @@ void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal, #endif // wxUSE_COMBOBOX // ---------------------------------------------------------------------------- -// scrollbar +// menus // ---------------------------------------------------------------------------- -void wxMonoRenderer::DrawArrow(wxDC& dc, - wxDirection dir, - const wxRect& rect, - int WXUNUSED(flags)) +#if wxUSE_MENUS + +void wxMonoRenderer::DrawMenuBarItem(wxDC& dc, + const wxRect& rect, + const wxString& label, + int flags, + int indexAccel) { - ArrowDirection arrowDir = GetArrowDirection(dir); - wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") ); + wxFAIL_MSG(_T("TODO")); +} - wxBitmap& bmp = m_bmpArrows[arrowDir]; - if ( !bmp.Ok() ) - { - bmp = wxBitmap(ms_xpmArrows[arrowDir]); - } +void wxMonoRenderer::DrawMenuItem(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geometryInfo, + const wxString& label, + const wxString& accel, + const wxBitmap& bitmap, + int flags, + int indexAccel) +{ + wxFAIL_MSG(_T("TODO")); +} - wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight()); - dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */); +void wxMonoRenderer::DrawMenuSeparator(wxDC& dc, + wxCoord y, + const wxMenuGeometryInfo& geomInfo) +{ + wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc, - wxOrientation WXUNUSED(orient), - const wxRect& rect, - int WXUNUSED(flags)) +wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& sizeText) const { - DrawSolidRect(dc, wxMONO_FG_COL, rect); + wxFAIL_MSG(_T("TODO")); + + return wxSize(); } -void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, - wxOrientation WXUNUSED(orient), - const wxRect& rect, - int WXUNUSED(flags)) +wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win, + const wxMenu& menu) const { - DrawSolidRect(dc, wxMONO_BG_COL, rect); + wxFAIL_MSG(_T("TODO")); + + return NULL; } +#endif // wxUSE_MENUS + // ---------------------------------------------------------------------------- -// top level windows +// slider // ---------------------------------------------------------------------------- -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_SLIDER + +void wxMonoRenderer::DrawSliderShaft(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int flags, + long style, + wxRect *rectShaft) { + wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - int WXUNUSED(flags)) + +void wxMonoRenderer::DrawSliderThumb(wxDC& dc, + const wxRect& rect, + wxOrientation orient, + int flags, + long style) { + wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - int WXUNUSED(flags)) +void wxMonoRenderer::DrawSliderTicks(wxDC& dc, + const wxRect& rect, + int lenThumb, + wxOrientation orient, + int start, + int end, + int step, + int flags, + long style) { + wxFAIL_MSG(_T("TODO")); } -void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - const wxString& WXUNUSED(title), - int WXUNUSED(flags)) +wxCoord wxMonoRenderer::GetSliderDim() const { + wxFAIL_MSG(_T("TODO")); + + return 0; } -void wxMonoRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), - const wxIcon& WXUNUSED(icon), - int WXUNUSED(flags)) +wxCoord wxMonoRenderer::GetSliderTickLen() const { + wxFAIL_MSG(_T("TODO")); + + return 0; } -void wxMonoRenderer::DrawFrameButton(wxDC& WXUNUSED(dc), - wxCoord WXUNUSED(x), - wxCoord WXUNUSED(y), - int WXUNUSED(button), - int WXUNUSED(flags)) + +wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& rect, + int lenThumb, + wxOrientation orient, + long style) const { + wxFAIL_MSG(_T("TODO")); + + return wxRect(); } -wxRect -wxMonoRenderer::GetFrameClientArea(const wxRect& rect, - int WXUNUSED(flags)) const +wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& rect, + int lenThumb, + wxOrientation orient) const { - return rect; + wxFAIL_MSG(_T("TODO")); + + return wxSize(); } -wxSize -wxMonoRenderer::GetFrameTotalSize(const wxSize& clientSize, - int WXUNUSED(flags)) const +#endif // wxUSE_SLIDER + +wxSize wxMonoRenderer::GetProgressBarStep() const { - return clientSize; + wxFAIL_MSG(_T("TODO")); + + return wxSize(); } -wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const + +// ---------------------------------------------------------------------------- +// scrollbar +// ---------------------------------------------------------------------------- + +void wxMonoRenderer::DrawArrow(wxDC& dc, + wxDirection dir, + const wxRect& rect, + int WXUNUSED(flags)) { - return wxSize(0,0); + ArrowDirection arrowDir = GetArrowDirection(dir); + wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") ); + + wxBitmap& bmp = m_bmpArrows[arrowDir]; + if ( !bmp.Ok() ) + { + bmp = wxBitmap(ms_xpmArrows[arrowDir]); + } + + wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight()); + dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */); } -wxSize wxMonoRenderer::GetFrameIconSize() const +void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc, + wxOrientation WXUNUSED(orient), + const wxRect& rect, + int WXUNUSED(flags)) { - return wxSize(wxDefaultCoord, wxDefaultCoord); + DrawSolidRect(dc, wxMONO_FG_COL, rect); } -int -wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect), - const wxPoint& WXUNUSED(pt), - int WXUNUSED(flags)) const +void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, + wxOrientation WXUNUSED(orient), + const wxRect& rect, + int WXUNUSED(flags)) { - return wxHT_TOPLEVEL_CLIENT_AREA; + DrawSolidRect(dc, wxMONO_BG_COL, rect); } +// ---------------------------------------------------------------------------- +// top level windows +// ---------------------------------------------------------------------------- + // ---------------------------------------------------------------------------- // wxMonoArtProvider @@ -974,4 +1041,3 @@ wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id), { return wxNullBitmap; } -