]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/private.h
use virtual size for the size of the buffer when wxBUFFER_VIRTUAL_AREA style is used
[wxWidgets.git] / include / wx / gtk / private.h
... / ...
CommitLineData
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/event.h"
18#include "wx/gtk/private/string.h"
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
26#if wxUSE_UNICODE
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))
31
32 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX((s))
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)
36#else
37 #include "wx/font.h"
38
39 // convert the text between the given encoding and UTF-8 used by wxGTK
40 extern wxCharBuffer
41 wxConvertToGTK(const wxString& s,
42 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
43
44 extern wxCharBuffer
45 wxConvertFromGTK(const wxString& s,
46 wxFontEncoding enc = wxFONTENCODING_SYSTEM);
47
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
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)
76 #define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
77 #define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
78 #define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
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))
84#endif
85
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
109//-----------------------------------------------------------------------------
110// idle system
111//-----------------------------------------------------------------------------
112
113extern void wxapp_install_idle_handler();
114extern bool g_isIdle;
115
116//-----------------------------------------------------------------------------
117// Misc. functions
118//-----------------------------------------------------------------------------
119
120// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
121void wxAddGrab(wxWindow* window);
122void wxRemoveGrab(wxWindow* window);
123
124// Escapes string so that it is valid Pango markup XML string:
125WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
126
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.
130#ifdef NEED_GTK_ICON_SIZE_LOOKUP
131extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
132 gint *width,
133 gint *height);
134#endif
135
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
143#endif // _WX_GTK_PRIVATE_H_
144