1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private.h
3 // Purpose: wxGTK private macros, functions &c
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GTK_PRIVATE_H_
13 #define _WX_GTK_PRIVATE_H_
17 #include "wx/gtk/private/string.h"
18 #include "wx/gtk/private/gtk2-compat.h"
20 // pango_version_check symbol is quite recent ATM (4/2007)... so we
21 // use our own wrapper which implements a smart trick.
22 // Use this function as you'd use pango_version_check:
24 // if (!wx_pango_version_check(1,18,0))
25 // ... call to a function available only in pango >= 1.18 ...
27 // and use it only to test for pango versions >= 1.16.0
28 extern const gchar
*wx_pango_version_check(int major
, int minor
, int micro
);
31 #define wxGTK_CONV(s) s.utf8_str()
32 #define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
33 #define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
34 #define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
36 #define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
37 #define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
38 #define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
39 #define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
43 // convert the text between the given encoding and UTF-8 used by wxGTK
44 extern WXDLLIMPEXP_CORE wxCharBuffer
45 wxConvertToGTK(const wxString
& s
,
46 wxFontEncoding enc
= wxFONTENCODING_SYSTEM
);
48 extern WXDLLIMPEXP_CORE wxCharBuffer
49 wxConvertFromGTK(const wxString
& s
,
50 wxFontEncoding enc
= wxFONTENCODING_SYSTEM
);
52 // helper: use the encoding of the given font if it's valid
53 inline wxCharBuffer
wxConvertToGTK(const wxString
& s
, const wxFont
& font
)
55 return wxConvertToGTK(s
, font
.IsOk() ? font
.GetEncoding()
56 : wxFONTENCODING_SYSTEM
);
59 inline wxCharBuffer
wxConvertFromGTK(const wxString
& s
, const wxFont
& font
)
61 return wxConvertFromGTK(s
, font
.IsOk() ? font
.GetEncoding()
62 : wxFONTENCODING_SYSTEM
);
65 // more helpers: allow passing GTK+ strings directly
67 wxConvertFromGTK(const wxGtkString
& gs
,
68 wxFontEncoding enc
= wxFONTENCODING_SYSTEM
)
70 return wxConvertFromGTK(gs
.c_str(), enc
);
74 wxConvertFromGTK(const wxGtkString
& gs
, const wxFont
& font
)
76 return wxConvertFromGTK(gs
.c_str(), font
);
79 #define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
80 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
81 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
82 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
84 #define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)
85 #define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc))
86 #define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font))
87 #define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s))
90 // ----------------------------------------------------------------------------
91 // various private helper functions
92 // ----------------------------------------------------------------------------
94 namespace wxGTKPrivate
97 // these functions create the GTK widgets of the specified types which can then
98 // used to retrieve their styles, pass them to drawing functions &c
100 // the returned widgets shouldn't be destroyed, this is done automatically on
102 GtkWidget
*GetButtonWidget();
103 GtkWidget
*GetCheckButtonWidget();
104 GtkWidget
*GetComboBoxWidget();
105 GtkWidget
*GetEntryWidget();
106 GtkWidget
*GetHeaderButtonWidgetFirst();
107 GtkWidget
*GetHeaderButtonWidgetLast();
108 GtkWidget
*GetHeaderButtonWidget();
109 GtkWidget
*GetRadioButtonWidget();
110 GtkWidget
*GetSplitterWidget();
111 GtkWidget
*GetTextEntryWidget();
112 GtkWidget
*GetTreeWidget();
116 #endif // _WX_GTK_PRIVATE_H_