1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-19 20:14:35 -04:00
|
|
|
// Name: wx/gtk/control.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 05:56:58 -05:00
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#ifndef _WX_GTK_CONTROL_H_
|
|
|
|
#define _WX_GTK_CONTROL_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2005-12-18 11:37:56 -05:00
|
|
|
typedef struct _GtkLabel GtkLabel;
|
|
|
|
typedef struct _GtkFrame GtkFrame;
|
2012-11-09 16:11:37 -05:00
|
|
|
typedef struct _GtkEntry GtkEntry;
|
2005-12-18 11:37:56 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxControl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
2012-06-30 16:39:06 -04:00
|
|
|
typedef wxControlBase base_type;
|
1998-07-23 12:05:14 -04:00
|
|
|
public:
|
1999-07-26 19:02:32 -04:00
|
|
|
wxControl();
|
2000-01-04 12:20:21 -05:00
|
|
|
wxControl(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxControlNameStr)
|
|
|
|
{
|
2000-01-06 11:47:48 -05:00
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
2000-01-04 12:20:21 -05:00
|
|
|
}
|
1999-12-23 14:23:13 -05:00
|
|
|
|
2000-01-04 12:20:21 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxControlNameStr);
|
1998-07-23 12:05:14 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE;
|
2012-06-30 16:39:06 -04:00
|
|
|
#ifdef __WXGTK3__
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
#endif
|
2004-05-06 13:26:25 -04:00
|
|
|
|
1998-07-23 12:05:14 -04:00
|
|
|
protected:
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
2004-05-04 03:09:32 -04:00
|
|
|
void PostCreation(const wxSize& size);
|
|
|
|
|
2005-12-18 11:37:56 -05:00
|
|
|
// sets the label to the given string and also sets it for the given widget
|
|
|
|
void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
|
2011-02-27 07:48:07 -05:00
|
|
|
#if wxUSE_MARKUP
|
2007-04-01 10:13:15 -04:00
|
|
|
void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label);
|
2011-02-27 07:48:07 -05:00
|
|
|
#endif // wxUSE_MARKUP
|
2005-12-18 11:37:56 -05:00
|
|
|
|
2006-03-12 09:21:19 -05:00
|
|
|
// GtkFrame helpers
|
|
|
|
GtkWidget* GTKCreateFrame(const wxString& label);
|
2005-12-18 11:37:56 -05:00
|
|
|
void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
|
2006-03-12 09:21:19 -05:00
|
|
|
void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc);
|
|
|
|
void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget);
|
2005-12-18 11:37:56 -05:00
|
|
|
|
|
|
|
// remove mnemonics ("&"s) from the label
|
|
|
|
static wxString GTKRemoveMnemonics(const wxString& label);
|
|
|
|
|
|
|
|
// converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
|
|
|
|
static wxString GTKConvertMnemonics(const wxString &label);
|
1999-11-19 16:01:20 -05:00
|
|
|
|
2007-04-01 10:13:15 -04:00
|
|
|
// converts wx label to GTK+ labels preserving Pango markup
|
|
|
|
static wxString GTKConvertMnemonicsWithMarkup(const wxString& label);
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
// These are used by GetDefaultAttributes
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|
|
|
bool useBase = false,
|
2012-02-27 12:49:33 -05:00
|
|
|
int state = 0);
|
2004-05-06 13:26:25 -04:00
|
|
|
|
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
|
|
|
virtual bool UseGTKStyleBase() const { return false; }
|
|
|
|
|
2009-01-18 07:34:23 -05:00
|
|
|
// Fix sensitivity due to bug in GTK+ < 2.14
|
|
|
|
void GTKFixSensitivity(bool onlyIfUnderMouse = true);
|
|
|
|
|
2012-11-09 16:11:37 -05:00
|
|
|
// Ask GTK+ for preferred size. Use it after setting the font.
|
|
|
|
wxSize GTKGetPreferredSize(GtkWidget* widget) const;
|
|
|
|
|
|
|
|
// Inner margins in a GtkEntry
|
|
|
|
wxPoint GTKGetEntryMargins(GtkEntry* entry) const;
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxControl);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#endif // _WX_GTK_CONTROL_H_
|