Merge branch 'ak_bmpcbox'
Change wxBitmap to wxBitmapBundle in wxBitmapComboBox. Closes #22033.
This commit is contained in:
@@ -143,6 +143,9 @@ Changes in behaviour not resulting in compilation errors
|
||||
Changes in behaviour which may result in build errors
|
||||
-----------------------------------------------------
|
||||
|
||||
- wxBitmapComboBoxBase::SetItemBitmap() changed argument's type from wxBitmap
|
||||
to wxBitmapBundle.
|
||||
|
||||
- "webview" library is not included in `wx-config --libs` output any more, you
|
||||
need to request it explicitly, e.g. `wx-config --libs std,webview`.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#if wxUSE_BITMAPCOMBOBOX
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/bmpbndl.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
virtual ~wxBitmapComboBoxBase() { }
|
||||
|
||||
// Sets the image for the given item.
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) = 0;
|
||||
|
||||
#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
|
||||
|
||||
@@ -79,7 +79,7 @@ protected:
|
||||
void BCBDoClear();
|
||||
void BCBDoDeleteOneItem(unsigned int n);
|
||||
|
||||
void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
|
||||
void DoSetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap);
|
||||
|
||||
void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
|
||||
void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
|
||||
@@ -87,7 +87,7 @@ protected:
|
||||
wxCoord MeasureItem(size_t item) const;
|
||||
|
||||
// Returns true if image size was affected
|
||||
virtual bool OnAddBitmap(const wxBitmap& bitmap);
|
||||
virtual bool OnAddBitmap(const wxBitmapBundle& bitmap);
|
||||
|
||||
// Recalculates amount of empty space needed in front of text
|
||||
// in control itself. Returns number that can be passed to
|
||||
@@ -97,8 +97,8 @@ protected:
|
||||
|
||||
void UpdateInternals();
|
||||
|
||||
wxArrayPtrVoid m_bitmaps; // Images associated with items
|
||||
wxSize m_usedImgSize; // Size of bitmaps
|
||||
wxVector<wxBitmapBundle> m_bitmapbundles;// Images associated with items
|
||||
wxSize m_usedImgSize; // Size of bitmaps
|
||||
|
||||
int m_imgAreaWidth; // Width and height of area next to text field
|
||||
int m_fontHeight;
|
||||
|
||||
@@ -87,20 +87,20 @@ public:
|
||||
virtual wxString GetStringSelection() const wxOVERRIDE;
|
||||
|
||||
// Adds item with image to the end of the combo box.
|
||||
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle());
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData);
|
||||
|
||||
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
|
||||
// styles, use Append instead.
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData);
|
||||
|
||||
// Sets the image for the given item.
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE;
|
||||
virtual bool SetFont(const wxFont& font) wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
virtual ~wxBitmapComboBox();
|
||||
|
||||
// Sets the image for the given item.
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE;
|
||||
|
||||
// Returns the image of the item with the given index.
|
||||
virtual wxBitmap GetItemBitmap(unsigned int n) const wxOVERRIDE;
|
||||
@@ -93,16 +93,16 @@ public:
|
||||
}
|
||||
|
||||
// Adds item with image to the end of the combo box.
|
||||
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle());
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData);
|
||||
|
||||
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
|
||||
// styles, use Append instead.
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData);
|
||||
|
||||
// Override some wxTextEntry interface.
|
||||
|
||||
@@ -82,21 +82,21 @@ public:
|
||||
virtual ~wxBitmapComboBox();
|
||||
|
||||
// Sets the image for the given item.
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) wxOVERRIDE;
|
||||
|
||||
virtual bool SetFont(const wxFont& font) wxOVERRIDE;
|
||||
|
||||
// Adds item with image to the end of the combo box.
|
||||
int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle());
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
|
||||
int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData);
|
||||
|
||||
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
|
||||
// styles, use Append instead.
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData);
|
||||
int Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData);
|
||||
|
||||
protected:
|
||||
@@ -119,7 +119,7 @@ protected:
|
||||
virtual void DoClear() wxOVERRIDE;
|
||||
virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE;
|
||||
|
||||
virtual bool OnAddBitmap(const wxBitmap& bitmap) wxOVERRIDE;
|
||||
virtual bool OnAddBitmap(const wxBitmapBundle& bitmap) wxOVERRIDE;
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
void RecreateControl();
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@ const char wxBitmapComboBoxNameStr[] = "bitmapComboBox";
|
||||
#define wxBCB_DEFAULT_ITEM_HEIGHT 13
|
||||
|
||||
|
||||
// This macros allows wxArrayPtrVoid to be used in more convenient manner
|
||||
#define GetBitmapPtr(n) ((wxBitmap*)m_bitmaps[n])
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialization
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -68,24 +64,26 @@ void wxBitmapComboBoxBase::UpdateInternals()
|
||||
m_fontHeight = GetControl()->GetCharHeight()
|
||||
+ GetControl()->FromDIP(EXTRA_FONT_HEIGHT);
|
||||
|
||||
while ( m_bitmaps.GetCount() < GetItemContainer()->GetCount() )
|
||||
m_bitmaps.Add( new wxBitmap() );
|
||||
while ( m_bitmapbundles.size() < GetItemContainer()->GetCount() )
|
||||
m_bitmapbundles.push_back( wxBitmapBundle() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Item manipulation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBitmapComboBoxBase::DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
void wxBitmapComboBoxBase::DoSetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
wxCHECK_RET( n < m_bitmaps.size(), "invalid item index" );
|
||||
*GetBitmapPtr(n) = bitmap;
|
||||
wxCHECK_RET( n < m_bitmapbundles.size(), "invalid item index" );
|
||||
m_bitmapbundles.at(n) = bitmap;
|
||||
}
|
||||
|
||||
wxBitmap wxBitmapComboBoxBase::GetItemBitmap(unsigned int n) const
|
||||
{
|
||||
wxCHECK_MSG( n < m_bitmaps.size(), wxNullBitmap, "invalid item index" );
|
||||
return *GetBitmapPtr(n);
|
||||
wxCHECK_MSG( n < m_bitmapbundles.size(), wxNullBitmap, "invalid item index" );
|
||||
return m_bitmapbundles.at(n).GetBitmapFor(
|
||||
const_cast<wxBitmapComboBoxBase*>(this)->GetControl()
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -94,10 +92,7 @@ wxBitmap wxBitmapComboBoxBase::GetItemBitmap(unsigned int n) const
|
||||
|
||||
void wxBitmapComboBoxBase::BCBDoClear()
|
||||
{
|
||||
for ( unsigned i = 0; i < m_bitmaps.size(); i++ )
|
||||
delete GetBitmapPtr(i);
|
||||
|
||||
m_bitmaps.Empty();
|
||||
m_bitmapbundles.clear();
|
||||
|
||||
m_usedImgSize.x = -1;
|
||||
m_usedImgSize.y = -1;
|
||||
@@ -107,20 +102,23 @@ void wxBitmapComboBoxBase::BCBDoClear()
|
||||
|
||||
void wxBitmapComboBoxBase::BCBDoDeleteOneItem(unsigned int n)
|
||||
{
|
||||
delete GetBitmapPtr(n);
|
||||
m_bitmaps.RemoveAt(n);
|
||||
if ( n < m_bitmapbundles.size() )
|
||||
{
|
||||
m_bitmapbundles.erase(m_bitmapbundles.begin() + n);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Preparation and Calculations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBitmapComboBoxBase::OnAddBitmap(const wxBitmap& bitmap)
|
||||
bool wxBitmapComboBoxBase::OnAddBitmap(const wxBitmapBundle& bitmap)
|
||||
{
|
||||
if ( bitmap.IsOk() )
|
||||
{
|
||||
int width = bitmap.GetWidth();
|
||||
int height = bitmap.GetHeight();
|
||||
wxSize bmpDefaultSize = bitmap.GetPreferredLogicalSizeFor(GetControl());
|
||||
int width = bmpDefaultSize.GetWidth();
|
||||
int height = bmpDefaultSize.GetHeight();
|
||||
|
||||
if ( m_usedImgSize.x < 0 )
|
||||
{
|
||||
@@ -157,7 +155,7 @@ int wxBitmapComboBoxBase::DetermineIndent()
|
||||
|
||||
if ( m_usedImgSize.x > 0 )
|
||||
{
|
||||
indent = m_usedImgSize.x
|
||||
indent = GetControl()->FromDIP(m_usedImgSize.x)
|
||||
+ GetControl()->FromDIP(IMAGE_SPACING_LEFT)
|
||||
+ GetControl()->FromDIP(IMAGE_SPACING_RIGHT);
|
||||
m_imgAreaWidth = indent;
|
||||
@@ -208,13 +206,15 @@ void wxBitmapComboBoxBase::DrawItem(wxDC& dc,
|
||||
const wxString& text,
|
||||
int WXUNUSED(flags)) const
|
||||
{
|
||||
const wxBitmap& bmp = *GetBitmapPtr(item);
|
||||
if ( bmp.IsOk() )
|
||||
const wxBitmapBundle& bb = m_bitmapbundles.at(item);
|
||||
if ( bb.IsOk() )
|
||||
{
|
||||
wxCoord w = bmp.GetWidth();
|
||||
wxCoord h = bmp.GetHeight();
|
||||
|
||||
const wxWindow* win = const_cast<wxBitmapComboBoxBase*>(this)->GetControl();
|
||||
wxBitmap bmp = bb.GetBitmapFor(win);
|
||||
|
||||
wxCoord w = bmp.GetLogicalWidth();
|
||||
wxCoord h = bmp.GetLogicalHeight();
|
||||
|
||||
const int imgSpacingLeft = win->FromDIP(IMAGE_SPACING_LEFT);
|
||||
|
||||
// Draw the image centered
|
||||
|
||||
@@ -141,7 +141,7 @@ wxString wxBitmapComboBox::GetStringSelection() const
|
||||
// Item manipulation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
DoSetItemBitmap(n, bitmap);
|
||||
@@ -155,15 +155,12 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
void **clientData, wxClientDataType type)
|
||||
{
|
||||
const unsigned int numItems = items.GetCount();
|
||||
const unsigned int countNew = GetCount() + numItems;
|
||||
|
||||
wxASSERT( numItems == 1 || !HasFlag(wxCB_SORT) ); // Sanity check
|
||||
|
||||
m_bitmaps.Alloc(countNew);
|
||||
|
||||
for ( unsigned int i = 0; i < numItems; i++ )
|
||||
{
|
||||
m_bitmaps.Insert(new wxBitmap(wxNullBitmap), pos + i);
|
||||
m_bitmapbundles.insert(m_bitmapbundles.begin() + pos + i, wxBitmapBundle());
|
||||
}
|
||||
|
||||
const int index = wxOwnerDrawnComboBox::DoInsertItems(items, pos,
|
||||
@@ -178,15 +175,15 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
{
|
||||
// Move pre-inserted empty bitmap into correct position
|
||||
// (usually happens when combo box has wxCB_SORT style)
|
||||
wxBitmap* bmp = static_cast<wxBitmap*>(m_bitmaps[pos]);
|
||||
m_bitmaps.RemoveAt(pos);
|
||||
m_bitmaps.Insert(bmp, index);
|
||||
wxBitmapBundle bmp = m_bitmapbundles.at(pos);
|
||||
m_bitmapbundles.erase(m_bitmapbundles.begin() + pos);
|
||||
m_bitmapbundles.insert(m_bitmapbundles.begin() + index, bmp);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Append(item);
|
||||
if(n != wxNOT_FOUND)
|
||||
@@ -194,7 +191,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
void *clientData)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Append(item, clientData);
|
||||
@@ -203,7 +200,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
wxClientData *clientData)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Append(item, clientData);
|
||||
@@ -213,7 +210,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmapBundle& bitmap,
|
||||
unsigned int pos)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Insert(item, pos);
|
||||
@@ -222,7 +219,7 @@ int wxBitmapComboBox::Insert(const wxString& item,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Insert(item, pos, clientData);
|
||||
@@ -231,7 +228,7 @@ int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData)
|
||||
{
|
||||
const int n = wxOwnerDrawnComboBox::Insert(item, pos, clientData);
|
||||
|
||||
@@ -182,14 +182,15 @@ wxSize wxBitmapComboBox::DoGetBestSize() const
|
||||
// Item manipulation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
if ( bitmap.IsOk() )
|
||||
wxBitmap bmp = bitmap.GetBitmapFor(this);
|
||||
if ( bmp.IsOk() )
|
||||
{
|
||||
if ( m_bitmapSize.x < 0 )
|
||||
{
|
||||
m_bitmapSize.x = bitmap.GetWidth();
|
||||
m_bitmapSize.y = bitmap.GetHeight();
|
||||
m_bitmapSize.x = bmp.GetLogicalWidth();
|
||||
m_bitmapSize.y = bmp.GetLogicalHeight();
|
||||
}
|
||||
|
||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||
@@ -199,7 +200,7 @@ void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
if ( gtk_tree_model_iter_nth_child( model, &iter, NULL, n ) )
|
||||
{
|
||||
wxGtkValue value0( G_TYPE_OBJECT );
|
||||
g_value_set_object( value0, bitmap.GetPixbuf() );
|
||||
g_value_set_object( value0, bmp.GetPixbuf() );
|
||||
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter,
|
||||
m_bitmapCellIndex, value0 );
|
||||
}
|
||||
@@ -230,7 +231,7 @@ wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
const int n = wxComboBox::Append(item);
|
||||
if ( n != wxNOT_FOUND )
|
||||
@@ -238,7 +239,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
void *clientData)
|
||||
{
|
||||
const int n = wxComboBox::Append(item, clientData);
|
||||
@@ -247,7 +248,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
wxClientData *clientData)
|
||||
{
|
||||
const int n = wxComboBox::Append(item, clientData);
|
||||
@@ -257,7 +258,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmapBundle& bitmap,
|
||||
unsigned int pos)
|
||||
{
|
||||
const int n = wxComboBox::Insert(item, pos);
|
||||
@@ -266,7 +267,7 @@ int wxBitmapComboBox::Insert(const wxString& item,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData)
|
||||
{
|
||||
const int n = wxComboBox::Insert(item, pos, clientData);
|
||||
@@ -275,7 +276,7 @@ int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData)
|
||||
{
|
||||
const int n = wxComboBox::Insert(item, pos, clientData);
|
||||
|
||||
@@ -236,7 +236,7 @@ wxSize wxBitmapComboBox::DoGetBestSize() const
|
||||
// Item manipulation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
DoSetItemBitmap(n, bitmap);
|
||||
@@ -245,7 +245,7 @@ void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
const int n = wxComboBox::Append(item);
|
||||
@@ -254,7 +254,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
void *clientData)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
@@ -264,7 +264,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
wxClientData *clientData)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
@@ -275,7 +275,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmapBundle& bitmap,
|
||||
unsigned int pos)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
@@ -285,7 +285,7 @@ int wxBitmapComboBox::Insert(const wxString& item,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, void *clientData)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
@@ -295,7 +295,7 @@ int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
return n;
|
||||
}
|
||||
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
|
||||
int wxBitmapComboBox::Insert(const wxString& item, const wxBitmapBundle& bitmap,
|
||||
unsigned int pos, wxClientData *clientData)
|
||||
{
|
||||
OnAddBitmap(bitmap);
|
||||
@@ -332,16 +332,16 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
}
|
||||
|
||||
// Update the bitmap array.
|
||||
if ( GetCount() > m_bitmaps.Count() )
|
||||
if ( GetCount() > m_bitmapbundles.size() )
|
||||
{
|
||||
wxASSERT_MSG( GetCount() == m_bitmaps.Count() + 1,
|
||||
wxASSERT_MSG( GetCount() == m_bitmapbundles.size() + 1,
|
||||
wxS("Invalid wxBitmapComboBox state") );
|
||||
// Control is in the normal state.
|
||||
// New item has been just added.
|
||||
// Insert bitmap at the given index into the array.
|
||||
wxASSERT_MSG( (size_t)index <= m_bitmaps.Count(),
|
||||
wxASSERT_MSG( (size_t)index <= m_bitmapbundles.size(),
|
||||
wxS("wxBitmapComboBox item index out of bound") );
|
||||
m_bitmaps.Insert(new wxBitmap(wxNullBitmap), index);
|
||||
m_bitmapbundles.insert(m_bitmapbundles.begin() + index, wxBitmapBundle());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -350,7 +350,7 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
// In this case existing bitmaps are reused.
|
||||
// Required and actual indices should be the same to assure
|
||||
// consistency between list of items and bitmap array.
|
||||
wxASSERT_MSG( (size_t)index < m_bitmaps.Count(),
|
||||
wxASSERT_MSG( (size_t)index < m_bitmapbundles.size(),
|
||||
wxS("wxBitmapComboBox item index out of bound") );
|
||||
wxASSERT_MSG( (unsigned int)index == pos+i,
|
||||
wxS("Invalid index for wxBitmapComboBox item") );
|
||||
@@ -359,28 +359,28 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( GetCount() == m_bitmaps.Count() )
|
||||
if ( GetCount() == m_bitmapbundles.size() )
|
||||
{
|
||||
// Control is in the normal state.
|
||||
// Just insert new bitmaps into the array.
|
||||
const unsigned int countNew = GetCount() + numItems;
|
||||
m_bitmaps.Alloc(countNew);
|
||||
m_bitmapbundles.reserve(countNew);
|
||||
|
||||
for ( unsigned int i = 0; i < numItems; i++ )
|
||||
{
|
||||
m_bitmaps.Insert(new wxBitmap(wxNullBitmap), pos + i);
|
||||
m_bitmapbundles.insert(m_bitmapbundles.begin() + pos + i, wxBitmapBundle());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( GetCount() < m_bitmaps.Count(),
|
||||
wxASSERT_MSG( GetCount() < m_bitmapbundles.size(),
|
||||
wxS("Invalid wxBitmapComboBox state") );
|
||||
// There are less items then bitmaps.
|
||||
// (This can happen if control is e.g. recreated with RecreateControl).
|
||||
// In this case existing bitmaps are reused.
|
||||
// The whole block of inserted items should be within the range
|
||||
// of indices of the existing bitmap array.
|
||||
wxASSERT_MSG( pos + numItems <= m_bitmaps.Count(),
|
||||
wxASSERT_MSG( pos + numItems <= m_bitmapbundles.size(),
|
||||
wxS("wxBitmapComboBox item index out of bound") );
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
return index;
|
||||
}
|
||||
|
||||
bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap)
|
||||
bool wxBitmapComboBox::OnAddBitmap(const wxBitmapBundle& bitmap)
|
||||
{
|
||||
if ( wxBitmapComboBoxBase::OnAddBitmap(bitmap) || !GetCount() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user