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>
|
|
|
|
|
2006-10-19 10:42:01 -04:00
|
|
|
#include "wx/gtk/private/string.h"
|
2002-03-12 14:24:30 -05:00
|
|
|
|
2007-04-21 14:32:29 -04:00
|
|
|
// pango_version_check symbol is quite recent ATM (4/2007)... so we
|
|
|
|
// use our own wrapper which implements a smart trick.
|
|
|
|
// Use this function as you'd use pango_version_check:
|
|
|
|
//
|
|
|
|
// if (!wx_pango_version_check(1,18,0))
|
|
|
|
// ... call to a function available only in pango >= 1.18 ...
|
|
|
|
//
|
|
|
|
// and use it only to test for pango versions >= 1.16.0
|
|
|
|
extern const gchar *wx_pango_version_check(int major, int minor, int micro);
|
|
|
|
|
2002-08-05 13:57:53 -04:00
|
|
|
#if wxUSE_UNICODE
|
2007-05-30 09:55:09 -04:00
|
|
|
#define wxGTK_CONV(s) s.utf8_str()
|
2006-04-14 13:32:25 -04:00
|
|
|
#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
|
|
|
|
2008-07-19 15:59:59 -04:00
|
|
|
#define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(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
|
2007-08-11 08:03:37 -04:00
|
|
|
extern WXDLLIMPEXP_CORE wxCharBuffer
|
2006-04-10 18:22:13 -04:00
|
|
|
wxConvertToGTK(const wxString& s,
|
|
|
|
wxFontEncoding enc = wxFONTENCODING_SYSTEM);
|
|
|
|
|
2007-08-11 08:03:37 -04:00
|
|
|
extern WXDLLIMPEXP_CORE wxCharBuffer
|
2007-02-27 10:41:56 -05:00
|
|
|
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.
|
2007-11-24 22:33:26 -05:00
|
|
|
extern "C" {
|
2006-02-20 16:28:53 -05:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
2007-11-24 22:33:26 -05:00
|
|
|
} // extern "C"
|
2006-11-02 04:51:49 -05:00
|
|
|
|
2008-08-02 17:51:22 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// various private helper functions
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace wxGTKPrivate
|
|
|
|
{
|
|
|
|
|
|
|
|
// these functions create the GTK widgets of the specified types which can then
|
|
|
|
// used to retrieve their styles, pass them to drawing functions &c
|
|
|
|
//
|
|
|
|
// the returned widgets shouldn't be destroyed, this is done automatically on
|
|
|
|
// shutdown
|
|
|
|
GtkWidget *GetButtonWidget();
|
|
|
|
GtkWidget *GetCheckButtonWidget();
|
2008-12-13 12:36:27 -05:00
|
|
|
GtkWidget *GetComboBoxWidget();
|
2008-08-02 17:51:22 -04:00
|
|
|
GtkWidget *GetEntryWidget();
|
2009-01-22 08:41:10 -05:00
|
|
|
GtkWidget *GetHeaderButtonWidgetFirst();
|
2008-08-02 17:51:22 -04:00
|
|
|
GtkWidget *GetHeaderButtonWidget();
|
2008-12-13 12:36:27 -05:00
|
|
|
GtkWidget *GetRadioButtonWidget();
|
2008-08-02 17:51:22 -04:00
|
|
|
GtkWidget *GetSplitterWidget();
|
2008-12-13 12:36:27 -05:00
|
|
|
GtkWidget *GetTextEntryWidget();
|
2008-08-02 17:51:22 -04:00
|
|
|
GtkWidget *GetTreeWidget();
|
|
|
|
|
|
|
|
} // wxGTKPrivate
|
|
|
|
|
2002-03-12 14:24:30 -05:00
|
|
|
#endif // _WX_GTK_PRIVATE_H_
|
|
|
|
|