Disabled bitmaps of toolbar tools are now rendered at the correct position if using GTK3. Extend toolbar sample to include a button with a custom disabled bitmap.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Tim Kosse
2014-06-30 18:41:30 +00:00
parent 73052bd106
commit 68bd393b27
2 changed files with 8 additions and 3 deletions

View File

@@ -189,11 +189,13 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
gtk_widget_get_allocation(widget, &alloc);
GtkRequisition req;
gtk_widget_get_requisition(widget, &req);
const int x = alloc.x + (alloc.width - req.width) / 2;
const int y = alloc.y + (alloc.height - req.height) / 2;
#ifdef __WXGTK3__
const int x = (alloc.width - req.width) / 2;
const int y = (alloc.height - req.height) / 2;
bitmap.Draw(cr, x, y);
#else
const int x = alloc.x + (alloc.width - req.width) / 2;
const int y = alloc.y + (alloc.height - req.height) / 2;
gdk_draw_pixbuf(
gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
0, 0, x, y,