]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/private.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / gtk1 / private.h
CommitLineData
9e691f46 1///////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/private.h
9e691f46
VZ
3// Purpose: wxGTK private macros, functions &c
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 12.03.02
77ffb593 7// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 8// Licence: wxWindows licence
9e691f46
VZ
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
8ef94bfc
MR
25#define wxGTK_CONV(s) s.c_str()
26#define wxGTK_CONV_BACK(s) s
dd398cd0
RR
27
28
9e691f46 29// child is not a member of GTK_BUTTON() any more in GTK+ 2.0
8ef94bfc 30#define BUTTON_CHILD(w) GTK_BUTTON((w))->child
9e691f46
VZ
31
32// event_window has disappeared from GtkToggleButton in GTK+ 2.0
8ef94bfc 33#define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
9e691f46 34
9e691f46
VZ
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
8ef94bfc
MR
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)
9e691f46 47
8ef94bfc
MR
48// this GtkNotebook struct field has been renamed in GTK2
49#define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
9e691f46 50
8ef94bfc
MR
51#define SCROLLBAR_CBACK_ARG
52#define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
9e691f46
VZ
53
54// translate a GTK+ scroll type to a wxEventType
55inline 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
83inline 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
224016a8
JS
90// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
91void wxAddGrab(wxWindow* window);
92void wxRemoveGrab(wxWindow* window);
93
9e691f46
VZ
94#endif // _WX_GTK_PRIVATE_H_
95