GTK: change wxBitmap to wxBitmapBundle in wxBitmapComboBox

This commit is contained in:
Alexander Koshelev 2022-02-07 17:11:56 +03:00 committed by Vadim Zeitlin
parent d57bc78eea
commit 5e0591b297
2 changed files with 19 additions and 18 deletions

View File

@ -81,7 +81,7 @@ public:
virtual ~wxBitmapComboBox(); virtual ~wxBitmapComboBox();
// Sets the image for the given item. // 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. // Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const wxOVERRIDE; virtual wxBitmap GetItemBitmap(unsigned int n) const wxOVERRIDE;
@ -93,16 +93,16 @@ public:
} }
// Adds item with image to the end of the combo box. // 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 wxBitmapBundle& bitmap = wxBitmapBundle());
int Append(const wxString& item, const wxBitmap& bitmap, void *clientData); int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *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 // Inserts item with image into the list before pos. Not valid for wxCB_SORT
// styles, use Append instead. // styles, use Append instead.
int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos); int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
int Insert(const wxString& item, const wxBitmap& bitmap, int Insert(const wxString& item, const wxBitmapBundle& bitmap,
unsigned int pos, void *clientData); 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); unsigned int pos, wxClientData *clientData);
// Override some wxTextEntry interface. // Override some wxTextEntry interface.

View File

@ -182,14 +182,15 @@ wxSize wxBitmapComboBox::DoGetBestSize() const
// Item manipulation // 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 ) if ( m_bitmapSize.x < 0 )
{ {
m_bitmapSize.x = bitmap.GetWidth(); m_bitmapSize.x = bmp.GetLogicalWidth();
m_bitmapSize.y = bitmap.GetHeight(); m_bitmapSize.y = bmp.GetLogicalHeight();
} }
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); 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 ) ) if ( gtk_tree_model_iter_nth_child( model, &iter, NULL, n ) )
{ {
wxGtkValue value0( G_TYPE_OBJECT ); 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, gtk_list_store_set_value( GTK_LIST_STORE(model), &iter,
m_bitmapCellIndex, value0 ); m_bitmapCellIndex, value0 );
} }
@ -230,7 +231,7 @@ wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const
return bitmap; 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); const int n = wxComboBox::Append(item);
if ( n != wxNOT_FOUND ) if ( n != wxNOT_FOUND )
@ -238,7 +239,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap)
return n; return n;
} }
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap, int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
void *clientData) void *clientData)
{ {
const int n = wxComboBox::Append(item, clientData); const int n = wxComboBox::Append(item, clientData);
@ -247,7 +248,7 @@ int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap,
return n; return n;
} }
int wxBitmapComboBox::Append(const wxString& item, const wxBitmap& bitmap, int wxBitmapComboBox::Append(const wxString& item, const wxBitmapBundle& bitmap,
wxClientData *clientData) wxClientData *clientData)
{ {
const int n = wxComboBox::Append(item, 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, int wxBitmapComboBox::Insert(const wxString& item,
const wxBitmap& bitmap, const wxBitmapBundle& bitmap,
unsigned int pos) unsigned int pos)
{ {
const int n = wxComboBox::Insert(item, pos); const int n = wxComboBox::Insert(item, pos);
@ -266,7 +267,7 @@ int wxBitmapComboBox::Insert(const wxString& item,
return n; 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) unsigned int pos, wxClientData *clientData)
{ {
const int n = wxComboBox::Insert(item, pos, clientData); const int n = wxComboBox::Insert(item, pos, clientData);
@ -275,7 +276,7 @@ int wxBitmapComboBox::Insert(const wxString& item, const wxBitmap& bitmap,
return n; 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) unsigned int pos, void *clientData)
{ {
const int n = wxComboBox::Insert(item, pos, clientData); const int n = wxComboBox::Insert(item, pos, clientData);