]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/private.h
added helper Is{Col,Row}Shown()
[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
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 9// Licence: wxWindows licence
9e691f46
VZ
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
8ef94bfc
MR
26#define wxGTK_CONV(s) s.c_str()
27#define wxGTK_CONV_BACK(s) s
dd398cd0
RR
28
29
9e691f46 30// child is not a member of GTK_BUTTON() any more in GTK+ 2.0
8ef94bfc 31#define BUTTON_CHILD(w) GTK_BUTTON((w))->child
9e691f46
VZ
32
33// event_window has disappeared from GtkToggleButton in GTK+ 2.0
8ef94bfc 34#define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
9e691f46 35
9e691f46
VZ
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
8ef94bfc
MR
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)
9e691f46 48
8ef94bfc
MR
49// this GtkNotebook struct field has been renamed in GTK2
50#define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
9e691f46 51
8ef94bfc
MR
52#define SCROLLBAR_CBACK_ARG
53#define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
9e691f46
VZ
54
55// translate a GTK+ scroll type to a wxEventType
56inline 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
84inline 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
224016a8
JS
91// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
92void wxAddGrab(wxWindow* window);
93void wxRemoveGrab(wxWindow* window);
94
9e691f46
VZ
95#endif // _WX_GTK_PRIVATE_H_
96