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_
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
27 #define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
28 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
30 #define wxGTK_CONV(s) wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC(s) )
31 #define wxGTK_CONV_BACK(s) wxConvLocal.cWC2WX( (wxConvUTF8.cMB2WC( s ) ) )
34 // FIXME: Make gtk2 only, so no macros needed - MR
35 // GTK+ 2.0 compatibility define is broken when used from C++ as it
36 // casts enum to int implicitly
37 #undef gtk_signal_disconnect_by_func
38 #define gtk_signal_disconnect_by_func(object,func,data) \
39 gtk_signal_compat_matched((object), (func), (data), \
40 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
41 G_SIGNAL_MATCH_DATA), 0)
43 // child is not a member of GTK_BUTTON() any more in GTK+ 2.0
44 #define BUTTON_CHILD(w) GTK_BIN((w))->child
46 // event_window has disappeared from GtkToggleButton in GTK+ 2.0
47 #define TOGGLE_BUTTON_EVENT_WIN(w) GTK_BUTTON((w))->event_window
49 // gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under
50 // previous GTK+ versions but no more
51 #if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
52 #define DUMMY_CLIPBOARD_ARG
54 #define DUMMY_CLIPBOARD_ARG ,0
57 // _GtkEditable is now private
58 #define GET_EDITABLE_POS(w) gtk_editable_get_position(GTK_EDITABLE(w))
59 #define SET_EDITABLE_POS(w, pos) \
60 gtk_editable_set_position(GTK_EDITABLE(w), (pos))
62 // this GtkNotebook struct field has been renamed
63 #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->event_window
65 #define SCROLLBAR_CBACK_ARG
66 #define GET_SCROLL_TYPE(w) GTK_SCROLL_JUMP
68 // translate a GTK+ scroll type to a wxEventType
69 inline wxEventType
GtkScrollTypeToWx(guint scrollType
)
74 case GTK_SCROLL_STEP_BACKWARD
:
75 command
= wxEVT_SCROLL_LINEUP
;
78 case GTK_SCROLL_STEP_FORWARD
:
79 command
= wxEVT_SCROLL_LINEDOWN
;
82 case GTK_SCROLL_PAGE_BACKWARD
:
83 command
= wxEVT_SCROLL_PAGEUP
;
86 case GTK_SCROLL_PAGE_FORWARD
:
87 command
= wxEVT_SCROLL_PAGEDOWN
;
91 command
= wxEVT_SCROLL_THUMBTRACK
;
97 inline wxEventType
GtkScrollWinTypeToWx(guint scrollType
)
99 // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
100 return GtkScrollTypeToWx(scrollType
) +
101 wxEVT_SCROLLWIN_TOP
- wxEVT_SCROLL_TOP
;
104 // Needed for implementing e.g. combobox on wxGTK within a modal dialog.
105 void wxAddGrab(wxWindow
* window
);
106 void wxRemoveGrab(wxWindow
* window
);
108 // Escapes string so that it is valid Pango markup XML string:
109 WXDLLIMPEXP_CORE wxString
wxEscapeStringForPangoMarkup(const wxString
& str
);
111 // The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
112 // GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
113 // for Solaris 9 x86.
114 #ifdef NEED_GTK_ICON_SIZE_LOOKUP
115 extern "C" gboolean
gtk_icon_size_lookup (GtkIconSize size
,
120 #endif // _WX_GTK_PRIVATE_H_