]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/private.h
[ 1823588 ] gtk filedlg - droping support for gtk 2.2
[wxWidgets.git] / include / wx / gtk1 / private.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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 <gdk/gdk.h>
16 #include <gtk/gtk.h>
17
18 #include "wx/event.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 #define wxGTK_CONV(s) s.c_str()
27 #define wxGTK_CONV_BACK(s) s
28
29
30 // child is not a member of GTK_BUTTON() any more in GTK+ 2.0
31 #define BUTTON_CHILD(w) GTK_BUTTON((w))->child
32
33 // event_window has disappeared from GtkToggleButton in GTK+ 2.0
34 #define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
35
36 // gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under
37 // previous GTK+ versions but no more
38 #if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
39 #define DUMMY_CLIPBOARD_ARG
40 #else
41 #define DUMMY_CLIPBOARD_ARG ,0
42 #endif
43
44 // _GtkEditable is private in GTK2
45 #define GET_EDITABLE_POS(w) GTK_EDITABLE((w))->current_pos
46 #define SET_EDITABLE_POS(w, pos) \
47 GTK_EDITABLE((w))->current_pos = (pos)
48
49 // this GtkNotebook struct field has been renamed in GTK2
50 #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
51
52 #define SCROLLBAR_CBACK_ARG
53 #define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
54
55 // translate a GTK+ scroll type to a wxEventType
56 inline wxEventType GtkScrollTypeToWx(guint scrollType)
57 {
58 wxEventType command;
59 switch ( scrollType )
60 {
61 case GTK_SCROLL_STEP_BACKWARD:
62 command = wxEVT_SCROLL_LINEUP;
63 break;
64
65 case GTK_SCROLL_STEP_FORWARD:
66 command = wxEVT_SCROLL_LINEDOWN;
67 break;
68
69 case GTK_SCROLL_PAGE_BACKWARD:
70 command = wxEVT_SCROLL_PAGEUP;
71 break;
72
73 case GTK_SCROLL_PAGE_FORWARD:
74 command = wxEVT_SCROLL_PAGEDOWN;
75 break;
76
77 default:
78 command = wxEVT_SCROLL_THUMBTRACK;
79 }
80
81 return command;
82 }
83
84 inline wxEventType GtkScrollWinTypeToWx(guint scrollType)
85 {
86 // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
87 return GtkScrollTypeToWx(scrollType) +
88 wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP;
89 }
90
91 // Needed for implementing e.g. combobox on wxGTK within a modal dialog.
92 void wxAddGrab(wxWindow* window);
93 void wxRemoveGrab(wxWindow* window);
94
95 // The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
96 // GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
97 // for Solaris 9 x86.
98 #ifdef NEED_GTK_ICON_SIZE_LOOKUP
99 extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
100 gint *width,
101 gint *height);
102 #endif
103
104 #endif // _WX_GTK_PRIVATE_H_
105