#include "wx/dcmemory.h"
#include "wx/window.h"
+ #include "wx/bmpbuttn.h"
#include "wx/button.h"
#include "wx/checkbox.h"
#include "wx/listbox.h"
// constants (to be removed, for testing only)
// ----------------------------------------------------------------------------
-static const size_t BORDER_THICKNESS = 10;
+static const size_t BORDER_THICKNESS = 1;
// ----------------------------------------------------------------------------
// wxGTKRenderer: draw the GUI elements in GTK style
break;
case wxBORDER_STATIC:
- DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ for ( width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ }
break;
case wxBORDER_RAISED:
break;
case wxBORDER_DOUBLE:
- DrawShadedRect(dc, &rect, m_penLightGrey, m_penBlack);
- DrawShadedRect(dc, &rect, m_penHighlight, m_penDarkGrey);
- DrawRect(dc, &rect, m_penLightGrey);
+ for ( width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawShadedRect(dc, &rect, m_penLightGrey, m_penBlack);
+ DrawShadedRect(dc, &rect, m_penHighlight, m_penDarkGrey);
+ DrawRect(dc, &rect, m_penLightGrey);
+ }
break;
case wxBORDER_SIMPLE:
- DrawRect(dc, &rect, m_penBlack);
+ for ( width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawRect(dc, &rect, m_penBlack);
+ }
break;
default:
case wxBORDER_SIMPLE:
case wxBORDER_STATIC:
- width = 1;
+ width = BORDER_THICKNESS;
break;
case wxBORDER_DOUBLE:
- width = 3;
+ width = 3*BORDER_THICKNESS;
break;
default:
{
wxRect rect = rectOrig;
- if ( flags & wxCONTROL_FOCUSED )
- {
- DrawRect(dc, &rect, m_penBlack);
- DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
- }
- else // !focused
+ if ( border != wxBORDER_NONE )
{
- DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
- DrawAntiShadedRect(dc, &rect, m_penBlack, m_penHighlight);
+ if ( flags & wxCONTROL_FOCUSED )
+ {
+ DrawRect(dc, &rect, m_penBlack);
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ }
+ else // !focused
+ {
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penHighlight);
+ }
}
if ( rectIn )
{
// button pressed: draw a black border around it and an inward shade
DrawRect(dc, &rect, m_penBlack);
- DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
- DrawAntiShadedRect(dc, &rect, m_penBlack, m_penDarkGrey);
+
+ for ( size_t width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+ DrawAntiShadedRect(dc, &rect, m_penBlack, m_penDarkGrey);
+ }
}
else
{
}
// now draw a normal button
- DrawShadedRect(dc, &rect, m_penHighlight, m_penBlack);
- DrawAntiShadedRect(dc, &rect,
- wxPen(GetBackgroundColour(flags), 0, wxSOLID),
- m_penDarkGrey);
+ for ( size_t width = 0; width < BORDER_THICKNESS; width++ )
+ {
+ DrawShadedRect(dc, &rect, m_penHighlight, m_penBlack);
+ DrawAntiShadedRect(dc, &rect,
+ wxPen(GetBackgroundColour(flags), 0, wxSOLID),
+ m_penDarkGrey);
+ }
}
if ( rectIn )
// text control
// ----------------------------------------------------------------------------
-static const int TEXT_BORDER = 2;
-
wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect)
{
wxRect rectTotal = rect;
- rectTotal.Inflate(TEXT_BORDER);
+ rectTotal.Inflate(2*BORDER_THICKNESS);
return rectTotal;
}
wxCoord *extraSpaceBeyond)
{
wxRect rectText = rect;
- rectText.Inflate(-TEXT_BORDER);
+ rectText.Inflate(-2*BORDER_THICKNESS);
if ( text->WrapLines() )
{
void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
{
- if ( wxDynamicCast(window, wxButton) )
+#if wxUSE_BMPBUTTON
+ if ( wxDynamicCast(window, wxBitmapButton) )
{
- // TODO: this is ad hoc...
- size->x += 3*window->GetCharWidth();
- wxCoord minBtnHeight = 18;
- if ( size->y < minBtnHeight )
- size->y = minBtnHeight;
-
- // button border width
+ size->x += 4;
size->y += 4;
- }
- else if ( wxDynamicCast(window, wxScrollBar) )
+ } else
+#endif // wxUSE_BMPBUTTON
+#if wxUSE_BUTTON
+ if ( wxDynamicCast(window, wxButton) )
+ {
+ if ( !(window->GetWindowStyle() & wxBU_EXACTFIT) )
+ {
+ // TODO: this is ad hoc...
+ size->x += 3*window->GetCharWidth();
+ wxCoord minBtnHeight = 18;
+ if ( size->y < minBtnHeight )
+ size->y = minBtnHeight;
+
+ // button border width
+ size->y += 4;
+ }
+ } else
+#endif wxUSE_BUTTON
+ if ( wxDynamicCast(window, wxScrollBar) )
{
// we only set the width of vert scrollbars and height of the
// horizontal ones