X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8886b11f2ee42ad2d05a3f896f1b38c1dc7f3f2..c70155b8ee6cdf24966de6bf24370b0454a045ab:/include/wx/gtk/private/gtk2-compat.h?ds=inline diff --git a/include/wx/gtk/private/gtk2-compat.h b/include/wx/gtk/private/gtk2-compat.h index 051f9360d1..5e606a7b54 100644 --- a/include/wx/gtk/private/gtk2-compat.h +++ b/include/wx/gtk/private/gtk2-compat.h @@ -26,7 +26,7 @@ // functions even if GTK_CHECK_VERSION would indicate the function is // already available in GTK+. -#if !GTK_CHECK_VERSION(3,0,0) && !(defined(GTK_DISABLE_DEPRECATED) || defined(GSEAL_ENABLE)) +#ifndef __WXGTK3__ // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.8 @@ -54,6 +54,18 @@ static inline gpointer wx_g_object_ref_sink(gpointer object) } #define g_object_ref_sink wx_g_object_ref_sink +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.12 and GtkAboutDialog itself is not +// in 2.4 so skip this if we don't have it. +#if GTK_CHECK_VERSION(2,6,0) + +static inline void wx_gtk_about_dialog_set_program_name(GtkAboutDialog* about, const gchar* name) +{ + gtk_about_dialog_set_name(about, name); +} +#define gtk_about_dialog_set_program_name wx_gtk_about_dialog_set_program_name +#endif // 2.6.0 + // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.14 @@ -87,6 +99,12 @@ static inline gdouble wx_gtk_adjustment_get_upper(GtkAdjustment* adjustment) } #define gtk_adjustment_get_upper wx_gtk_adjustment_get_upper +static inline void wx_gtk_adjustment_set_page_size(GtkAdjustment* adjustment, gdouble page_size) +{ + adjustment->page_size = page_size; +} +#define gtk_adjustment_set_page_size wx_gtk_adjustment_set_page_size + static inline GtkWidget* wx_gtk_color_selection_dialog_get_color_selection(GtkColorSelectionDialog* csd) { return csd->colorsel; @@ -105,6 +123,12 @@ static inline GtkWidget* wx_gtk_dialog_get_action_area(GtkDialog* dialog) } #define gtk_dialog_get_action_area wx_gtk_dialog_get_action_area +static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry) +{ + return entry->text_length; +} +#define gtk_entry_get_text_length wx_gtk_entry_get_text_length + static inline GtkWidget* wx_gtk_font_selection_dialog_get_cancel_button(GtkFontSelectionDialog* fsd) { return fsd->cancel_button; @@ -117,6 +141,12 @@ static inline GtkWidget* wx_gtk_font_selection_dialog_get_ok_button(GtkFontSelec } #define gtk_font_selection_dialog_get_ok_button wx_gtk_font_selection_dialog_get_ok_button +static inline const guchar* wx_gtk_selection_data_get_data(GtkSelectionData* selection_data) +{ + return selection_data->data; +} +#define gtk_selection_data_get_data wx_gtk_selection_data_get_data + static inline GdkAtom wx_gtk_selection_data_get_data_type(GtkSelectionData* selection_data) { return selection_data->type; @@ -147,6 +177,12 @@ static inline GdkWindow* wx_gtk_widget_get_window(GtkWidget* widget) } #define gtk_widget_get_window wx_gtk_widget_get_window +static inline GtkWidget* wx_gtk_window_get_default_widget(GtkWindow* window) +{ + return window->default_widget; +} +#define gtk_window_get_default_widget wx_gtk_window_get_default_widget + // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.16 @@ -159,6 +195,20 @@ static inline GdkAtom wx_gtk_selection_data_get_selection(GtkSelectionData* sele // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.18 +static inline void wx_gtk_cell_renderer_get_alignment(GtkCellRenderer* cell, gfloat* xalign, gfloat* yalign) +{ + *xalign = cell->xalign; + *yalign = cell->yalign; +} +#define gtk_cell_renderer_get_alignment wx_gtk_cell_renderer_get_alignment + +static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* xpad, gint* ypad) +{ + *xpad = cell->xpad; + *ypad = cell->ypad; +} +#define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding + static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation) { *allocation = widget->allocation; @@ -188,7 +238,7 @@ inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget) inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget) { - return GTK_WIDGET_VISIBLE(widget); + return GTK_WIDGET_SENSITIVE(widget); } #define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive @@ -206,14 +256,14 @@ inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget) } #define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus -inline void wx_gtk_widset_set_can_focus(GtkWidget *widget, gboolean can) +inline void wx_gtk_widget_set_can_focus(GtkWidget *widget, gboolean can) { if ( can ) GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); else GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS); } -#define gtk_widset_set_can_focus wx_gtk_widset_set_can_focus +#define gtk_widget_set_can_focus wx_gtk_widget_set_can_focus inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget) @@ -280,14 +330,110 @@ inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget) } #define gtk_widget_get_mapped wx_gtk_widget_get_mapped +static inline void wx_gtk_widget_get_requisition(GtkWidget* widget, GtkRequisition* requisition) +{ + *requisition = widget->requisition; +} +#define gtk_widget_get_requisition wx_gtk_widget_get_requisition + static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry) { return entry->text_area; } #define gtk_entry_get_text_window wx_gtk_entry_get_text_window -#endif // !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.22 +static inline GdkWindow* wx_gtk_button_get_event_window(GtkButton* button) +{ + return button->event_window; +} +#define gtk_button_get_event_window wx_gtk_button_get_event_window -#endif // _WX_GTK_PRIVATE_COMPAT_H_ +static inline GdkDragAction wx_gdk_drag_context_get_actions(GdkDragContext* context) +{ + return context->actions; +} +#define gdk_drag_context_get_actions wx_gdk_drag_context_get_actions + +static inline GdkDragAction wx_gdk_drag_context_get_selected_action(GdkDragContext* context) +{ + return context->action; +} +#define gdk_drag_context_get_selected_action wx_gdk_drag_context_get_selected_action +static inline GdkDragAction wx_gdk_drag_context_get_suggested_action(GdkDragContext* context) +{ + return context->suggested_action; +} +#define gdk_drag_context_get_suggested_action wx_gdk_drag_context_get_suggested_action + +static inline GList* wx_gdk_drag_context_list_targets(GdkDragContext* context) +{ + return context->targets; +} +#define gdk_drag_context_list_targets wx_gdk_drag_context_list_targets + +static inline gint wx_gdk_visual_get_depth(GdkVisual* visual) +{ + return visual->depth; +} +#define gdk_visual_get_depth wx_gdk_visual_get_depth + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 2.24 + +static inline GdkDisplay* wx_gdk_window_get_display(GdkWindow* window) +{ + return gdk_drawable_get_display(window); +} +#define gdk_window_get_display wx_gdk_window_get_display + +static inline GdkScreen* wx_gdk_window_get_screen(GdkWindow* window) +{ + return gdk_drawable_get_screen(window); +} +#define gdk_window_get_screen wx_gdk_window_get_screen + +static inline gint wx_gdk_window_get_height(GdkWindow* window) +{ + int h; + gdk_drawable_get_size(window, NULL, &h); + return h; +} +#define gdk_window_get_height wx_gdk_window_get_height + +static inline gint wx_gdk_window_get_width(GdkWindow* window) +{ + int w; + gdk_drawable_get_size(window, &w, NULL); + return w; +} +#define gdk_window_get_width wx_gdk_window_get_width + +#if GTK_CHECK_VERSION(2,10,0) +static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window, gdouble x, gdouble y) +{ + gdk_cairo_set_source_pixmap(cr, window, x, y); +} +#define gdk_cairo_set_source_window wx_gdk_cairo_set_source_window +#endif + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.0 + +static inline void wx_gdk_window_get_geometry(GdkWindow* window, gint* x, gint* y, gint* width, gint* height) +{ + gdk_window_get_geometry(window, x, y, width, height, NULL); +} +#define gdk_window_get_geometry wx_gdk_window_get_geometry + +static inline GtkWidget* wx_gtk_tree_view_column_get_button(GtkTreeViewColumn* tree_column) +{ + return tree_column->button; +} +#define gtk_tree_view_column_get_button wx_gtk_tree_view_column_get_button + +#endif // !__WXGTK3__ +#endif // _WX_GTK_PRIVATE_COMPAT_H_