Audacious $Id:Doxyfile42802007-03-2104:39:00Znenolod$
gtk-compat.h
Go to the documentation of this file.
00001 /* Compatibility macros to make supporting multiple GTK versions easier.
00002  * Public domain. */
00003 
00004 #ifndef AUD_GTK_COMPAT_H
00005 #define AUD_GTK_COMPAT_H
00006 
00007 #include <string.h>
00008 
00009 #if defined GDK_KEY_Tab && ! defined GDK_Tab
00010 #include <gdk/gdkkeysyms-compat.h>
00011 #endif
00012 
00013 #if ! GTK_CHECK_VERSION (2, 10, 0)
00014 #define GDK_WINDOW_TYPE_HINT_TOOLTIP GDK_WINDOW_TYPE_HINT_MENU
00015 #define gtk_label_set_line_wrap_mode(...)
00016 #endif
00017 
00018 #if ! GTK_CHECK_VERSION (2, 12, 0)
00019 
00020 static inline void gtk_tree_view_convert_widget_to_bin_window_coords
00021  (GtkTreeView * tree, gint wx, gint wy, gint * bx, gint * by)
00022 {
00023     gint bx0, by0;
00024     gdk_window_get_position (gtk_tree_view_get_bin_window (tree), & bx0, & by0);
00025     * bx = wx - bx0;
00026     * by = wy - by0;
00027 }
00028 
00029 #define gtk_widget_set_tooltip_text(...)
00030 #endif
00031 
00032 #if ! GTK_CHECK_VERSION (2, 14, 0)
00033 #define gtk_adjustment_get_page_size(a) ((a)->page_size)
00034 #define gtk_adjustment_get_upper(a) ((a)->upper)
00035 #define gtk_dialog_get_action_area(d) ((d)->action_area)
00036 #define gtk_dialog_get_content_area(d) ((d)->vbox)
00037 #define gtk_selection_data_get_data(s) ((s)->data)
00038 #define gtk_selection_data_get_length(s) ((s)->length)
00039 #define gtk_widget_get_window(w) ((w)->window)
00040 #endif
00041 
00042 #if ! GTK_CHECK_VERSION (2, 18, 0)
00043 
00044 static inline void gtk_widget_set_can_default (GtkWidget * w, gboolean b)
00045 {
00046     if (b)
00047         GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
00048     else
00049         GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_DEFAULT);
00050 }
00051 
00052 static inline void gtk_widget_set_can_focus (GtkWidget * w, gboolean b)
00053 {
00054     if (b)
00055         GTK_WIDGET_SET_FLAGS (w, GTK_CAN_FOCUS);
00056     else
00057         GTK_WIDGET_UNSET_FLAGS (w, GTK_CAN_FOCUS);
00058 }
00059 
00060 #define gtk_widget_get_allocation(w, a) memcpy ((a), & (w)->allocation, sizeof (GtkAllocation))
00061 #define gtk_widget_get_sensitive GTK_WIDGET_SENSITIVE
00062 #define gtk_widget_get_visible GTK_WIDGET_VISIBLE
00063 #define gtk_widget_is_toplevel GTK_WIDGET_TOPLEVEL
00064 #endif
00065 
00066 #if ! GTK_CHECK_VERSION (2, 20, 0)
00067 #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE
00068 #endif
00069 
00070 #if ! GTK_CHECK_VERSION (3, 0, 0)
00071 
00072 static inline void gdk_window_get_geometry_compat (GdkWindow * win, gint * x,
00073  gint * y, gint * w, gint * h)
00074 {
00075     gdk_window_get_geometry (win, x, y, w, h, NULL);
00076 }
00077 
00078 #define GtkComboBoxText GtkComboBox
00079 #define gdk_window_get_geometry gdk_window_get_geometry_compat
00080 #define gtk_combo_box_text_new gtk_combo_box_new_text
00081 #define gtk_combo_box_text_new_with_entry gtk_combo_box_entry_new_text
00082 #define gtk_combo_box_text_append_text gtk_combo_box_append_text
00083 #endif
00084 
00085 #if GTK_CHECK_VERSION (3, 0, 0)
00086 #define gtk_range_set_update_policy(...)
00087 #endif
00088 
00089 #endif /* AUD_GTK_COMPAT_H */