2002-03-12 14:24:30 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/gtk/private.h
|
|
|
|
// Purpose: wxGTK private macros, functions &c
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 12.03.02
|
|
|
|
// RCS-ID: $Id$
|
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 <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "wx/event.h"
|
2006-10-19 10:42:01 -04:00
|
|
|
#include "wx/gtk/private/string.h"
|
2002-03-12 14:24:30 -05:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2002-08-05 13:57:53 -04:00
|
|
|
#if wxUSE_UNICODE
|
2006-04-14 13:32:25 -04:00
|
|
|
#define wxGTK_CONV(s) wxConvUTF8.cWX2MB((s))
|
|
|
|
#define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
|
|
|
|
#define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
|
|
|
|
#define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
|
2007-02-27 10:41:56 -05:00
|
|
|
|
2006-04-14 13:32:25 -04:00
|
|
|
#define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX((s))
|
2007-02-27 10:41:56 -05:00
|
|
|
#define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
|
|
|
|
#define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
|
|
|
|
#define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
|
2002-08-05 13:57:53 -04:00
|
|
|
#else
|
2006-04-11 10:18:20 -04:00
|
|
|
#include "wx/font.h"
|
|
|
|
|
2007-02-27 10:41:56 -05:00
|
|
|
// convert the text between the given encoding and UTF-8 used by wxGTK
|
2006-04-10 18:22:13 -04:00
|
|
|
extern wxCharBuffer
|
|
|
|
wxConvertToGTK(const wxString& s,
|
|
|
|
wxFontEncoding enc = wxFONTENCODING_SYSTEM);
|
|
|
|
|
2007-02-27 10:41:56 -05:00
|
|
|
extern wxCharBuffer
|
|
|
|
wxConvertFromGTK(const wxString& s,
|
|
|
|
wxFontEncoding enc = wxFONTENCODING_SYSTEM);
|
|
|
|
|
2006-04-10 18:22:13 -04:00
|
|
|
// helper: use the encoding of the given font if it's valid
|
|
|
|
inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
|
|
|
|
{
|
|
|
|
return wxConvertToGTK(s, font.Ok() ? font.GetEncoding()
|
|
|
|
: wxFONTENCODING_SYSTEM);
|
|
|
|
}
|
|
|
|
|
2007-02-27 10:41:56 -05:00
|
|
|
inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
|
|
|
|
{
|
|
|
|
return wxConvertFromGTK(s, font.Ok() ? font.GetEncoding()
|
|
|
|
: wxFONTENCODING_SYSTEM);
|
|
|
|
}
|
|
|
|
|
|
|
|
// more helpers: allow passing GTK+ strings directly
|
|
|
|
inline wxCharBuffer
|
|
|
|
wxConvertFromGTK(const wxGtkString& gs,
|
|
|
|
wxFontEncoding enc = wxFONTENCODING_SYSTEM)
|
|
|
|
{
|
|
|
|
return wxConvertFromGTK(gs.c_str(), enc);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline wxCharBuffer
|
|
|
|
wxConvertFromGTK(const wxGtkString& gs, const wxFont& font)
|
|
|
|
{
|
|
|
|
return wxConvertFromGTK(gs.c_str(), font);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
|
2006-04-14 13:32:25 -04:00
|
|
|
#define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
|
|
|
|
#define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
|
|
|
|
#define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
|
2007-02-27 10:41:56 -05:00
|
|
|
|
|
|
|
#define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)
|
|
|
|
#define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc))
|
|
|
|
#define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font))
|
|
|
|
#define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s))
|
2002-08-05 13:57:53 -04:00
|
|
|
#endif
|
|
|
|
|
2006-02-20 16:28:53 -05:00
|
|
|
// Some deprecated GTK+ prototypes we still use often
|
|
|
|
// FIXME: Don't use them if possible.
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
// Should use gtk_image_new, but the mask seems to be handled different,
|
|
|
|
// and we need to migrate
|
|
|
|
GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
|
|
|
|
GdkBitmap *mask);
|
|
|
|
|
|
|
|
// Deprecated since GTK+-1.3.7:
|
|
|
|
// Trivial wrapper around gtk_window_move, with some side effects we seem to rely on
|
|
|
|
void gtk_widget_set_uposition (GtkWidget *widget,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
|
|
|
|
// We rely on the allow_shrink parameter in one place
|
|
|
|
void gtk_window_set_policy (GtkWindow *window,
|
|
|
|
gint allow_shrink,
|
|
|
|
gint allow_grow,
|
|
|
|
gint auto_shrink);
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2006-03-09 08:36:53 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// idle system
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern void wxapp_install_idle_handler();
|
|
|
|
extern bool g_isIdle;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Misc. functions
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
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);
|
|
|
|
|
2004-06-27 09:42:17 -04:00
|
|
|
// Escapes string so that it is valid Pango markup XML string:
|
2005-08-02 18:58:06 -04:00
|
|
|
WXDLLIMPEXP_CORE wxString wxEscapeStringForPangoMarkup(const wxString& str);
|
2004-06-27 09:42:17 -04:00
|
|
|
|
2005-06-10 08:04:15 -04:00
|
|
|
// The declaration for gtk_icon_size_lookup was accidentally ifdefed out in
|
|
|
|
// GTK+ 2.1.0 which Sun seem to have shipped with some versions of JDS
|
|
|
|
// for Solaris 9 x86.
|
2005-08-03 20:25:20 -04:00
|
|
|
#ifdef NEED_GTK_ICON_SIZE_LOOKUP
|
2005-06-10 08:04:15 -04:00
|
|
|
extern "C" gboolean gtk_icon_size_lookup (GtkIconSize size,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
#endif
|
|
|
|
|
2006-11-02 04:51:49 -05:00
|
|
|
#ifdef __WXGTK20__
|
|
|
|
#include <gdk/gdktypes.h>
|
|
|
|
|
|
|
|
// Returns stock accelerator modifier and key code for the given ID
|
|
|
|
WXDLLEXPORT bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key);
|
|
|
|
#endif
|
|
|
|
|
2002-03-12 14:24:30 -05:00
|
|
|
#endif // _WX_GTK_PRIVATE_H_
|
|
|
|
|