Update clang-tidy-check for build options
[geeqie.git] / src / compat.h
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 #ifndef COMPAT_H
22 #define COMPAT_H
23
24 #include <glib.h>
25 #include <gtk/gtk.h>
26
27 #include <config.h>
28
29 /* Some systems (BSD,MacOsX,HP-UX,...) define MAP_ANON and not MAP_ANONYMOUS */
30 #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
31 #define MAP_ANONYMOUS   MAP_ANON
32 #elif defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
33 #define MAP_ANON        MAP_ANONYMOUS
34 #endif
35
36 #if HAVE_GTK4
37         #define gq_gtk_box_pack_end(box, child, expand, fill, padding) gtk_box_append(box, child)
38         #define gq_gtk_box_pack_start(box, child, expand, fill, padding) gtk_box_prepend(box, child)
39         #define gq_gtk_frame_set_shadow_type(frame, type) ;
40         #define gq_gtk_scrolled_window_new(hadjustment, vadjustment) gtk_scrolled_window_new()
41         #define gq_gtk_scrolled_window_set_shadow_type(scrolled_window, type) gtk_scrolled_window_set_has_frame(scrolled_window, TRUE)
42         #define gq_gtk_widget_destroy(widget) gtk_window_destroy(widget)
43         #define gq_gtk_widget_queue_draw_area(widget, x, y, width, height) gtk_widget_queue_draw(widget);
44         #define gq_gtk_widget_show_all(widget) ;
45         #define gq_gtk_window_move(window, x, y) ;
46         #define gq_gtk_window_set_keep_above(window, setting) ;
47         #define gq_gtk_window_set_position(window, position) ;
48 #else
49         #define gq_gtk_box_pack_end(box, child, expand, fill, padding) gtk_box_pack_end(box, child, expand, fill, padding)
50         #define gq_gtk_box_pack_start(box, child, expand, fill, padding) gtk_box_pack_start(box, child, expand, fill, padding)
51         #define gq_gtk_frame_set_shadow_type(frame, type) gtk_frame_set_shadow_type(frame, type)
52         #define gq_gtk_scrolled_window_new(hadjustment, vadjustment) gtk_scrolled_window_new(hadjustment, vadjustment)
53         #define gq_gtk_scrolled_window_set_shadow_type(scrolled_window, type) gtk_scrolled_window_set_shadow_type(scrolled_window, type)
54         #define gq_gtk_widget_destroy(widget) gtk_widget_destroy(widget)
55         #define gq_gtk_widget_queue_draw_area(widget, x, y, width, height) gtk_widget_queue_draw_area(widget, x, y, width, height);
56         #define gq_gtk_widget_show_all(widget) gtk_widget_show_all(widget)
57         #define gq_gtk_window_move(window, x, y) gtk_window_move(window, x, y)
58         #define gq_gtk_window_set_keep_above(window, setting) gtk_window_set_keep_above(window, setting)
59         #define gq_gtk_window_set_position(window, position) gtk_window_set_position(window, position)
60 #endif
61
62 void gq_gtk_container_add(GtkWidget *container, GtkWidget *widget);
63
64 // Hide GtkAction deprecation warnings
65 // @todo Remove after porting to GAction/GMenu
66 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
67 inline gboolean GQ_GTK_IS_RADIO_ACTION(GtkAction *action) { return GTK_IS_RADIO_ACTION(action); }
68 inline gboolean GQ_GTK_IS_TOGGLE_ACTION(GtkAction *action) { return GTK_IS_TOGGLE_ACTION(action); }
69 const auto gq_gtk_action_activate = gtk_action_activate;
70 const auto gq_gtk_action_create_icon = gtk_action_create_icon;
71 const auto gq_gtk_action_get_accel_path = gtk_action_get_accel_path;
72 const auto gq_gtk_action_get_icon_name = gtk_action_get_icon_name;
73 const auto gq_gtk_action_get_name = gtk_action_get_name;
74 const auto gq_gtk_action_get_stock_id = gtk_action_get_stock_id;
75 const auto gq_gtk_action_get_tooltip = gtk_action_get_tooltip;
76 const auto gq_gtk_action_set_sensitive = gtk_action_set_sensitive;
77 const auto gq_gtk_action_set_visible = gtk_action_set_visible;
78 const auto gq_gtk_action_group_add_actions = gtk_action_group_add_actions;
79 const auto gq_gtk_action_group_add_radio_actions = gtk_action_group_add_radio_actions;
80 const auto gq_gtk_action_group_add_toggle_actions = gtk_action_group_add_toggle_actions;
81 const auto gq_gtk_action_group_get_action = gtk_action_group_get_action;
82 const auto gq_gtk_action_group_list_actions = gtk_action_group_list_actions;
83 const auto gq_gtk_action_group_new = gtk_action_group_new;
84 const auto gq_gtk_action_group_set_translate_func = gtk_action_group_set_translate_func;
85 const auto gq_gtk_radio_action_get_current_value = gtk_radio_action_get_current_value;
86 const auto gq_gtk_radio_action_set_current_value = gtk_radio_action_set_current_value;
87 const auto gq_gtk_toggle_action_get_active = gtk_toggle_action_get_active;
88 const auto gq_gtk_toggle_action_set_active = gtk_toggle_action_set_active;
89 const auto gq_gtk_ui_manager_add_ui = gtk_ui_manager_add_ui;
90 const auto gq_gtk_ui_manager_add_ui_from_resource = gtk_ui_manager_add_ui_from_resource;
91 const auto gq_gtk_ui_manager_add_ui_from_string = gtk_ui_manager_add_ui_from_string;
92 const auto gq_gtk_ui_manager_ensure_update = gtk_ui_manager_ensure_update;
93 const auto gq_gtk_ui_manager_get_accel_group = gtk_ui_manager_get_accel_group;
94 const auto gq_gtk_ui_manager_get_action_groups = gtk_ui_manager_get_action_groups;
95 const auto gq_gtk_ui_manager_get_widget = gtk_ui_manager_get_widget;
96 const auto gq_gtk_ui_manager_insert_action_group = gtk_ui_manager_insert_action_group;
97 const auto gq_gtk_ui_manager_new = gtk_ui_manager_new;
98 const auto gq_gtk_ui_manager_new_merge_id = gtk_ui_manager_new_merge_id;
99 const auto gq_gtk_ui_manager_remove_action_group = gtk_ui_manager_remove_action_group;
100 const auto gq_gtk_ui_manager_remove_ui = gtk_ui_manager_remove_ui;
101 const auto gq_gtk_ui_manager_set_add_tearoffs = gtk_ui_manager_set_add_tearoffs;
102 G_GNUC_END_IGNORE_DEPRECATIONS
103
104 #endif /* COMPAT_H */
105 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */