X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b6dd4afdf8d9456dccd0ead2016143708dd6435d..7a12c620935ea4d0711d85213e99f561196c95b7:/include/wx/gtk/private/gtk2-compat.h diff --git a/include/wx/gtk/private/gtk2-compat.h b/include/wx/gtk/private/gtk2-compat.h index f4f74d8e7c..ca4e8832c1 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 @@ -129,18 +129,6 @@ static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry) } #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; -} -#define gtk_font_selection_dialog_get_cancel_button wx_gtk_font_selection_dialog_get_cancel_button - -static inline GtkWidget* wx_gtk_font_selection_dialog_get_ok_button(GtkFontSelectionDialog* fsd) -{ - return fsd->ok_button; -} -#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; @@ -342,9 +330,66 @@ static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry) } #define gtk_entry_get_text_window wx_gtk_entry_get_text_window +// ---------------------------------------------------------------------------- +// 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 + +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 + +static inline gboolean wx_gtk_window_has_group(GtkWindow* window) +{ + return window->group != NULL; +} +#define gtk_window_has_group wx_gtk_window_has_group + // ---------------------------------------------------------------------------- // 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; @@ -361,8 +406,114 @@ static inline gint wx_gdk_window_get_width(GdkWindow* window) } #define gdk_window_get_width wx_gdk_window_get_width -#endif // !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) +#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 -#endif // _WX_GTK_PRIVATE_COMPAT_H_ +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 + +static inline GtkWidget* wx_gtk_box_new(GtkOrientation orientation, gint spacing) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hbox_new(false, spacing); + else + widget = gtk_vbox_new(false, spacing); + return widget; +} +#define gtk_box_new wx_gtk_box_new + +static inline GtkWidget* wx_gtk_button_box_new(GtkOrientation orientation) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hbutton_box_new(); + else + widget = gtk_vbutton_box_new(); + return widget; +} +#define gtk_button_box_new wx_gtk_button_box_new + +static inline GtkWidget* wx_gtk_scale_new(GtkOrientation orientation, GtkAdjustment* adjustment) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hscale_new(adjustment); + else + widget = gtk_vscale_new(adjustment); + return widget; +} +#define gtk_scale_new wx_gtk_scale_new +static inline GtkWidget* wx_gtk_scrollbar_new(GtkOrientation orientation, GtkAdjustment* adjustment) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hscrollbar_new(adjustment); + else + widget = gtk_vscrollbar_new(adjustment); + return widget; +} +#define gtk_scrollbar_new wx_gtk_scrollbar_new + +static inline GtkWidget* wx_gtk_separator_new(GtkOrientation orientation) +{ + GtkWidget* widget; + if (orientation == GTK_ORIENTATION_HORIZONTAL) + widget = gtk_hseparator_new(); + else + widget = gtk_vseparator_new(); + return widget; +} +#define gtk_separator_new wx_gtk_separator_new + +static inline void wx_gtk_widget_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural) +{ + GtkRequisition req; + gtk_widget_size_request(widget, &req); + if (minimum) + *minimum = req.height; + if (natural) + *natural = req.height; +} +#define gtk_widget_get_preferred_height wx_gtk_widget_get_preferred_height + +static inline void wx_gtk_widget_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural) +{ + GtkRequisition req; + gtk_widget_size_request(widget, &req); + if (minimum) + *minimum = req.width; + if (natural) + *natural = req.width; +} +#define gtk_widget_get_preferred_width wx_gtk_widget_get_preferred_width + +static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition* minimum, GtkRequisition* natural) +{ + GtkRequisition* req = minimum; + if (req == NULL) + req = natural; + gtk_widget_size_request(widget, req); +} +#define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size + +#endif // !__WXGTK3__ +#endif // _WX_GTK_PRIVATE_COMPAT_H_