-void wxGTKRenderer::DrawCheckButton(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmapOrig,
- const wxRect& rectTotal,
- int flags,
- wxAlignment align,
- int indexAccel)
-{
- wxBitmap bitmap;
- if ( bitmapOrig.Ok() )
- {
- bitmap = bitmapOrig;
- }
- else
- {
- bitmap = GetCheckBitmap(flags);
- }
-
- DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
- flags, align, indexAccel);
-}
-
-void wxGTKRenderer::DoDrawCheckOrRadioBitmap(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmap,
- const wxRect& rectTotal,
- int flags,
- wxAlignment align,
- int indexAccel)
-{
- wxRect rect = rectTotal;
-
- if ( flags & wxCONTROL_FOCUSED )
- {
- // draw the focus border around everything
- DrawRect(dc, &rect, m_penBlack);
- }
- else
- {
- // the border does not offset the string under GTK
- rect.Inflate(-1);
- }
-
- // calculate the position of the bitmap and of the label
- wxCoord xBmp,
- yBmp = rect.y + (rect.height - bitmap.GetHeight()) / 2;
-
- wxRect rectLabel;
- dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
- rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;
-
- if ( align == wxALIGN_RIGHT )
- {
- xBmp = rect.GetRight() - bitmap.GetWidth();
- rectLabel.x = rect.x + 2;
- rectLabel.SetRight(xBmp);
- }
- else // normal (checkbox to the left of the text) case
- {
- xBmp = rect.x + 2;
- rectLabel.x = xBmp + bitmap.GetWidth() + 4;
- rectLabel.SetRight(rect.GetRight());
- }
-
- dc.DrawBitmap(bitmap, xBmp, yBmp, true /* use mask */);
-
- DrawLabel(dc, label, rectLabel, flags,
- wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
-}
-
-void wxGTKRenderer::DrawRadioButton(wxDC& dc,
- const wxString& label,
- const wxBitmap& bitmapOrig,
- const wxRect& rectTotal,
- int flags,
- wxAlignment align,
- int indexAccel)
-{
- wxBitmap bitmap;
- if ( bitmapOrig.Ok() )
- {
- bitmap = bitmapOrig;
- }
- else
- {
- wxRect rect;
- wxSize size = GetRadioBitmapSize();
- rect.width = size.x;
- rect.height = size.y;
- bitmap.Create(rect.width, rect.height);
- wxMemoryDC dc;
- dc.SelectObject(bitmap);
- dc.SetBackground(*wxLIGHT_GREY_BRUSH);
- dc.Clear();
- DrawRadioBitmap(dc, rect, flags);
-
- // must unselect the bitmap before setting a mask for it because of the
- // MSW limitations
- dc.SelectObject(wxNullBitmap);
- bitmap.SetMask(new wxMask(bitmap, *wxLIGHT_GREY));
- }
-
- DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
- flags, align, indexAccel);
-}
-