]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/mono.cpp
Add doc for wxGraphicsContext.Create(), which is a lightweight context with no target...
[wxWidgets.git] / src / univ / themes / mono.cpp
index b2d51f8ff6e1a09992da50dc13115582c93798fb..7719bfa1862e467a7799fdb15dbc4acc16960317 100644 (file)
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#include "wx/univ/theme.h"
+
+#if wxUSE_THEME_MONO
+
 #ifndef WX_PRECOMP
 #ifndef WX_PRECOMP
+    #include "wx/window.h"
     #include "wx/dc.h"
 #endif // WX_PRECOMP
 
     #include "wx/dc.h"
 #endif // WX_PRECOMP
 
@@ -32,7 +37,6 @@
 #include "wx/univ/stdrend.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
 #include "wx/univ/stdrend.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
-#include "wx/univ/theme.h"
 
 class wxMonoColourScheme;
 
 
 class wxMonoColourScheme;
 
@@ -50,6 +54,13 @@ class wxMonoRenderer : public wxStdRenderer
 public:
     wxMonoRenderer(const wxColourScheme *scheme);
 
 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,
     virtual void DrawButtonLabel(wxDC& dc,
                                  const wxString& label,
                                  const wxBitmap& image,
@@ -59,6 +70,8 @@ public:
                                  int indexAccel = -1,
                                  wxRect *rectBounds = NULL);
 
                                  int indexAccel = -1,
                                  wxRect *rectBounds = NULL);
 
+    virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
+
     virtual void DrawButtonBorder(wxDC& dc,
                                   const wxRect& rect,
                                   int flags = 0,
     virtual void DrawButtonBorder(wxDC& dc,
                                   const wxRect& rect,
                                   int flags = 0,
@@ -203,6 +216,12 @@ public:
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
+#if wxUSE_STATUSBAR
+    virtual wxCoord GetStatusBarBorderBetweenFields() const;
+
+    virtual wxSize GetStatusBarFieldMargins() const;
+#endif // wxUSE_STATUSBAR
+
 protected:
     // override base class border drawing routines: we always draw just a
     // single simple border
 protected:
     // override base class border drawing routines: we always draw just a
     // single simple border
@@ -566,7 +585,7 @@ wxColour wxMonoColourScheme::GetBackground(wxWindow *win) const
     }
 
     // doesn't depend on the state
     }
 
     // doesn't depend on the state
-    if ( !col.Ok() )
+    if ( !col.IsOk() )
     {
         col = GetBg();
     }
     {
         col = GetBg();
     }
@@ -589,11 +608,12 @@ wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const
         case TITLEBAR_ACTIVE:
         case HIGHLIGHT_TEXT:
         case DESKTOP:
         case TITLEBAR_ACTIVE:
         case HIGHLIGHT_TEXT:
         case DESKTOP:
+        case FRAME:
             return GetBg();
 
         case MAX:
         default:
             return GetBg();
 
         case MAX:
         default:
-            wxFAIL_MSG(_T("invalid standard colour"));
+            wxFAIL_MSG(wxT("invalid standard colour"));
             // fall through
 
         case SHADOW_DARK:
             // fall through
 
         case SHADOW_DARK:
@@ -638,15 +658,16 @@ wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const
         case wxBORDER_STATIC:
         case wxBORDER_RAISED:
         case wxBORDER_SUNKEN:
         case wxBORDER_STATIC:
         case wxBORDER_RAISED:
         case wxBORDER_SUNKEN:
+        case wxBORDER_THEME:
             width = 1;
             break;
             width = 1;
             break;
-
+  /*
         case wxBORDER_DOUBLE:
             width = 2;
             break;
         case wxBORDER_DOUBLE:
             width = 2;
             break;
-
+   */
         default:
         default:
-            wxFAIL_MSG(_T("unknown border type"));
+            wxFAIL_MSG(wxT("unknown border type"));
             // fall through
 
         case wxBORDER_DEFAULT:
             // fall through
 
         case wxBORDER_DEFAULT:
@@ -690,10 +711,33 @@ wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2)
     dc.DrawLine(x, y1, x, y2 + 1);
 }
 
     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
 // ----------------------------------------------------------------------------
 
 // ----------------------------------------------------------------------------
 // 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,
 void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
                                      const wxString& label,
                                      const wxBitmap& image,
