]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private.h
implemented ScrollLines/Pages() for all classes in wxGTK, not just wxTextCtrl (patch...
[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
RR
25#if wxUSE_UNICODE
26 #define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
27 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
28#else
29 #define wxGTK_CONV(s) wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC(s) )
30 #define wxGTK_CONV_BACK(s) wxConvLocal.cWC2WX( (wxConvUTF8.cMB2WC( s ) ) )
31#endif
dd398cd0 32
bdbd4e96 33// FIXME: Make gtk2 only, so no macros needed - MR
dd398cd0
RR
34// GTK+ 2.0 compatibility define is broken when used from C++ as it
35// casts enum to int implicitly
bdbd4e96
MR
36#undef gtk_signal_disconnect_by_func
37#define gtk_signal_disconnect_by_func(object,func,data) \
38 gtk_signal_compat_matched((object), (func), (data), \
39 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
40 G_SIGNAL_MATCH_DATA), 0)
9e691f46 41
9e691f46
VZ
42// translate a GTK+ scroll type to a wxEventType
43inline wxEventType GtkScrollTypeToWx(guint scrollType)
44{
45 wxEventType command;
46 switch ( scrollType )
47 {
48 case GTK_SCROLL_STEP_BACKWARD:
49 command = wxEVT_SCROLL_LINEUP;
50 break;
51
52 case GTK_SCROLL_STEP_FORWARD:
53 command = wxEVT_SCROLL_LINEDOWN;
54 break;
55
56 case GTK_SCROLL_PAGE_BACKWARD:
57 command = wxEVT_SCROLL_PAGEUP;
58 break;
59
60 case GTK_SCROLL_PAGE_FORWARD:
61 command = wxEVT_SCROLL_PAGEDOWN;
62 break;
63
64 default:
65 command = wxEVT_SCROLL_THUMBTRACK;
66 }
67
68 return command;
69}
70
71inline wxEventType GtkScrollWinTypeToWx(guint scrollType)
72{
73 // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
74 return GtkScrollTypeToWx(scrollType) +
75 wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP;
76}
77
224016a8
JS
78// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
79void wxAddGrab(wxWindow* window);
80void wxRemoveGrab(wxWindow* window);
81
66bd83b4 82// Escapes string so that it is valid Pango markup XML string:
20123d49 83WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
66bd83b4 84
abc736fd
MW
85// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
86// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
87// for Solaris 9 x86.
18720210 88#ifdef NEED_GTK_ICON_SIZE_LOOKUP
abc736fd
MW
89extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
90 gint *width,
91 gint *height);
92#endif
93
9e691f46
VZ
94#endif // _WX_GTK_PRIVATE_H_
95