]>
Commit | Line | Data |
---|---|---|
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 | // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org> | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_GTK_PRIVATE_H_ | |
12 | #define _WX_GTK_PRIVATE_H_ | |
13 | ||
14 | #include <gdk/gdk.h> | |
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 | #define wxGTK_CONV(s) s.c_str() | |
26 | #define wxGTK_CONV_BACK(s) s | |
27 | ||
28 | ||
29 | // child is not a member of GTK_BUTTON() any more in GTK+ 2.0 | |
30 | #define BUTTON_CHILD(w) GTK_BUTTON((w))->child | |
31 | ||
32 | // event_window has disappeared from GtkToggleButton in GTK+ 2.0 | |
33 | #define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window | |
34 | ||
35 | // gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under | |
36 | // previous GTK+ versions but no more | |
37 | #if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0) | |
38 | #define DUMMY_CLIPBOARD_ARG | |
39 | #else | |
40 | #define DUMMY_CLIPBOARD_ARG ,0 | |
41 | #endif | |
42 | ||
43 | // _GtkEditable is private in GTK2 | |
44 | #define GET_EDITABLE_POS(w) GTK_EDITABLE((w))->current_pos | |
45 | #define SET_EDITABLE_POS(w, pos) \ | |
46 | GTK_EDITABLE((w))->current_pos = (pos) | |
47 | ||
48 | // this GtkNotebook struct field has been renamed in GTK2 | |
49 | #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel | |
50 | ||
51 | #define SCROLLBAR_CBACK_ARG | |
52 | #define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type | |
53 | ||
54 | // translate a GTK+ scroll type to a wxEventType | |
55 | inline wxEventType GtkScrollTypeToWx(guint scrollType) | |
56 | { | |
57 | wxEventType command; | |
58 | switch ( scrollType ) | |
59 | { | |
60 | case GTK_SCROLL_STEP_BACKWARD: | |
61 | command = wxEVT_SCROLL_LINEUP; | |
62 | break; | |
63 | ||
64 | case GTK_SCROLL_STEP_FORWARD: | |
65 | command = wxEVT_SCROLL_LINEDOWN; | |
66 | break; | |
67 | ||
68 | case GTK_SCROLL_PAGE_BACKWARD: | |
69 | command = wxEVT_SCROLL_PAGEUP; | |
70 | break; | |
71 | ||
72 | case GTK_SCROLL_PAGE_FORWARD: | |
73 | command = wxEVT_SCROLL_PAGEDOWN; | |
74 | break; | |
75 | ||
76 | default: | |
77 | command = wxEVT_SCROLL_THUMBTRACK; | |
78 | } | |
79 | ||
80 | return command; | |
81 | } | |
82 | ||
83 | inline wxEventType GtkScrollWinTypeToWx(guint scrollType) | |
84 | { | |
85 | // GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need | |
86 | return GtkScrollTypeToWx(scrollType) + | |
87 | wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP; | |
88 | } | |
89 | ||
90 | // Needed for implementing e.g. combobox on wxGTK within a modal dialog. | |
91 | void wxAddGrab(wxWindow* window); | |
92 | void wxRemoveGrab(wxWindow* window); | |
93 | ||
94 | #endif // _WX_GTK_PRIVATE_H_ | |
95 |