bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap) { if ( bitmap.Ok() ) { int width = bitmap.GetWidth(); int height = bitmap.GetHeight(); if ( m_usedImgSize.x <= 0 ) { // // If size not yet determined, get it from this image. m_usedImgSize.x = width; m_usedImgSize.y = height; InvalidateBestSize(); wxSize newSz = GetBestSize(); wxSize sz = GetSize(); if ( newSz.y > sz.y ) SetSize(sz.x, newSz.y); else DetermineIndent(); } wxCHECK_MSG(width == m_usedImgSize.x && height == m_usedImgSize.y, false, wxT("you can only add images of same size")); } return true; }
bool wxBitmapComboBoxBase::OnAddBitmap(const wxBitmap& bitmap) { if ( bitmap.IsOk() ) { int width = bitmap.GetWidth(); int height = bitmap.GetHeight(); if ( m_usedImgSize.x < 0 ) { // If size not yet determined, get it from this image. m_usedImgSize.x = width; m_usedImgSize.y = height; // Adjust control size to vertically fit the bitmap wxWindow* ctrl = GetControl(); ctrl->InvalidateBestSize(); wxSize newSz = ctrl->GetBestSize(); wxSize sz = ctrl->GetSize(); if ( newSz.y > sz.y ) ctrl->SetSize(sz.x, newSz.y); else DetermineIndent(); } wxCHECK_MSG( width == m_usedImgSize.x && height == m_usedImgSize.y, false, "you can only add images of same size" ); return true; } return false; }
void wxBitmapComboBox::OnSize(wxSizeEvent& event) { // Prevent infinite looping if ( !m_inResize ) { m_inResize = true; DetermineIndent(); m_inResize = false; } event.Skip(); }
void wxBitmapComboBoxBase::BCBDoClear() { for ( unsigned i = 0; i < m_bitmaps.size(); i++ ) delete GetBitmapPtr(i); m_bitmaps.Empty(); m_usedImgSize.x = -1; m_usedImgSize.y = -1; DetermineIndent(); }
void wxBitmapComboBox::Clear() { wxOwnerDrawnComboBox::Clear(); unsigned int i; for ( i=0; i<m_bitmaps.size(); i++ ) delete GetBitmapPtr(i); m_bitmaps.Empty(); m_usedImgSize.x = 0; m_usedImgSize.y = 0; DetermineIndent(); }