1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private.h
3 // Purpose: wxGTK private macros, functions &c
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GTK_PRIVATE_H_
13 #define _WX_GTK_PRIVATE_H_
18 #include "wx/gtk/private/string.h"
20 // fail all version tests if the GTK+ version is so ancient that it doesn't
21 // even have GTK_CHECK_VERSION
22 #ifndef GTK_CHECK_VERSION
23 #define GTK_CHECK_VERSION(a, b, c) 0
27 #define wxGTK_CONV(s) wxConvUTF8.cWX2MB((s))
28 #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
29 #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
30 #define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
31 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX((s))
35 // convert the text in given encoding to UTF-8 used by wxGTK
37 wxConvertToGTK(const wxString
& s
,
38 wxFontEncoding enc
= wxFONTENCODING_SYSTEM
);
40 // helper: use the encoding of the given font if it's valid
41 inline wxCharBuffer
wxConvertToGTK(const wxString
& s
, const wxFont
& font
)
43 return wxConvertToGTK(s
, font
.Ok() ? font
.GetEncoding()
44 : wxFONTENCODING_SYSTEM
);
47 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
48 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
49 #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
50 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
51 #define wxGTK_CONV_BACK(s) wxConvLocal.cWC2WX(wxConvUTF8.cMB2WC((s)))
54 // Some deprecated GTK+ prototypes we still use often
55 // FIXME: Don't use them if possible.
58 // Should use gtk_image_new, but the mask seems to be handled different,
59 // and we need to migrate
60 GtkWidget
* gtk_pixmap_new (GdkPixmap
*pixmap
,
63 // Deprecated since GTK+-1.3.7:
64 // Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
65 void gtk_widget_set_uposition (GtkWidget
*widget
,
69 // We rely on the allow_shrink parameter in one place
70 void gtk_window_set_policy (GtkWindow
*window
,
77 //-----------------------------------------------------------------------------
79 //-----------------------------------------------------------------------------
81 extern void wxapp_install_idle_handler();
84 //-----------------------------------------------------------------------------
86 //-----------------------------------------------------------------------------
88 // Needed for implementing e.g. combobox on wxGTK within a modal dialog.
89 void wxAddGrab(wxWindow
* window
);
90 void wxRemoveGrab(wxWindow
* window
);
92 // Escapes string so that it is valid Pango markup XML string:
93 WXDLLIMPEXP_CORE wxString
wxEscapeStringForPangoMarkup(const wxString
& str
);
95 // The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
96 // GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
98 #ifdef NEED_GTK_ICON_SIZE_LOOKUP
99 extern "C" gboolean
gtk_icon_size_lookup (GtkIconSize size
,
104 #endif // _WX_GTK_PRIVATE_H_