Convert GET_{LEFT,RIGHT}_PIXBUF_OFFSET macro to function
[geeqie.git] / src / compat.cc
1 /*
2  * Copyright (C) 2008 - 2016 The Geeqie Team
3  *
4  * Authors: Vladimir Nadvornik, Laurent Monin
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #include "compat.h"
22
23 #include <config.h>
24
25 #if HAVE_GTK4
26 void gq_gtk_container_add(GtkWidget *container, GtkWidget *widget)
27 {
28         if (GTK_IS_BUTTON(container))
29                 {
30                 gtk_button_set_child(GTK_BUTTON(container), widget);
31                 }
32         else if (GTK_IS_BUTTON_BOX(container))
33                 {
34                 gtk_box_set_child(GTK_BUTTON_BOX(container), widget);
35                 }
36         else if (GTK_IS_EXPANDER(container))
37                 {
38                 gtk_expander_set_child(GTK_EXPANDER(container), widget);
39                 }
40         else if (GTK_IS_FRAME(container))
41                 {
42                 gtk_frame_set_child(GTK_FRAME(container), widget);
43                 }
44         else if (GTK_IS_MENU_ITEM(container))
45                 {
46                 gtk_frame_set_child(container, widget); /* @FIXME GTK4 menu */
47                 }
48         else if (GTK_IS_POPOVER(container))
49                 {
50                 gtk_popover_set_child(GTK_POPOVER(container), widget);
51                 }
52         else if (GTK_IS_TOGGLE_BUTTON(container))
53                 {
54                 gtk_toggle_button_set_child(GTK_TOGGLE_BUTTON(container), widget);
55                 }
56         else if (GTK_IS_TOOLBAR(container))
57                 {
58                 gtk_toolbar_set_child(GTK_TOOLBAR(container), widget);
59                 }
60         else if (GTK_IS_VIEWPORT(container))
61                 {
62                 gtk_viewport_set_child(GTK_VIEWPORT(container), widget);
63                 }
64         else if (GTK_IS_WINDOW(container))
65                 {
66                 gtk_window_set_child(GTK_WINDOW(container), widget);
67                 }
68         else
69                 {
70                 g_abort();
71                 }
72 }
73 #else
74 void gq_gtk_container_add(GtkWidget *container, GtkWidget *widget)
75 {
76         gtk_container_add(reinterpret_cast<GtkContainer *>(container), widget);
77 }
78 #endif
79 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */