2002-03-12 19:24:30 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-01-23 02:28:01 +00:00
|
|
|
// Name: wx/gtk1/private.h
|
2002-03-12 19:24:30 +00:00
|
|
|
// Purpose: wxGTK private macros, functions &c
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 12.03.02
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2002-03-12 19:24:30 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GTK_PRIVATE_H_
|
|
|
|
#define _WX_GTK_PRIVATE_H_
|
|
|
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "wx/event.h"
|
|
|
|
|
|
|
|
// fail all version tests if the GTK+ version is so ancient that it doesn't
|
|
|
|
// even have GTK_CHECK_VERSION
|
|
|
|
#ifndef GTK_CHECK_VERSION
|
|
|
|
#define GTK_CHECK_VERSION(a, b, c) 0
|
|
|
|
#endif
|
|
|
|
|
2006-01-23 02:28:01 +00:00
|
|
|
#define wxGTK_CONV(s) s.c_str()
|
|
|
|
#define wxGTK_CONV_BACK(s) s
|
2002-08-05 17:57:53 +00:00
|
|
|
|
|
|
|
|
2002-03-12 19:24:30 +00:00
|
|
|
// child is not a member of GTK_BUTTON() any more in GTK+ 2.0
|
2006-01-23 02:28:01 +00:00
|
|
|
#define BUTTON_CHILD(w) GTK_BUTTON((w))->child
|
2002-03-12 19:24:30 +00:00
|
|
|
|
|
|
|
// event_window has disappeared from GtkToggleButton in GTK+ 2.0
|
2006-01-23 02:28:01 +00:00
|
|
|
#define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
|
2002-03-12 19:24:30 +00:00
|
|
|
|
|
|
|
// gtk_editable_{copy|cut|paste}_clipboard() had an extra argument under
|
|
|
|
// previous GTK+ versions but no more
|
|
|
|
#if defined(__WXGTK20__) || (GTK_MINOR_VERSION > 0)
|
|
|
|
#define DUMMY_CLIPBOARD_ARG
|
|
|
|
#else
|
|
|
|
#define DUMMY_CLIPBOARD_ARG ,0
|
|
|
|
#endif
|
|
|
|
|
2006-01-23 02:28:01 +00:00
|
|
|
// _GtkEditable is private in GTK2
|
|
|
|
#define GET_EDITABLE_POS(w) GTK_EDITABLE((w))->current_pos
|
|
|
|
#define SET_EDITABLE_POS(w, pos) \
|
|
|
|
GTK_EDITABLE((w))->current_pos = (pos)
|
2002-03-12 19:24:30 +00:00
|
|
|
|
2006-01-23 02:28:01 +00:00
|
|
|
// this GtkNotebook struct field has been renamed in GTK2
|
|
|
|
#define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
|
2002-03-12 19:24:30 +00:00
|
|
|
|
2006-01-23 02:28:01 +00:00
|
|
|
#define SCROLLBAR_CBACK_ARG
|
|
|
|
#define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
|
2002-03-12 19:24:30 +00:00
|
|
|
|
|
|
|
// translate a GTK+ scroll type to a wxEventType
|
|
|
|
inline wxEventType GtkScrollTypeToWx(guint scrollType)
|
|
|
|
{
|
|
|
|
wxEventType command;
|
|
|
|
switch ( scrollType )
|
|
|
|
{
|
|
|
|
case GTK_SCROLL_STEP_BACKWARD:
|
|
|
|
command = wxEVT_SCROLL_LINEUP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SCROLL_STEP_FORWARD:
|
|
|
|
command = wxEVT_SCROLL_LINEDOWN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SCROLL_PAGE_BACKWARD:
|
|
|
|
command = wxEVT_SCROLL_PAGEUP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_SCROLL_PAGE_FORWARD:
|
|
|
|
command = wxEVT_SCROLL_PAGEDOWN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
command = wxEVT_SCROLL_THUMBTRACK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return command;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline wxEventType GtkScrollWinTypeToWx(guint scrollType)
|
|
|
|
{
|
|
|
|
// GtkScrollTypeToWx() returns SCROLL_XXX, not SCROLLWIN_XXX as we need
|
|
|
|
return GtkScrollTypeToWx(scrollType) +
|
|
|
|
wxEVT_SCROLLWIN_TOP - wxEVT_SCROLL_TOP;
|
|
|
|
}
|
|
|
|
|
2006-01-03 16:37:32 +00:00
|
|
|
// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
|
|
|
|
void wxAddGrab(wxWindow* window);
|
|
|
|
void wxRemoveGrab(wxWindow* window);
|
|
|
|
|
2002-03-12 19:24:30 +00:00
|
|
|
#endif // _WX_GTK_PRIVATE_H_
|
|
|
|
|