don't use the bitmaps in toolbars with wxTB_NOICONS style
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -380,31 +380,34 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
|
|
||||||
if ( tool->IsButton() )
|
if ( tool->IsButton() )
|
||||||
{
|
{
|
||||||
wxBitmap bitmap = tool->GetNormalBitmap();
|
if ( !HasFlag(wxTB_NOICONS) )
|
||||||
|
{
|
||||||
|
wxBitmap bitmap = tool->GetNormalBitmap();
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
||||||
wxT("invalid bitmap for wxToolBar icon") );
|
wxT("invalid bitmap for wxToolBar icon") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
||||||
wxT("wxToolBar doesn't support GdkBitmap") );
|
wxT("wxToolBar doesn't support GdkBitmap") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
||||||
wxT("wxToolBar::Add needs a wxBitmap") );
|
wxT("wxToolBar::Add needs a wxBitmap") );
|
||||||
|
|
||||||
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
||||||
|
|
||||||
GdkPixmap *pixmap = bitmap.GetPixmap();
|
GdkPixmap *pixmap = bitmap.GetPixmap();
|
||||||
|
|
||||||
GdkBitmap *mask = (GdkBitmap *)NULL;
|
GdkBitmap *mask = (GdkBitmap *)NULL;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
mask = bitmap.GetMask()->GetBitmap();
|
mask = bitmap.GetMask()->GetBitmap();
|
||||||
|
|
||||||
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
||||||
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
||||||
|
|
||||||
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
|
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
|
||||||
|
|
||||||
tool->m_pixmap = tool_pixmap;
|
tool->m_pixmap = tool_pixmap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( tool->GetStyle() )
|
switch ( tool->GetStyle() )
|
||||||
|
@@ -380,31 +380,34 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
|
|
||||||
if ( tool->IsButton() )
|
if ( tool->IsButton() )
|
||||||
{
|
{
|
||||||
wxBitmap bitmap = tool->GetNormalBitmap();
|
if ( !HasFlag(wxTB_NOICONS) )
|
||||||
|
{
|
||||||
|
wxBitmap bitmap = tool->GetNormalBitmap();
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
wxCHECK_MSG( bitmap.Ok(), FALSE,
|
||||||
wxT("invalid bitmap for wxToolBar icon") );
|
wxT("invalid bitmap for wxToolBar icon") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetBitmap() == NULL, FALSE,
|
||||||
wxT("wxToolBar doesn't support GdkBitmap") );
|
wxT("wxToolBar doesn't support GdkBitmap") );
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
wxCHECK_MSG( bitmap.GetPixmap() != NULL, FALSE,
|
||||||
wxT("wxToolBar::Add needs a wxBitmap") );
|
wxT("wxToolBar::Add needs a wxBitmap") );
|
||||||
|
|
||||||
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
GtkWidget *tool_pixmap = (GtkWidget *)NULL;
|
||||||
|
|
||||||
GdkPixmap *pixmap = bitmap.GetPixmap();
|
GdkPixmap *pixmap = bitmap.GetPixmap();
|
||||||
|
|
||||||
GdkBitmap *mask = (GdkBitmap *)NULL;
|
GdkBitmap *mask = (GdkBitmap *)NULL;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
mask = bitmap.GetMask()->GetBitmap();
|
mask = bitmap.GetMask()->GetBitmap();
|
||||||
|
|
||||||
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
tool_pixmap = gtk_pixmap_new( pixmap, mask );
|
||||||
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
|
||||||
|
|
||||||
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
|
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
|
||||||
|
|
||||||
tool->m_pixmap = tool_pixmap;
|
tool->m_pixmap = tool_pixmap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( tool->GetStyle() )
|
switch ( tool->GetStyle() )
|
||||||
|
Reference in New Issue
Block a user