1/////////////////////////////////////////////////////////////////////////////// 2// Name: wx/gtk/private.h 3// Purpose: wxGTK private macros, functions &c 4// Author: Vadim Zeitlin 5// Modified by: 6// Created: 12.03.02 7// RCS-ID: $Id: private.h 47188 2007-07-06 07:44:19Z MW $ 8// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> 9// Licence: wxWindows licence 10/////////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_GTK_PRIVATE_H_ 13#define _WX_GTK_PRIVATE_H_ 14 15#include <gtk/gtk.h> 16 17#include "wx/event.h" 18#include "wx/gtk/private/string.h" 19 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 24#endif 25 26#if wxUSE_UNICODE 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)) 32#elif wxUSE_WCHAR_T 33 #include "wx/font.h" 34 35 // convert the text in given encoding to UTF-8 used by wxGTK 36 WXDLLIMPEXP_CORE extern wxCharBuffer 37 wxConvertToGTK(const wxString& s, 38 wxFontEncoding enc = wxFONTENCODING_SYSTEM); 39 40 // helper: use the encoding of the given font if it's valid 41 inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font) 42 { 43 return wxConvertToGTK(s, font.Ok() ? font.GetEncoding() 44 : wxFONTENCODING_SYSTEM); 45 } 46 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))) 52#else // we're limited to ASCII 53 #define wxGTK_CONV_ENC(s, enc) (s) 54 #define wxGTK_CONV_FONT(s, font) (s) 55 #define wxGTK_CONV(s) (s) 56 #define wxGTK_CONV_SYS(s) (s) 57 #define wxGTK_CONV_BACK(s) (wxString(s)) 58#endif 59 60// Some deprecated GTK+ prototypes we still use often 61// FIXME: Don't use them if possible. 62G_BEGIN_DECLS 63 64// Should use gtk_image_new, but the mask seems to be handled different, 65// and we need to migrate 66GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap, 67 GdkBitmap *mask); 68 69// Deprecated since GTK+-1.3.7: 70// Trivial wrapper around gtk_window_move, with some side effects we seem to rely on 71void gtk_widget_set_uposition (GtkWidget *widget, 72 gint x, 73 gint y); 74 75// We rely on the allow_shrink parameter in one place 76void gtk_window_set_policy (GtkWindow *window, 77 gint allow_shrink, 78 gint allow_grow, 79 gint auto_shrink); 80 81G_END_DECLS 82 83//----------------------------------------------------------------------------- 84// idle system 85//----------------------------------------------------------------------------- 86 87extern void wxapp_install_idle_handler(); 88extern bool g_isIdle; 89 90//----------------------------------------------------------------------------- 91// Misc. functions 92//----------------------------------------------------------------------------- 93 94// Needed for implementing e.g. combobox on wxGTK within a modal dialog. 95void wxAddGrab(wxWindow* window); 96void wxRemoveGrab(wxWindow* window); 97 98// Escapes string so that it is valid Pango markup XML string: 99WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str); 100 101// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in 102// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS 103// for Solaris 9 x86. 104#ifdef NEED_GTK_ICON_SIZE_LOOKUP 105extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size, 106 gint *width, 107 gint *height); 108#endif 109 110#ifdef __WXGTK20__ 111#include <gdk/gdktypes.h> 112 113// Returns stock accelerator modifier and key code for the given ID 114WXDLLEXPORT bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key); 115#endif 116 117#endif // _WX_GTK_PRIVATE_H_ 118 119