-#ifdef __WIN32__
- if(m_windowStyle & wxBU_LEFT)
- msStyle |= BS_LEFT;
- if(m_windowStyle & wxBU_RIGHT)
- msStyle |= BS_RIGHT;
- if(m_windowStyle & wxBU_TOP)
- msStyle |= BS_TOP;
- if(m_windowStyle & wxBU_BOTTOM)
- msStyle |= BS_BOTTOM;
-#endif
+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 );
+ }
+
+}