+ Create(parent, id, pos, size, style, validator);
+}
+
+
+bool wxDropdownButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator)
+{
+ m_marginX = 0;
+ m_marginY = 0;
+
+ m_useDropArrow = DROPBUT_USEDROPARROW(style & wxBU_COMBO);
+
+ wxBitmap chkBmp(15,15); // arbitrary
+ if ( !wxBitmapButton::Create(parent, id, chkBmp,
+ pos, wxDefaultSize,
+ style | (m_useDropArrow ? wxBU_AUTODRAW : wxNO_BORDER),
+ validator) )
+ return false;
+
+ const wxSize sz = GetSize();
+ int w = chkBmp.GetWidth(),
+ h = chkBmp.GetHeight();
+ m_borderX = sz.x - m_marginX - w;
+ m_borderY = sz.y - m_marginY - h;
+
+ DoMoveWindow(pos.x, pos.y, size.x, size.y);
+
+ return true;
+}
+
+
+void wxDropdownButton::RecreateBitmaps(int w, int h)
+{
+ wxMemoryDC dc;
+
+ int borderX = m_marginX + m_borderX;
+ int borderY = m_marginY + m_borderY;
+ int bw = w - borderX;
+ int bh = h - borderY;
+
+ wxBitmap bmp(bw, bh);
+ wxBitmap bmpSel(bw, bh);
+ wxRect r(0,0,w,h);
+
+ wxRendererNative& renderer = wxRendererNative::Get();
+
+ dc.SelectObject(bmp);
+
+ if ( m_useDropArrow )
+ {
+ // Use DrawDropArrow on transparent background.
+
+ wxColour magic(255,0,255);
+ wxBrush magicBrush(magic);
+ r.x = -(borderX/2);
+ r.y = -(borderY/2);
+
+ dc.SetBrush( magicBrush );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle(0,0,bw,bh);
+ renderer.DrawDropArrow(this, dc, r);
+ dc.SelectObject( wxNullBitmap );
+ wxMask *mask = new wxMask( bmp, magic );
+ bmp.SetMask( mask );
+
+ dc.SelectObject(bmpSel);
+
+ dc.SetBrush( magicBrush );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle(0,0,bw,bh);
+ renderer.DrawDropArrow(this, dc, r, wxCONTROL_PRESSED);
+ dc.SelectObject( wxNullBitmap );
+ mask = new wxMask( bmpSel, magic );
+ bmpSel.SetMask( mask );
+ }
+ else
+ {
+ // Use DrawComboBoxDropButton for the entire button
+ // (also render extra "hot" button state).
+
+ renderer.DrawComboBoxDropButton(this, dc, r);
+
+ dc.SelectObject(bmpSel);
+
+ renderer.DrawComboBoxDropButton(this, dc, r, wxCONTROL_PRESSED);
+
+ wxBitmap bmpHot(bw,bh);
+ dc.SelectObject(bmpHot);
+ renderer.DrawComboBoxDropButton(this, dc, r, wxCONTROL_CURRENT);
+
+ m_bmpNormal = bmp;
+ m_bmpHot = bmpHot;
+ }
+
+ SetBitmapLabel(bmp);
+ SetBitmapSelected(bmpSel);