]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private.h
cleanup - reformatting
[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/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
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
32
33 // FIXME: Make gtk2 only, so no macros needed - MR
34 // GTK+ 2.0 compatibility define is broken when used from C++ as it
35 // casts enum to int implicitly
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)
41
42 // translate a GTK+ scroll type to a wxEventType
43 inline 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
71 inline 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
78 // Needed for implementing e.g. combobox on wxGTK within a modal dialog.
79 void wxAddGrab(wxWindow* window);
80 void wxRemoveGrab(wxWindow* window);
81
82 // Escapes string so that it is valid Pango markup XML string:
83 WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
84
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.
88 #ifdef NEED_GTK_ICON_SIZE_LOOKUP
89 extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
90 gint *width,
91 gint *height);
92 #endif
93
94 #endif // _WX_GTK_PRIVATE_H_
95