]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private.h
Fix signatures of various image handlers methods.
[wxWidgets.git] / include / wx / gtk / private.h
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$
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/gtk/private/string.h"
18
19 // pango_version_check symbol is quite recent ATM (4/2007)... so we
20 // use our own wrapper which implements a smart trick.
21 // Use this function as you'd use pango_version_check:
22 //
23 // if (!wx_pango_version_check(1,18,0))
24 // ... call to a function available only in pango >= 1.18 ...
25 //
26 // and use it only to test for pango versions >= 1.16.0
27 extern const gchar *wx_pango_version_check(int major, int minor, int micro);
28
29 #if wxUSE_UNICODE
30 #define wxGTK_CONV(s) s.utf8_str()
31 #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
32 #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
33 #define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
34
35 #define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
36 #define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
37 #define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
38 #define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
39 #else
40 #include "wx/font.h"
41
42 // convert the text between the given encoding and UTF-8 used by wxGTK
43 extern WXDLLIMPEXP_CORE wxCharBuffer
44 wxConvertToGTK(const wxString& s,
45 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
46
47 extern WXDLLIMPEXP_CORE wxCharBuffer
48 wxConvertFromGTK(const wxString& s,
49 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
50
51 // helper: use the encoding of the given font if it's valid
52 inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
53 {
54 return wxConvertToGTK(s, font.Ok() ? font.GetEncoding()
55 : wxFONTENCODING_SYSTEM);
56 }
57
58 inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
59 {
60 return wxConvertFromGTK(s, font.Ok() ? font.GetEncoding()
61 : wxFONTENCODING_SYSTEM);
62 }
63
64 // more helpers: allow passing GTK+ strings directly
65 inline wxCharBuffer
66 wxConvertFromGTK(const wxGtkString& gs,
67 wxFontEncoding enc = wxFONTENCODING_SYSTEM)
68 {
69 return wxConvertFromGTK(gs.c_str(), enc);
70 }
71
72 inline wxCharBuffer
73 wxConvertFromGTK(const wxGtkString& gs, const wxFont& font)
74 {
75 return wxConvertFromGTK(gs.c_str(), font);
76 }
77
78 #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
79 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
80 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
81 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
82
83 #define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)
84 #define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc))
85 #define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font))
86 #define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s))
87 #endif
88
89 // Some deprecated GTK+ prototypes we still use often
90 // FIXME: Don't use them if possible.
91 extern "C" {
92
93 // Deprecated since GTK+-1.3.7:
94 // Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
95 void gtk_widget_set_uposition (GtkWidget *widget,
96 gint x,
97 gint y);
98
99 // We rely on the allow_shrink parameter in one place
100 void gtk_window_set_policy (GtkWindow *window,
101 gint allow_shrink,
102 gint allow_grow,
103 gint auto_shrink);
104
105 } // extern "C"
106
107
108 // ----------------------------------------------------------------------------
109 // various private helper functions
110 // ----------------------------------------------------------------------------
111
112 namespace wxGTKPrivate
113 {
114
115 // these functions create the GTK widgets of the specified types which can then
116 // used to retrieve their styles, pass them to drawing functions &c
117 //
118 // the returned widgets shouldn't be destroyed, this is done automatically on
119 // shutdown
120 GtkWidget *GetButtonWidget();
121 GtkWidget *GetCheckButtonWidget();
122 GtkWidget *GetComboBoxWidget();
123 GtkWidget *GetEntryWidget();
124 GtkWidget *GetHeaderButtonWidgetFirst();
125 GtkWidget *GetHeaderButtonWidgetLast();
126 GtkWidget *GetHeaderButtonWidget();
127 GtkWidget *GetRadioButtonWidget();
128 GtkWidget *GetSplitterWidget();
129 GtkWidget *GetTextEntryWidget();
130 GtkWidget *GetTreeWidget();
131
132 } // wxGTKPrivate
133
134 #endif // _WX_GTK_PRIVATE_H_
135