]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private.h
adding measuring contexts, streamlining printing code
[wxWidgets.git] / include / wx / gtk / private.h
CommitLineData
9e691f46
VZ
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$
77ffb593 8// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 9// Licence: wxWindows licence
9e691f46
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GTK_PRIVATE_H_
13#define _WX_GTK_PRIVATE_H_
14
9e691f46
VZ
15#include <gtk/gtk.h>
16
17#include "wx/event.h"
b098b621 18#include "wx/gtk/private/string.h"
9e691f46
VZ
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
dd398cd0 26#if wxUSE_UNICODE
1a6c768b
VZ
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))
dd398cd0 32#else
5851053a
VZ
33 #include "wx/font.h"
34
5f11fef5
VZ
35 // convert the text in given encoding to UTF-8 used by wxGTK
36 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
1a6c768b
VZ
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)))
dd398cd0 52#endif
dd398cd0 53
1efb5db8
MR
54// Some deprecated GTK+ prototypes we still use often
55// FIXME: Don't use them if possible.
56G_BEGIN_DECLS
57
58// Should use gtk_image_new, but the mask seems to be handled different,
59// and we need to migrate
60GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
61 GdkBitmap *mask);
62
63// Deprecated since GTK+-1.3.7:
64// Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
65void gtk_widget_set_uposition (GtkWidget *widget,
66 gint x,
67 gint y);
68
69// We rely on the allow_shrink parameter in one place
70void gtk_window_set_policy (GtkWindow *window,
71 gint allow_shrink,
72 gint allow_grow,
73 gint auto_shrink);
74
75G_END_DECLS
76
84833214
VZ
77//-----------------------------------------------------------------------------
78// idle system
79//-----------------------------------------------------------------------------
80
81extern void wxapp_install_idle_handler();
82extern bool g_isIdle;
83
84833214
VZ
84//-----------------------------------------------------------------------------
85// Misc. functions
86//-----------------------------------------------------------------------------
87
224016a8
JS
88// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
89void wxAddGrab(wxWindow* window);
90void wxRemoveGrab(wxWindow* window);
91
66bd83b4 92// Escapes string so that it is valid Pango markup XML string:
20123d49 93WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
66bd83b4 94
abc736fd
MW
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
97// for Solaris 9 x86.
18720210 98#ifdef NEED_GTK_ICON_SIZE_LOOKUP
abc736fd
MW
99extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
100 gint *width,
101 gint *height);
102#endif
103
bcf881ef
JS
104#ifdef __WXGTK20__
105#include <gdk/gdktypes.h>
106
107// Returns stock accelerator modifier and key code for the given ID
108WXDLLEXPORT bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key);
109#endif
110
9e691f46
VZ
111#endif // _WX_GTK_PRIVATE_H_
112