]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private.h
don't define wxCRT_xxprintfW function if the corresponding xxprintfw() standard funct...
[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
5f4d1820
VZ
26// pango_version_check symbol is quite recent ATM (4/2007)... so we
27// use our own wrapper which implements a smart trick.
28// Use this function as you'd use pango_version_check:
29//
30// if (!wx_pango_version_check(1,18,0))
31// ... call to a function available only in pango >= 1.18 ...
32//
33// and use it only to test for pango versions >= 1.16.0
34extern const gchar *wx_pango_version_check(int major, int minor, int micro);
35
dd398cd0 36#if wxUSE_UNICODE
6256849f 37 #define wxGTK_CONV(s) s.utf8_str()
1a6c768b
VZ
38 #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
39 #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
40 #define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
30083ad8 41
6256849f 42 #define wxGTK_CONV_BACK(s) wxString::FromUTF8(s)
30083ad8
VZ
43 #define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
44 #define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
45 #define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
dd398cd0 46#else
5851053a
VZ
47 #include "wx/font.h"
48
30083ad8 49 // convert the text between the given encoding and UTF-8 used by wxGTK
be3dc331 50 extern WXDLLIMPEXP_CORE wxCharBuffer
5f11fef5
VZ
51 wxConvertToGTK(const wxString& s,
52 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
53
be3dc331 54 extern WXDLLIMPEXP_CORE wxCharBuffer
30083ad8
VZ
55 wxConvertFromGTK(const wxString& s,
56 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
57
5f11fef5
VZ
58 // helper: use the encoding of the given font if it's valid
59 inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
60 {
61 return wxConvertToGTK(s, font.Ok() ? font.GetEncoding()
62 : wxFONTENCODING_SYSTEM);
63 }
64
30083ad8
VZ
65 inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
66 {
67 return wxConvertFromGTK(s, font.Ok() ? font.GetEncoding()
68 : wxFONTENCODING_SYSTEM);
69 }
70
71 // more helpers: allow passing GTK+ strings directly
72 inline wxCharBuffer
73 wxConvertFromGTK(const wxGtkString& gs,
74 wxFontEncoding enc = wxFONTENCODING_SYSTEM)
75 {
76 return wxConvertFromGTK(gs.c_str(), enc);
77 }
78
79 inline wxCharBuffer
80 wxConvertFromGTK(const wxGtkString& gs, const wxFont& font)
81 {
82 return wxConvertFromGTK(gs.c_str(), font);
83 }
84
85 #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
1a6c768b
VZ
86 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
87 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
1a6c768b 88 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
30083ad8
VZ
89
90 #define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)
91 #define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc))
92 #define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font))
93 #define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s))
dd398cd0 94#endif
dd398cd0 95
1efb5db8
MR
96// Some deprecated GTK+ prototypes we still use often
97// FIXME: Don't use them if possible.
98G_BEGIN_DECLS
99
100// Should use gtk_image_new, but the mask seems to be handled different,
101// and we need to migrate
102GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
103 GdkBitmap *mask);
104
105// Deprecated since GTK+-1.3.7:
106// Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
107void gtk_widget_set_uposition (GtkWidget *widget,
108 gint x,
109 gint y);
110
111// We rely on the allow_shrink parameter in one place
112void gtk_window_set_policy (GtkWindow *window,
113 gint allow_shrink,
114 gint allow_grow,
115 gint auto_shrink);
116
117G_END_DECLS
118
84833214
VZ
119//-----------------------------------------------------------------------------
120// Misc. functions
121//-----------------------------------------------------------------------------
122
224016a8
JS
123// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
124void wxAddGrab(wxWindow* window);
125void wxRemoveGrab(wxWindow* window);
126
66bd83b4 127// Escapes string so that it is valid Pango markup XML string:
20123d49 128WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
66bd83b4 129
abc736fd
MW
130// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
131// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
132// for Solaris 9 x86.
18720210 133#ifdef NEED_GTK_ICON_SIZE_LOOKUP
abc736fd
MW
134extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
135 gint *width,
136 gint *height);
137#endif
138
bcf881ef
JS
139#ifdef __WXGTK20__
140#include <gdk/gdktypes.h>
141
142// Returns stock accelerator modifier and key code for the given ID
143WXDLLEXPORT bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key);
144#endif
145
9e691f46
VZ
146#endif // _WX_GTK_PRIVATE_H_
147