Deprecate wxGenericImageList::GetBitmapPtr()

This function was in effect deprecated since 2.5.5 (!) and it's not
finally time to do it formally and to stop using it in wxWidgets own
code.
This commit is contained in:
Vadim Zeitlin
2018-10-30 23:15:49 +01:00
parent 61e4534bd2
commit 3b5441f59e
6 changed files with 28 additions and 32 deletions

View File

@@ -47,11 +47,14 @@ public:
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing")
bool Create() { return true; }
wxDEPRECATED_MSG("Use GetBitmap() instead")
const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); }
#endif // WXWIN_COMPATIBILITY_3_0
// Internal use only
const wxBitmap *GetBitmapPtr(int index) const;
private:
const wxBitmap *DoGetPtr(int index) const;
wxObjectList m_images;
// Size of a single bitmap in the list.

View File

@@ -112,7 +112,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour
return Add(wxBitmap(img));
}
const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const
const wxBitmap *wxGenericImageList::DoGetPtr( int index ) const
{
wxObjectList::compatibility_iterator node = m_images.Item( index );
@@ -124,7 +124,7 @@ const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const
// Get the bitmap
wxBitmap wxGenericImageList::GetBitmap(int index) const
{
const wxBitmap* bmp = GetBitmapPtr(index);
const wxBitmap* bmp = DoGetPtr(index);
if (!bmp)
return wxNullBitmap;
@@ -137,7 +137,7 @@ wxBitmap wxGenericImageList::GetBitmap(int index) const
// Get the icon
wxIcon wxGenericImageList::GetIcon(int index) const
{
const wxBitmap* bmp = GetBitmapPtr(index);
const wxBitmap* bmp = DoGetPtr(index);
if (!bmp)
return wxNullIcon;

View File

@@ -284,17 +284,15 @@ bool wxNotebook::SetPageImage( size_t page, int image )
if (image >= 0)
{
wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist");
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(image);
if (bitmap == NULL)
return false;
const wxBitmap bitmap = GetImageList()->GetBitmap(image);
if (pageData->m_image)
{
gtk_image_set_from_pixbuf(
GTK_IMAGE(pageData->m_image), bitmap->GetPixbuf());
GTK_IMAGE(pageData->m_image), bitmap.GetPixbuf());
}
else
{
pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf());
pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
gtk_widget_show(pageData->m_image);
gtk_box_pack_start(GTK_BOX(pageData->m_box),
pageData->m_image, false, false, m_padding);
@@ -443,8 +441,8 @@ bool wxNotebook::InsertPage( size_t position,
{
if (HasImageList())
{
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf());
const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf());
gtk_box_pack_start(GTK_BOX(pageData->m_box),
pageData->m_image, false, false, m_padding);
}

View File

@@ -512,12 +512,12 @@ bool wxNotebook::SetPageImage( size_t page, int image )
wxASSERT( HasImageList() ); /* Just in case */
/* Construct the new pixmap */
const wxBitmap *bmp = GetImageList()->GetBitmapPtr(image);
GdkPixmap *pixmap = bmp->GetPixmap();
const wxBitmap bmp = GetImageList()->GetBitmap(image);
GdkPixmap *pixmap = bmp.GetPixmap();
GdkBitmap *mask = NULL;
if ( bmp->GetMask() )
if ( bmp.GetMask() )
{
mask = bmp->GetMask()->GetBitmap();
mask = bmp.GetMask()->GetBitmap();
}
if (pixmapwid == NULL)
@@ -679,12 +679,12 @@ bool wxNotebook::InsertPage( size_t position,
{
wxASSERT( HasImageList() );
const wxBitmap *bmp = GetImageList()->GetBitmapPtr(imageId);
GdkPixmap *pixmap = bmp->GetPixmap();
const wxBitmap bmp = GetImageList()->GetBitmap(imageId);
GdkPixmap *pixmap = bmp.GetPixmap();
GdkBitmap *mask = NULL;
if ( bmp->GetMask() )
if ( bmp.GetMask() )
{
mask = bmp->GetMask()->GetBitmap();
mask = bmp.GetMask()->GetBitmap();
}
GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );

View File

@@ -329,12 +329,9 @@ bool wxListCtrl::SetItem(wxListItem& info)
{
wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image);
if (bitmap != NULL)
{
// set the new image:
qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
}
const wxBitmap bitmap = imglst->GetBitmap(info.m_image);
// set the new image:
qitem->setIcon( info.GetColumn(), QIcon( *bitmap.GetHandle() ));
}
else
{

View File

@@ -112,11 +112,9 @@ bool wxNotebook::SetPageImage(size_t n, int imageId)
if (imageId >= 0)
{
wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist");
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
if (bitmap == NULL)
return false;
const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
// set the new image:
m_qtTabWidget->setTabIcon( n, QIcon( *bitmap->GetHandle() ));
m_qtTabWidget->setTabIcon( n, QIcon( *bitmap.GetHandle() ));
}
else
{
@@ -137,8 +135,8 @@ bool wxNotebook::InsertPage(size_t n, wxWindow *page, const wxString& text,
{
if (HasImageList())
{
const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId);
m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap->GetHandle() ), wxQtConvertString( text ));
const wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap.GetHandle() ), wxQtConvertString( text ));
}
else
{