const wxString& label,
const wxRect& rect,
int flags = 0);
+ virtual void DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags = 0);
virtual void DrawCheckButton(wxDC& dc,
const wxString& label,
int flags = 0);
virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect);
+
+ virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
+ const wxRect& rect) const;
+ virtual wxRect GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond) const;
#endif // wxUSE_TEXTCTRL
virtual wxRect GetBorderDimensions(wxBorder border) const;
{
IndicatorType_Check,
IndicatorType_Radio,
- IndicatorType_Menu,
+ IndicatorType_MaxCtrl,
+ IndicatorType_Menu = IndicatorType_MaxCtrl,
IndicatorType_Max
};
virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect);
virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect);
virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect);
+ virtual void DrawFrameBorder(wxDC& dc, wxRect *rect);
// draw the frame with non-empty label inside the given rectText
const wxRect& rectLabel);
+ // draw the bitmap for a check item (which is by default the same as check
+ // box one but may be different)
+ virtual void DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags);
+
// common routine for drawing check and radio buttons
void DrawCheckOrRadioButton(wxDC& dc,
const wxString& label,
virtual wxBitmap GetRadioBitmap(int flags) = 0;
virtual wxBitmap GetCheckBitmap(int flags) = 0;
+#if wxUSE_TEXTCTRL
+ // return the width of the border around the text area in the text control
+ virtual int GetTextBorderWidth(const wxTextCtrl *text) const;
+#endif // wxUSE_TEXTCTRL
// return the starting and ending positions, in pixels, of the thumb of a
// scrollbar with the given logical position, thumb size and range and the
DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
}
+void wxStdRenderer::DrawFrameBorder(wxDC& dc, wxRect *rect)
+{
+ DrawShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
+ DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
+}
+
void wxStdRenderer::DrawBorder(wxDC& dc,
wxBorder border,
const wxRect& rectTotal,
}
else // no label
{
- // just draw the complete frame
- DrawShadedRect(dc, &rectFrame, m_penDarkGrey, m_penHighlight);
- DrawShadedRect(dc, &rectFrame, m_penHighlight, m_penDarkGrey);
+ DrawFrameBorder(dc, &rectFrame);
}
}
}
}
+void wxStdRenderer::DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
+{
+ DrawCheckButton(dc, wxEmptyString, bitmap, rect, flags);
+}
+
+void wxStdRenderer::DrawCheckItem(wxDC& dc,
+ const wxString& label,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
+{
+ wxRect rectBitmap = rect;
+ rectBitmap.width = GetCheckBitmapSize().x;
+ DrawCheckItemBitmap(dc, bitmap, rectBitmap, flags);
+
+ wxRect rectLabel = rect;
+ wxCoord shift = rectBitmap.width + 2*GetCheckItemMargin();
+ rectLabel.x += shift;
+ rectLabel.width -= shift;
+ DrawItem(dc, label, rectLabel, flags);
+}
+
// ----------------------------------------------------------------------------
// check and radio bitmaps
// ----------------------------------------------------------------------------
// nothing by default
}
+int wxStdRenderer::GetTextBorderWidth(const wxTextCtrl * WXUNUSED(text)) const
+{
+ return 1;
+}
+
+wxRect
+wxStdRenderer::GetTextTotalArea(const wxTextCtrl *text, const wxRect& rect) const
+{
+ wxRect rectTotal = rect;
+ rectTotal.Inflate(GetTextBorderWidth(text));
+ return rectTotal;
+}
+
+wxRect wxStdRenderer::GetTextClientArea(const wxTextCtrl *text,
+ const wxRect& rect,
+ wxCoord *extraSpaceBeyond) const
+{
+ wxRect rectText = rect;
+ rectText.Deflate(GetTextBorderWidth(text));
+
+ if ( extraSpaceBeyond )
+ *extraSpaceBeyond = 0;
+
+ return rectText;
+}
+
#endif // wxUSE_TEXTCTRL
// ----------------------------------------------------------------------------
int flags = 0);
virtual void DrawScrollCorner(wxDC& dc,
const wxRect& rect);
- virtual void DrawCheckItem(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rect,
- int flags = 0);
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
{ return wxSize(6, 6); }
#if wxUSE_TEXTCTRL
- virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
- const wxRect& rect) const;
virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect,
wxCoord *extraSpaceBeyond) const;
void DrawUndeterminedBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
protected:
+ // overridden wxStdRenderer methods
virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect);
virtual void DrawFrameWithLabel(wxDC& dc,
int alignment,
int indexAccel);
+ virtual void DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags);
+
// get the colour to use for background
wxColour GetBackgroundColour(int flags) const
{
// draw the radio button bitmap for the given state
void DrawRadioBitmap(wxDC& dc, const wxRect& rect, int flags);
- // draw check/radio - the bitmap must be a valid one by now
- void DoDrawCheckOrRadioBitmap(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rectTotal,
- int flags,
- wxAlignment align,
- int indexAccel);
-
// common part of DrawMenuItem() and DrawMenuBarItem()
void DoDrawMenuItem(wxDC& dc,
const wxRect& rect,
}
// ----------------------------------------------------------------------------
-// label
+// check/radion buttons
// ----------------------------------------------------------------------------
-void wxGTKRenderer::DrawCheckItem(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rect,
- int flags)
+void wxGTKRenderer::DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
{
- wxRect rectBitmap = rect;
- rectBitmap.x -= 1;
- rectBitmap.width = GetCheckBitmapSize().x;
-
// never draw the focus rect around the check indicators here
- DrawCheckButton(dc, wxEmptyString, bitmap, rectBitmap, flags & ~wxCONTROL_FOCUSED);
-
- wxRect rectLabel = rect;
- wxCoord shift = rectBitmap.width + 2*GetCheckItemMargin();
- rectLabel.x += shift;
- rectLabel.width -= shift;
- DrawItem(dc, label, rectLabel, flags);
+ DrawCheckButton(dc, wxEmptyString, bitmap, rect, flags & ~wxCONTROL_FOCUSED);
}
-// ----------------------------------------------------------------------------
-// check/radion buttons
-// ----------------------------------------------------------------------------
-
void wxGTKRenderer::DrawUndeterminedBitmap(wxDC& dc,
const wxRect& rectTotal,
bool isPressed)
#if wxUSE_TEXTCTRL
-wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
- const wxRect& rect) const
-{
- wxRect rectTotal = rect;
- rectTotal.Inflate(2*BORDER_THICKNESS);
- return rectTotal;
-}
-
wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect,
wxCoord *extraSpaceBeyond) const
{
- wxRect rectText = rect;
- rectText.Deflate(2*BORDER_THICKNESS);
+ wxRect
+ rectText = wxStdRenderer::GetTextClientArea(text, rect, extraSpaceBeyond);
if ( text->WrapLines() )
{
return rectText;
}
-#endif // wxUSE_TEXTCTRL
-
void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
{
wxBitmap bmpLineWrap = GetLineWrapBitmap();
}
}
+#endif // wxUSE_TEXTCTRL
+
// ----------------------------------------------------------------------------
// notebook
// ----------------------------------------------------------------------------
int flags = 0);
virtual void DrawScrollCorner(wxDC& dc,
const wxRect& rect);
- virtual void DrawCheckItem(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rect,
- int flags = 0);
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
#endif // wxUSE_STATUSBAR
protected:
+ // overridden wxStdRenderer methods
virtual void DrawFrameWithLabel(wxDC& dc,
const wxString& label,
const wxRect& rectFrame,
int alignment,
int indexAccel);
+ virtual void DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags);
+
// draw the border used for scrollbar arrows
void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = false);
wxArrowDirection arrowDir,
wxArrowStyle arrowStyle);
- // DrawCheckButton helper
- void DrawCheckOrRadioButton(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rect,
- int flags,
- wxAlignment align,
- int indexAccel,
- wxCoord focusOffsetY);
-
// draw a normal or transposed line (useful for using the same code fo both
// horizontal and vertical widgets)
void DrawLine(wxDC& dc,
// get the standard check/radio button bitmap
wxBitmap GetIndicator(IndicatorType indType, int flags);
- wxBitmap GetCheckBitmap(int flags)
+ virtual wxBitmap GetCheckBitmap(int flags)
{ return GetIndicator(IndicatorType_Check, flags); }
- wxBitmap GetRadioBitmap(int flags)
+ virtual wxBitmap GetRadioBitmap(int flags)
{ return GetIndicator(IndicatorType_Radio, flags); }
private:
wxFont m_titlebarFont;
- // the checked and unchecked bitmaps for DrawCheckItem()
+ // the checked and unchecked bitmaps for DrawCheckItemBitmap()
wxBitmap m_bmpCheckBitmaps[IndicatorStatus_Max];
// the bitmaps returned by GetIndicator()
// (check)listbox items
// ----------------------------------------------------------------------------
-void wxWin32Renderer::DrawCheckItem(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rect,
- int flags)
+void wxWin32Renderer::DrawCheckItemBitmap(wxDC& dc,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int flags)
{
wxBitmap bmp;
if ( bitmap.Ok() )
dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2 - 1,
true /* use mask */);
-
- wxRect rectLabel = rect;
- int bmpWidth = bmp.GetWidth();
- rectLabel.x += bmpWidth;
- rectLabel.width -= bmpWidth;
-
- DrawItem(dc, label, rectLabel, flags);
}
// ----------------------------------------------------------------------------
return bmp;
}
+// ----------------------------------------------------------------------------
+// toolbar stuff
+// ----------------------------------------------------------------------------
+
#if wxUSE_TOOLBAR
void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
const wxString& label,
// text control geometry
// ----------------------------------------------------------------------------
-static inline int GetTextBorderWidth()
-{
- return 1;
-}
-
wxRect
-wxWin32Renderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
+wxWin32Renderer::GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const
{
- wxRect rectTotal = rect;
+ wxRect rectTotal = wxStdRenderer::GetTextTotalArea(text, rect);
- wxCoord widthBorder = GetTextBorderWidth();
- rectTotal.Inflate(widthBorder);
-
- // this is what Windows does
+ // this is strange but it's what Windows does
rectTotal.height++;
return rectTotal;
}
wxRect
-wxWin32Renderer::GetTextClientArea(const wxTextCtrl * WXUNUSED(text),
+wxWin32Renderer::GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect,
wxCoord *extraSpaceBeyond) const
{
if ( rectText.height > 0 )
rectText.height--;
- wxCoord widthBorder = GetTextBorderWidth();
- rectText.Inflate(-widthBorder);
-
- if ( extraSpaceBeyond )
- *extraSpaceBeyond = 0;
-
- return rectText;
+ return wxStdRenderer::GetTextClientArea(text, rect, extraSpaceBeyond);
}
#endif // wxUSE_TEXTCTRL