]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/private.h
d63519da52a7d34d084680bc0daf9bc942f76410
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@wxwindows.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
28 #define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
29 #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
31 #define wxGTK_CONV(s) wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC(s) )
32 #define wxGTK_CONV_BACK(s) wxConvLocal.cWC2WX( (wxConvUTF8.cMB2WC( s ) ) )
35 #define wxGTK_CONV(s) s.c_str()
36 #define wxGTK_CONV_BACK(s) s
40 // GTK+ 2.0 compatibility define is broken when used from C++ as it
41 // casts enum to int implicitly
43 #undef gtk_signal_disconnect_by_func
44 #define gtk_signal_disconnect_by_func(object,func,data) \
45 gtk_signal_compat_matched((object), (func), (data), \
46 (GSignalMatchType)(G_SIGNAL_MATCH_FUNC | \
47 G_SIGNAL_MATCH_DATA), 0)
50 // child is not a member of GTK_BUTTON() any more in GTK+ 2.0
52 #define BUTTON_CHILD(w) GTK_BIN((w))->child
54 #define BUTTON_CHILD(w) GTK_BUTTON((w))->child
57 // event_window has disappeared from GtkToggleButton in GTK+ 2.0
59 #define TOGGLE_BUTTON_EVENT_WIN(w) GTK_BUTTON((w))->event_window
61 #define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
64 // gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under
65 // previous GTK+ versions but no more
66 #if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
67 #define DUMMY_CLIPBOARD_ARG
69 #define DUMMY_CLIPBOARD_ARG ,0
72 // _GtkEditable is now private
74 #define GET_EDITABLE_POS(w) gtk_editable_get_position(GTK_EDITABLE(w))
75 #define SET_EDITABLE_POS(w, pos) \
76 gtk_editable_set_position(GTK_EDITABLE(w), (pos))
78 #define GET_EDITABLE_POS(w) GTK_EDITABLE((w))->current_pos
79 #define SET_EDITABLE_POS(w, pos) \
80 GTK_EDITABLE((w))->current_pos = (pos)
83 // this GtkNotebook struct field has been renamed
85 #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->event_window
87 #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
91 #define SCROLLBAR_CBACK_ARG
92 #define GET_SCROLL_TYPE(w) GTK_SCROLL_JUMP
94 #define SCROLLBAR_CBACK_ARG
95 #define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
98 // translate a GTK+ scroll type to a wxEventType
99 inline wxEventType
GtkScrollTypeToWx(guint scrollType
)
102 switch ( scrollType
)
104 case GTK_SCROLL_STEP_BACKWARD
:
105 command
= wxEVT_SCROLL_LINEUP
;
108 case GTK_SCROLL_STEP_FORWARD
:
109 command
= wxEVT_SCROLL_LINEDOWN
;
112 case GTK_SCROLL_PAGE_BACKWARD
:
113 command
= wxEVT_SCROLL_PAGEUP
;
116 case GTK_SCROLL_PAGE_FORWARD
:
117 command
= wxEVT_SCROLL_PAGEDOWN
;
121 command
= wxEVT_SCROLL_THUMBTRACK
;
127 inline wxEventType
GtkScrollWinTypeToWx(guint scrollType
)
129 // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
130 return GtkScrollTypeToWx(scrollType
) +
131 wxEVT_SCROLLWIN_TOP
- wxEVT_SCROLL_TOP
;
134 #endif // _WX_GTK_PRIVATE_H_