#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;
public:
wxMonoRenderer(const wxColourScheme *scheme);
+ virtual void DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int flags = 0,
+ int alignment = wxALIGN_LEFT | wxALIGN_TOP,
+ int indexAccel = -1,
+ wxRect *rectBounds = NULL);
virtual void DrawButtonLabel(wxDC& dc,
const wxString& label,
const wxBitmap& image,
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,
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,
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;
#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 wxCoord GetStatusBarBorderBetweenFields() 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
{ 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); }
virtual wxBitmap GetRadioBitmap(int flags)
{ return GetIndicator(IndicatorType_Radio, flags); }
+ virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type);
+ virtual int GetFrameBorderWidth(int flags) const;
+
private:
// the bitmaps returned by GetIndicator()
wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl]
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;
};
{
delete m_renderer;
delete m_scheme;
- wxArtProvider::RemoveProvider(m_artProvider);
+ delete m_artProvider;
}
wxRenderer *wxMonoTheme::GetRenderer()
}
// doesn't depend on the state
- if ( !col.Ok() )
+ if ( !col.IsOk() )
{
col = GetBg();
}
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:
default:
- wxFAIL_MSG(_T("invalid standard colour"));
+ wxFAIL_MSG(wxT("invalid standard colour"));
// fall through
case SHADOW_DARK:
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();
}
// 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:
+ case wxBORDER_THEME:
+ width = 1;
break;
-
+ /*
+ case wxBORDER_DOUBLE:
+ width = 2;
+ break;
+ */
default:
- wxFAIL_MSG(_T("unknown border type"));
+ wxFAIL_MSG(wxT("unknown border type"));
// fall through
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,
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
// ----------------------------------------------------------------------------
+void wxMonoRenderer::DrawLabel(wxDC& dc,
+ const wxString& label,
+ const wxRect& rect,
+ int WXUNUSED(flags),
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounds)
+{
+ dc.DrawLabel(label, wxNullBitmap, rect, alignment, indexAccel, rectBounds);
+}
+
void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
const wxString& label,
const wxBitmap& image,
int indexAccel,
wxRect *rectBounds)
{
- dc.SetTextForeground(m_penFg.GetColour());
dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
if ( flags & wxCONTROL_DISABLED )
}
// ----------------------------------------------------------------------------
-// check/radion buttons
+// bitmaps
// ----------------------------------------------------------------------------
wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags)
GetIndicatorsFromFlags(flags, indState, indStatus);
wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
- if ( !bmp.Ok() )
+ if ( !bmp.IsOk() )
{
const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
if ( xpm )
return bmp;
}
+wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type)
+{
+ if ( type == FrameButton_Close )
+ {
+ if ( !m_bmpFrameClose.IsOk() )
+ {
+ 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
// ----------------------------------------------------------------------------
#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(wxT("TODO"));
+}
+
+wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *WXUNUSED(separator)) const
+{
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
+}
+
+wxSize wxMonoRenderer::GetToolBarMargin() const
{
- wxFAIL_MSG(_T("TODO"));
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
}
#endif // wxUSE_TOOLBAR
#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"));
+ wxFAIL_MSG(wxT("TODO"));
+}
+
+wxSize wxMonoRenderer::GetTabIndent() const
+{
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
+}
+
+wxSize wxMonoRenderer::GetTabPadding() const
+{
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
}
#endif // wxUSE_NOTEBOOK
#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"));
+ wxFAIL_MSG(wxT("TODO"));
}
#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& WXUNUSED(dc),
+ const wxRect& WXUNUSED(rect),
+ const wxString& WXUNUSED(label),
+ int WXUNUSED(flags),
+ int WXUNUSED(indexAccel))
{
- ArrowDirection arrowDir = GetArrowDirection(dir);
- wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") );
+ wxFAIL_MSG(wxT("TODO"));
+}
- wxBitmap& bmp = m_bmpArrows[arrowDir];
- if ( !bmp.Ok() )
- {
- bmp = wxBitmap(ms_xpmArrows[arrowDir]);
- }
+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(wxT("TODO"));
+}
- wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight());
- dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */);
+void wxMonoRenderer::DrawMenuSeparator(wxDC& WXUNUSED(dc),
+ wxCoord WXUNUSED(y),
+ const wxMenuGeometryInfo& WXUNUSED(geomInfo))
+{
+ wxFAIL_MSG(wxT("TODO"));
}
-void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
- wxOrientation WXUNUSED(orient),
- const wxRect& rect,
- int WXUNUSED(flags))
+wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& WXUNUSED(sizeText)) const
{
- DrawSolidRect(dc, wxMONO_FG_COL, rect);
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
}
-void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
- wxOrientation WXUNUSED(orient),
- const wxRect& rect,
- int WXUNUSED(flags))
+wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
+ const wxMenu& WXUNUSED(menu)) const
{
- DrawSolidRect(dc, wxMONO_BG_COL, rect);
+ wxFAIL_MSG(wxT("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& WXUNUSED(dc),
+ const wxRect& WXUNUSED(rect),
+ int WXUNUSED(lenThumb),
+ wxOrientation WXUNUSED(orient),
+ int WXUNUSED(flags),
+ long WXUNUSED(style),
+ wxRect *WXUNUSED(rectShaft))
{
+ wxFAIL_MSG(wxT("TODO"));
}
-void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc),
- const wxRect& WXUNUSED(rect),
- int WXUNUSED(flags))
+
+void wxMonoRenderer::DrawSliderThumb(wxDC& WXUNUSED(dc),
+ const wxRect& WXUNUSED(rect),
+ wxOrientation WXUNUSED(orient),
+ int WXUNUSED(flags),
+ long WXUNUSED(style))
{
+ wxFAIL_MSG(wxT("TODO"));
}
-void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc),
- const wxRect& WXUNUSED(rect),
- int WXUNUSED(flags))
+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(wxT("TODO"));
}
-void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc),
- const wxRect& WXUNUSED(rect),
- const wxString& WXUNUSED(title),
- int WXUNUSED(flags))
+wxCoord wxMonoRenderer::GetSliderDim() const
{
+ wxFAIL_MSG(wxT("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(wxT("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& WXUNUSED(rect),
+ int WXUNUSED(lenThumb),
+ wxOrientation WXUNUSED(orient),
+ long WXUNUSED(style)) const
{
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxRect();
}
-wxRect
-wxMonoRenderer::GetFrameClientArea(const wxRect& rect,
- int WXUNUSED(flags)) const
+wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& WXUNUSED(rect),
+ int WXUNUSED(lenThumb),
+ wxOrientation WXUNUSED(orient)) const
{
- return rect;
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
+}
+
+#endif // wxUSE_SLIDER
+
+wxSize wxMonoRenderer::GetProgressBarStep() const
+{
+ wxFAIL_MSG(wxT("TODO"));
+
+ return wxSize();
+}
+
+
+// ----------------------------------------------------------------------------
+// scrollbar
+// ----------------------------------------------------------------------------
+
+void wxMonoRenderer::DrawArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int WXUNUSED(flags))
+{
+ ArrowDirection arrowDir = GetArrowDirection(dir);
+ wxCHECK_RET( arrowDir != Arrow_Max, wxT("invalid arrow direction") );
+
+ wxBitmap& bmp = m_bmpArrows[arrowDir];
+ if ( !bmp.IsOk() )
+ {
+ 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::GetFrameTotalSize(const wxSize& clientSize,
- int WXUNUSED(flags)) const
+void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
+ wxOrientation WXUNUSED(orient),
+ const wxRect& rect,
+ int WXUNUSED(flags))
{
- return clientSize;
+ 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);
+ }
+ }
}
-wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const
+void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
+ wxOrientation WXUNUSED(orient),
+ const wxRect& rect,
+ int WXUNUSED(flags))
{
- return wxSize(0,0);
+ DrawSolidRect(dc, wxMONO_BG_COL, rect);
}
-wxSize wxMonoRenderer::GetFrameIconSize() const
+// ----------------------------------------------------------------------------
+// status bar
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STATUSBAR
+
+wxCoord wxMonoRenderer::GetStatusBarBorderBetweenFields() const
{
- return wxSize(wxDefaultCoord, wxDefaultCoord);
+ return 1;
}
-int
-wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect),
- const wxPoint& WXUNUSED(pt),
- int WXUNUSED(flags)) const
+wxSize wxMonoRenderer::GetStatusBarFieldMargins() const
{
- return wxHT_TOPLEVEL_CLIENT_AREA;
+ return wxSize(1, 1);
}
+#endif // wxUSE_STATUSBAR
+
+// ----------------------------------------------------------------------------
+// top level windows
+// ----------------------------------------------------------------------------
+
+int wxMonoRenderer::GetFrameBorderWidth(int WXUNUSED(flags)) const
+{
+ // all our borders are simple
+ return 1;
+}
// ----------------------------------------------------------------------------
// wxMonoArtProvider
return wxNullBitmap;
}
+#endif // wxUSE_THEME_MONO