wxFileSelectorCombo(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) : wxComboCtrl() { Init(); Create(parent,id,value, pos,size, // Style flag wxCC_STD_BUTTON makes the button // behave more like a standard push button. style | wxCC_STD_BUTTON, validator,name); // // Prepare custom button bitmap (just '...' text) wxMemoryDC dc; wxBitmap bmp(12,16); dc.SelectObject(bmp); // Draw transparent background wxColour magic(255,0,255); wxBrush magicBrush(magic); dc.SetBrush( magicBrush ); dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight()); // Draw text wxString str = wxT("..."); int w,h; dc.GetTextExtent(str, &w, &h, 0, 0); dc.DrawText(str, (bmp.GetWidth()-w)/2, (bmp.GetHeight()-h)/2); dc.SelectObject( wxNullBitmap ); // Finalize transparency with a mask wxMask *mask = new wxMask( bmp, magic ); bmp.SetMask( mask ); SetButtonBitmaps(bmp,true); }
CColorComboBox::CColorComboBox( wxWindow *parent, wxWindowID id, wxString selection, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style ) : wxBitmapComboBox( parent, id, selection, pos, size, n, choices, style ) { wxFont font; // wxVector<colorEntries> m_colourDialogNames = font.GetColors(); for( unsigned i = 0; i < 27; i++ ) { int w = 20, h = 10; wxMemoryDC dc; wxBitmap bmp( w, h ); dc.SelectObject( bmp ); wxColour magic( 255, 0, 255 ); wxBrush magicBrush( magic ); dc.SetBrush( magicBrush ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 0, 0, w, h ); // dc.SetBrush( wxBrush( m_colourDialogNames.at( i ).m_rgb ) ); dc.DrawRectangle( 0, 0, w, h ); dc.SelectObject( wxNullBitmap ); // wxMask *mask = new wxMask( bmp, magic ); // bmp.SetMask( mask ); // Append( m_colourDialogNames.at( i ).m_name, bmp, &m_colourDialogNames.at( i ).m_rgb ); } }