2002-03-12 14:24:30 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/private.h
|
2002-03-12 14:24:30 -05:00
|
|
|
// Purpose: wxGTK private macros, functions &c
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 12.03.02
|
2004-05-23 10:56:36 -04:00
|
|
|
// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2002-03-12 14:24:30 -05: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-22 21:28:01 -05:00
|
|
|
#define wxGTK_CONV(s) s.c_str()
|
|
|
|
#define wxGTK_CONV_BACK(s) s
|
2002-08-05 13:57:53 -04:00
|
|
|
|
|
|
|
|
2002-03-12 14:24:30 -05:00
|
|
|
// child is not a member of GTK_BUTTON() any more in GTK+ 2.0
|
2006-01-22 21:28:01 -05:00
|
|
|
#define BUTTON_CHILD(w) GTK_BUTTON((w))->child
|
2002-03-12 14:24:30 -05:00
|
|
|
|
|
|
|
// event_window has disappeared from GtkToggleButton in GTK+ 2.0
|
2006-01-22 21:28:01 -05:00
|
|
|
#define TOGGLE_BUTTON_EVENT_WIN(w) GTK_TOGGLE_BUTTON((w))->event_window
|
2002-03-12 14:24:30 -05: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-22 21:28:01 -05: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 14:24:30 -05:00
|
|
|
|
2006-01-22 21:28:01 -05:00
|
|
|
// this GtkNotebook struct field has been renamed in GTK2
|
|
|
|
#define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel
|
2002-03-12 14:24:30 -05:00
|
|
|
|
2006-01-22 21:28:01 -05:00
|
|
|
#define SCROLLBAR_CBACK_ARG
|
|
|
|
#define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type
|
2002-03-12 14:24:30 -05: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 11:37:32 -05:00
|
|
|
// Needed for implementing e.g. combobox on wxGTK within a modal dialog.
|
|
|
|
void wxAddGrab(wxWindow* window);
|
|
|
|
void wxRemoveGrab(wxWindow* window);
|
|
|
|
|
2002-03-12 14:24:30 -05:00
|
|
|
#endif // _WX_GTK_PRIVATE_H_
|
|
|
|
|