1 #ifndef __SUPPORT_H 2 #define __SUPPORT_H 3 4 #ifdef HAVE_CONFIG_H 5 # include <config.h> 6 #endif 7 8 #include <gtk/gtk.h> 9 #if GTK_CHECK_VERSION(3,0,0) 10 #include <gdk/gdkkeysyms-compat.h> 11 #else 12 #include <gdk/gdkkeysyms.h> 13 #endif 14 15 /* 16 * Standard gettext macros. 17 */ 18 #ifdef ENABLE_NLS 19 # include <libintl.h> 20 # undef _ 21 # define _(String) dgettext (PACKAGE, String) 22 # define Q_(String) g_strip_context ((String), gettext (String)) 23 # ifdef gettext_noop 24 # define N_(String) gettext_noop (String) 25 # else 26 # define N_(String) (String) 27 # endif 28 #else 29 # define textdomain(String) (String) 30 # define gettext(String) (String) 31 # define dgettext(Domain,Message) (Message) 32 # define dcgettext(Domain,Message,Type) (Message) 33 # define bindtextdomain(Domain,Directory) (Domain) 34 #ifndef _ 35 # define _(String) (String) 36 #endif 37 # define Q_(String) g_strip_context ((String), (String)) 38 # define N_(String) (String) 39 #endif 40 41 42 /* 43 * Public Functions. 44 */ 45 46 /* 47 * This function returns a widget in a component created by Glade. 48 * Call it with the toplevel widget in the component (i.e. a window/dialog), 49 * or alternatively any widget in the component, and the name of the widget 50 * you want returned. 51 */ 52 GtkWidget* lookup_widget (GtkWidget *widget, 53 const gchar *widget_name); 54 55 56 /* Use this function to set the directory containing installed pixmaps. */ 57 void add_pixmap_directory (const gchar *directory); 58 59 60 /* 61 * Private Functions. 62 */ 63 64 /* This is used to create the pixmaps used in the interface. */ 65 GtkWidget* create_pixmap (GtkWidget *widget, 66 const gchar *filename); 67 68 /* This is used to create the pixbufs used in the interface. */ 69 GdkPixbuf* create_pixbuf (const gchar *filename); 70 71 /* This is used to set ATK action descriptions. */ 72 void glade_set_atk_action_description (AtkAction *action, 73 const gchar *action_name, 74 const gchar *description); 75 76 #if GTK_CHECK_VERSION(3,0,0) 77 GtkWidget * 78 gtk_combo_box_entry_new_text(void); 79 80 void 81 gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has); 82 #endif 83 84 #if !GTK_CHECK_VERSION(2,20,0) 85 #define gtk_widget_set_realized(widget, realized) {if (realized) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);} 86 #define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED (widget)) 87 #endif 88 89 #if !GTK_CHECK_VERSION(2,22,0) 90 GdkDragAction 91 gdk_drag_context_get_selected_action (GdkDragContext *context); 92 GList * 93 gdk_drag_context_list_targets (GdkDragContext *context); 94 #endif 95 96 #if !GTK_CHECK_VERSION(2,24,0) 97 #define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX 98 typedef GtkComboBox GtkComboBoxText; 99 GtkWidget *gtk_combo_box_text_new (); 100 GtkWidget *gtk_combo_box_text_new_with_entry (void); 101 void gtk_combo_box_text_append_text (GtkComboBoxText *combo_box, const gchar *text); 102 void gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, gint position, const gchar *text); 103 void gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box, const gchar *text); 104 gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); 105 #endif 106 107 #if !GTK_CHECK_VERSION(2,14,0) 108 #define gtk_widget_get_window(widget) ((widget)->window) 109 #define gtk_selection_data_get_target(data) (data->target) 110 #define gtk_dialog_get_content_area(dialog) (dialog->vbox) 111 #define gtk_dialog_get_action_area(dialog) (dialog->action_area) 112 #define gtk_selection_data_get_data(data) (data->data) 113 #define gtk_selection_data_get_length(data) (data->length) 114 #define gtk_selection_data_get_format(data) (data->format) 115 #define gtk_adjustment_get_lower(adj) (adj->lower) 116 #define gtk_adjustment_get_upper(adj) (adj->upper) 117 #endif 118 119 #if !GTK_CHECK_VERSION(2,18,0) 120 #define gtk_widget_set_has_window(widget, has_window) \ 121 if (has_window) GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW); \ 122 else GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW); 123 124 #define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE(widget)) 125 #define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW(widget)) 126 void gtk_widget_set_window(GtkWidget *widget, GdkWindow *window); 127 #endif 128 129 130 #if !GTK_CHECK_VERSION(2,18,0) 131 void gtk_widget_set_allocation (GtkWidget *widget, 132 const GtkAllocation *allocation); 133 134 void gtk_widget_get_allocation (GtkWidget *widget, 135 GtkAllocation *allocation); 136 137 #define gtk_widget_set_can_focus(widget, canfocus) {if (canfocus) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);} 138 139 #define gtk_widget_get_can_focus(widget) (GTK_WIDGET_CAN_FOCUS (widget)); 140 141 #define gtk_widget_set_can_default(widget, candefault) {if (candefault) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT);} 142 143 #define gtk_widget_get_can_default(widget) (GTK_WIDGET_CAN_DEFAULT (widget)); 144 #endif 145 146 #endif 147