]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private.h
Remove method GetWindow() returning a GdkWindow*
[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"
18
19// fail all version tests if the GTK+ version is so ancient that it doesn't
20// even have GTK_CHECK_VERSION
21#ifndef GTK_CHECK_VERSION
22 #define GTK_CHECK_VERSION(a, b, c) 0
23#endif
24
dd398cd0 25#if wxUSE_UNICODE
1a6c768b
VZ
26 #define wxGTK_CONV(s) wxConvUTF8.cWX2MB((s))
27 #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
28 #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
29 #define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
30 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX((s))
dd398cd0 31#else
5851053a
VZ
32 #include "wx/font.h"
33
5f11fef5
VZ
34 // convert the text in given encoding to UTF-8 used by wxGTK
35 extern wxCharBuffer
36 wxConvertToGTK(const wxString& s,
37 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
38
39 // helper: use the encoding of the given font if it's valid
40 inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
41 {
42 return wxConvertToGTK(s, font.Ok() ? font.GetEncoding()
43 : wxFONTENCODING_SYSTEM);
44 }
45
1a6c768b
VZ
46 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
47 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
48 #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
49 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
50 #define wxGTK_CONV_BACK(s) wxConvLocal.cWC2WX(wxConvUTF8.cMB2WC((s)))
dd398cd0 51#endif
dd398cd0 52
1efb5db8
MR
53// Some deprecated GTK+ prototypes we still use often
54// FIXME: Don't use them if possible.
55G_BEGIN_DECLS
56
57// Should use gtk_image_new, but the mask seems to be handled different,
58// and we need to migrate
59GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
60 GdkBitmap *mask);
61
62// Deprecated since GTK+-1.3.7:
63// Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
64void gtk_widget_set_uposition (GtkWidget *widget,
65 gint x,
66 gint y);
67
68// We rely on the allow_shrink parameter in one place
69void gtk_window_set_policy (GtkWindow *window,
70 gint allow_shrink,
71 gint allow_grow,
72 gint auto_shrink);
73
74G_END_DECLS
75
84833214
VZ
76//-----------------------------------------------------------------------------
77// idle system
78//-----------------------------------------------------------------------------
79
80extern void wxapp_install_idle_handler();
81extern bool g_isIdle;
82
35a489dd
MR
83//-----------------------------------------------------------------------------
84// Convenience class for g_freeing a gchar* on scope exit automatically
85//-----------------------------------------------------------------------------
86
87class wxGtkString
88{
89public:
90 explicit wxGtkString(gchar *s) : m_str(s) { }
91 ~wxGtkString() { g_free(m_str); }
92
46cb4b3f
VZ
93 const gchar *c_str() const { return m_str; }
94
35a489dd
MR
95 operator gchar *() const { return m_str; }
96
97private:
98 gchar *m_str;
99
100 DECLARE_NO_COPY_CLASS(wxGtkString)
101};
102
84833214
VZ
103//-----------------------------------------------------------------------------
104// Misc. functions
105//-----------------------------------------------------------------------------
106
224016a8
JS
107// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
108void wxAddGrab(wxWindow* window);
109void wxRemoveGrab(wxWindow* window);
110
66bd83b4 111// Escapes string so that it is valid Pango markup XML string:
20123d49 112WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
66bd83b4 113
abc736fd
MW
114// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
115// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
116// for Solaris 9 x86.
18720210 117#ifdef NEED_GTK_ICON_SIZE_LOOKUP
abc736fd
MW
118extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
119 gint *width,
120 gint *height);
121#endif
122
9e691f46
VZ
123#endif // _WX_GTK_PRIVATE_H_
124