Use icons set with SetImages() in Mac wxNotebook implementation
Use GetBitmapBundle(), via a helper GetPageBitmapBundle() function which is going to be useful elsewhere too, rather than GetImageList(), as the latter only works if the images were set using SetImageList(), while the new version does the right thing both in this case and when the images were set using SetImages().
This commit is contained in:
@@ -229,6 +229,15 @@ public:
|
|||||||
// returns true if the platform should explicitly apply a theme border
|
// returns true if the platform should explicitly apply a theme border
|
||||||
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; }
|
||||||
|
|
||||||
|
|
||||||
|
// Implementation only from now on.
|
||||||
|
|
||||||
|
// Returns an empty bundle if no image is specified for this page.
|
||||||
|
wxBitmapBundle GetPageBitmapBundle(size_t n) const
|
||||||
|
{
|
||||||
|
return GetBitmapBundle(GetPageImage(n));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// flags for DoSetSelection()
|
// flags for DoSetSelection()
|
||||||
enum
|
enum
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/private/bmpbndl.h"
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -266,13 +266,11 @@ public:
|
|||||||
[item setView:page->GetHandle() ];
|
[item setView:page->GetHandle() ];
|
||||||
wxCFStringRef cf( page->GetLabel() , notebook.GetFont().GetEncoding() );
|
wxCFStringRef cf( page->GetLabel() , notebook.GetFont().GetEncoding() );
|
||||||
[item setLabel:cf.AsNSString()];
|
[item setLabel:cf.AsNSString()];
|
||||||
if ( notebook.GetImageList() && notebook.GetPageImage(i) >= 0 )
|
|
||||||
|
const wxBitmapBundle bitmap = notebook.GetPageBitmapBundle(i);
|
||||||
|
if ( bitmap.IsOk() )
|
||||||
{
|
{
|
||||||
const wxBitmap bmap = notebook.GetImageList()->GetBitmap( notebook.GetPageImage( i ) ) ;
|
[(WXCTabViewImageItem*) item setImage: wxOSXGetImageFromBundle(bitmap)];
|
||||||
if ( bmap.IsOk() )
|
|
||||||
{
|
|
||||||
[(WXCTabViewImageItem*) item setImage: bmap.GetNSImage()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user