@@ -703,7 +747,6 @@ void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
                                      int indexAccel,
                                      wxRect *rectBounds)
 {
                                      int indexAccel,
                                      wxRect *rectBounds)
 {
-    dc.SetTextForeground(m_penFg.GetColour());
     dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
 
     if ( flags & wxCONTROL_DISABLED )
     dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
 
     if ( flags & wxCONTROL_DISABLED )
@@ -727,7 +770,7 @@ wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags)
     GetIndicatorsFromFlags(flags, indState, indStatus);
 
     wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
     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 )
     {
         const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
         if ( xpm )
@@ -744,7 +787,7 @@ wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type)
 {
     if ( type == FrameButton_Close )
     {
 {
     if ( type == FrameButton_Close )
     {
-        if ( !m_bmpFrameClose.Ok() )
+        if ( !m_bmpFrameClose.IsOk() )
         {
             static const char *xpmFrameClose[] = {
             /* columns rows colors chars-per-pixel */
         {
             static const char *xpmFrameClose[] = {
             /* columns rows colors chars-per-pixel */
@@ -778,27 +821,27 @@ wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type)
 
 #if wxUSE_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(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 }
 
 }
 
-wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *separator) const
+wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *WXUNUSED(separator)) const
 {
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
 wxSize wxMonoRenderer::GetToolBarMargin() const
 {
 
     return wxSize();
 }
 
 wxSize wxMonoRenderer::GetToolBarMargin() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
     return wxSize();
 }
@@ -811,27 +854,27 @@ wxSize wxMonoRenderer::GetToolBarMargin() const
 
 #if wxUSE_NOTEBOOK
 
 
 #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
 {
 }
 
 wxSize wxMonoRenderer::GetTabIndent() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
 wxSize wxMonoRenderer::GetTabPadding() const
 {
 
     return wxSize();
 }
 
 wxSize wxMonoRenderer::GetTabPadding() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
     return wxSize();
 }
@@ -844,12 +887,12 @@ wxSize wxMonoRenderer::GetTabPadding() const
 
 #if wxUSE_COMBOBOX
 
 
 #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
 }
 
 #endif // wxUSE_COMBOBOX
@@ -860,45 +903,45 @@ void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
 
 #if wxUSE_MENUS
 
 
 #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"));
+    wxFAIL_MSG(wxT("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"));
+    wxFAIL_MSG(wxT("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"));
+    wxFAIL_MSG(wxT("TODO"));
 }
 
 }
 
-wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& sizeText) const
+wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& WXUNUSED(sizeText)) const
 {
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
 
     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"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return NULL;
 }
 
     return NULL;
 }
@@ -911,70 +954,70 @@ wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win,
 
 #if wxUSE_SLIDER
 
 
 #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"));
+    wxFAIL_MSG(wxT("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"));
+    wxFAIL_MSG(wxT("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"));
+    wxFAIL_MSG(wxT("TODO"));
 }
 
 wxCoord wxMonoRenderer::GetSliderDim() const
 {
 }
 
 wxCoord wxMonoRenderer::GetSliderDim() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return 0;
 }
 
 wxCoord wxMonoRenderer::GetSliderTickLen() const
 {
 
     return 0;
 }
 
 wxCoord wxMonoRenderer::GetSliderTickLen() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return 0;
 }
 
 
 
     return 0;
 }
 
 
-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"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxRect();
 }
 
 
     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"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
     return wxSize();
 }
@@ -983,7 +1026,7 @@ wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& rect,
 
 wxSize wxMonoRenderer::GetProgressBarStep() const
 {
 
 wxSize wxMonoRenderer::GetProgressBarStep() const
 {
-    wxFAIL_MSG(_T("TODO"));
+    wxFAIL_MSG(wxT("TODO"));
 
     return wxSize();
 }
 
     return wxSize();
 }
@@ -999,10 +1042,10 @@ void wxMonoRenderer::DrawArrow(wxDC& dc,
                                int WXUNUSED(flags))
 {
     ArrowDirection arrowDir = GetArrowDirection(dir);
                                int WXUNUSED(flags))
 {
     ArrowDirection arrowDir = GetArrowDirection(dir);
-    wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") );
+    wxCHECK_RET( arrowDir != Arrow_Max, wxT("invalid arrow direction") );
 
     wxBitmap& bmp = m_bmpArrows[arrowDir];
 
     wxBitmap& bmp = m_bmpArrows[arrowDir];
-    if ( !bmp.Ok() )
+    if ( !bmp.IsOk() )
     {
         bmp = wxBitmap(ms_xpmArrows[arrowDir]);
     }
     {
         bmp = wxBitmap(ms_xpmArrows[arrowDir]);
     }
@@ -1016,7 +1059,18 @@ void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
                                         const wxRect& rect,
                                         int WXUNUSED(flags))
 {
                                         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,
 }
 
 void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
@@ -1027,6 +1081,24 @@ void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
     DrawSolidRect(dc, wxMONO_BG_COL, rect);
 }
 
     DrawSolidRect(dc, wxMONO_BG_COL, rect);
 }
 
+// ----------------------------------------------------------------------------
+// status bar
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STATUSBAR
+
+wxCoord wxMonoRenderer::GetStatusBarBorderBetweenFields() const
+{
+    return 1;
+}
+
+wxSize wxMonoRenderer::GetStatusBarFieldMargins() const
+{
+    return wxSize(1, 1);
+}
+
+#endif // wxUSE_STATUSBAR
+
 // ----------------------------------------------------------------------------
 // top level windows
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // top level windows
 // ----------------------------------------------------------------------------
@@ -1047,3 +1119,5 @@ wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id),
 {
     return wxNullBitmap;
 }
 {
     return wxNullBitmap;
 }
+
+#endif // wxUSE_THEME_MONO