wxWidgets/include/wx/gtk/private/gtk3-compat.h
2017-12-19 09:41:26 -08:00

65 lines
1.8 KiB
C

///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/gtk3-compat.h
// Purpose: Compatibility code for older GTK+ 3 versions
// Author: Paul Cornett
// Created: 2015-10-10
// Copyright: (c) 2015 Paul Cornett
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_COMPAT3_H_
#define _WX_GTK_PRIVATE_COMPAT3_H_
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
#ifndef __WXGTK4__
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 3.20
static inline gboolean wx_gtk_text_iter_starts_tag(const GtkTextIter* iter, GtkTextTag* tag)
{
return gtk_text_iter_begins_tag(iter, tag);
}
#define gtk_text_iter_starts_tag wx_gtk_text_iter_starts_tag
#ifdef __WXGTK3__
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 3.12
static inline void wx_gtk_widget_set_margin_start(GtkWidget* widget, gint margin)
{
gtk_widget_set_margin_left(widget, margin);
}
#define gtk_widget_set_margin_start wx_gtk_widget_set_margin_start
static inline void wx_gtk_widget_set_margin_end(GtkWidget* widget, gint margin)
{
gtk_widget_set_margin_right(widget, margin);
}
#define gtk_widget_set_margin_end wx_gtk_widget_set_margin_end
#endif // __WXGTK3__
#endif // !__WXGTK4__
wxGCC_WARNING_RESTORE()
#if defined(__WXGTK4__) || !defined(__WXGTK3__)
static inline bool wx_is_at_least_gtk3(int /* minor */)
{
#ifdef __WXGTK4__
return true;
#else
return false;
#endif
}
#else
static inline bool wx_is_at_least_gtk3(int minor)
{
return gtk_check_version(3, minor, 0) == NULL;
}
#endif
#endif // _WX_GTK_PRIVATE_COMPAT3_H_