avoid deprecated gtk_widget_get_requisition()
This commit is contained in:
@@ -187,15 +187,13 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
|
|||||||
// draw disabled bitmap ourselves, GtkImage has no way to specify it
|
// draw disabled bitmap ourselves, GtkImage has no way to specify it
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
gtk_widget_get_allocation(widget, &alloc);
|
gtk_widget_get_allocation(widget, &alloc);
|
||||||
GtkRequisition req;
|
int x = (alloc.width - bitmap.GetWidth()) / 2;
|
||||||
gtk_widget_get_requisition(widget, &req);
|
int y = (alloc.height - bitmap.GetHeight()) / 2;
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
const int x = (alloc.width - req.width) / 2;
|
|
||||||
const int y = (alloc.height - req.height) / 2;
|
|
||||||
bitmap.Draw(cr, x, y);
|
bitmap.Draw(cr, x, y);
|
||||||
#else
|
#else
|
||||||
const int x = alloc.x + (alloc.width - req.width) / 2;
|
x += alloc.x;
|
||||||
const int y = alloc.y + (alloc.height - req.height) / 2;
|
y += alloc.y;
|
||||||
gdk_draw_pixbuf(
|
gdk_draw_pixbuf(
|
||||||
gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
|
gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
|
||||||
0, 0, x, y,
|
0, 0, x, y,
|
||||||
|
Reference in New Issue
Block a user