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