+void wxBitmapToggleButton::OnPaint(wxPaintEvent &WXUNUSED(event))
+{
+ wxSize size = GetSize();
+
+ wxBitmap bitmap = m_bitmap;
+
+ wxPaintDC dc(this);
+ wxRendererNative &renderer = wxRendererNative::Get();
+ int flags = 0;
+ if (m_depressed)
+ flags |= wxCONTROL_PRESSED;
+ wxRect rect(0,0,size.x,size.y);
+ renderer.DrawPushButton( this, dc, rect, flags );
+
+ if (bitmap.IsOk())
+ {
+ if (!IsEnabled())
+ {
+ if (!m_disabledBitmap.IsOk())
+ {
+ wxImage image = m_bitmap.ConvertToImage();
+ m_disabledBitmap = wxBitmap( image.ConvertToGreyscale() );
+ }
+
+ bitmap = m_disabledBitmap;
+ }
+
+ wxSize bsize = bitmap.GetSize();
+ int offset = 0;
+ if (m_depressed) offset = 1;
+ dc.DrawBitmap( bitmap, (size.x-bsize.x) / 2 + offset, (size.y-bsize.y) / 2 + offset, true );