]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private.h
Add lambda-friendly wxDialog::ShowWindowModalThenDo().
[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
77ffb593 7// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 8// Licence: wxWindows licence
9e691f46
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_GTK_PRIVATE_H_
12#define _WX_GTK_PRIVATE_H_
13
9e691f46
VZ
14#include <gtk/gtk.h>
15
b098b621 16#include "wx/gtk/private/string.h"
8bffcd08 17#include "wx/gtk/private/gtk2-compat.h"
9e691f46 18
5f4d1820
VZ
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
27extern const gchar *wx_pango_version_check(int major, int minor, int micro);
28
dd398cd0 29#if wxUSE_UNICODE
527f168b 30 #define wxGTK_CONV(s) (s).utf8_str()
1a6c768b
VZ
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))
30083ad8 34
cc209a51 35 #define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
30083ad8
VZ
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)
dd398cd0 39#else
5851053a
VZ
40 #include "wx/font.h"
41
30083ad8 42 // convert the text between the given encoding and UTF-8 used by wxGTK
be3dc331 43 extern WXDLLIMPEXP_CORE wxCharBuffer
5f11fef5
VZ
44 wxConvertToGTK(const wxString& s,
45 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
46
be3dc331 47 extern WXDLLIMPEXP_CORE wxCharBuffer
30083ad8
VZ
48 wxConvertFromGTK(const wxString& s,
49 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
50
5f11fef5
VZ
51 // helper: use the encoding of the given font if it's valid
52 inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
53 {
a1b806b9 54 return wxConvertToGTK(s, font.IsOk() ? font.GetEncoding()
5f11fef5
VZ
55 : wxFONTENCODING_SYSTEM);
56 }
57
30083ad8
VZ
58 inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
59 {
a1b806b9 60 return wxConvertFromGTK(s, font.IsOk() ? font.GetEncoding()
30083ad8
VZ
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)
1a6c768b
VZ
79 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
80 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
1a6c768b 81 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
30083ad8
VZ
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))
dd398cd0 87#endif
dd398cd0 88
c282e47d
VZ
89// Define a macro for converting wxString to char* in appropriate encoding for
90// the file names.
91#ifdef G_OS_WIN32
92 // Under MSW, UTF-8 file name encodings are always used.
93 #define wxGTK_CONV_FN(s) (s).utf8_str()
94#else
95 // Under Unix use GLib file name encoding (which is also UTF-8 by default
96 // but may be different from it).
97 #define wxGTK_CONV_FN(s) (s).fn_str()
98#endif
99
e8759560
VZ
100// ----------------------------------------------------------------------------
101// various private helper functions
102// ----------------------------------------------------------------------------
103
104namespace wxGTKPrivate
105{
106
107// these functions create the GTK widgets of the specified types which can then
108// used to retrieve their styles, pass them to drawing functions &c
109//
110// the returned widgets shouldn't be destroyed, this is done automatically on
111// shutdown
5c26126c
VZ
112WXDLLIMPEXP_CORE GtkWidget *GetButtonWidget();
113WXDLLIMPEXP_CORE GtkWidget *GetCheckButtonWidget();
114WXDLLIMPEXP_CORE GtkWidget *GetComboBoxWidget();
115WXDLLIMPEXP_CORE GtkWidget *GetEntryWidget();
116WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetFirst();
117WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetLast();
118WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidget();
740dd154 119WXDLLIMPEXP_CORE GtkWidget *GetNotebookWidget();
5c26126c 120WXDLLIMPEXP_CORE GtkWidget *GetRadioButtonWidget();
9dc44eff 121WXDLLIMPEXP_CORE GtkWidget *GetSplitterWidget(wxOrientation orient = wxHORIZONTAL);
5c26126c
VZ
122WXDLLIMPEXP_CORE GtkWidget *GetTextEntryWidget();
123WXDLLIMPEXP_CORE GtkWidget *GetTreeWidget();
e8759560
VZ
124
125} // wxGTKPrivate
126
9e691f46 127#endif // _WX_GTK_PRIVATE_H_