1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-23 02:28:01 +00:00
|
|
|
// Name: wx/gtk1/control.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 10:56:58 +00:00
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCONTROLH__
|
|
|
|
#define __GTKCONTROLH__
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
#include "wx/window.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxControl;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2005-12-18 16:37:56 +00:00
|
|
|
typedef struct _GtkLabel GtkLabel;
|
|
|
|
typedef struct _GtkFrame GtkFrame;
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxControl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-03-21 23:42:26 +00:00
|
|
|
// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
|
|
|
|
extern "C" {
|
|
|
|
typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
|
2011-09-07 16:56:50 +00:00
|
|
|
typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*);
|
2005-03-21 23:42:26 +00:00
|
|
|
typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
|
|
|
|
}
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1998-07-23 16:05:14 +00:00
|
|
|
public:
|
1999-07-26 23:02:32 +00:00
|
|
|
wxControl();
|
2000-01-04 17:20:21 +00: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 16:47:48 +00:00
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
2000-01-04 17:20:21 +00:00
|
|
|
}
|
1999-12-23 19:23:13 +00:00
|
|
|
|
2000-01-04 17:20:21 +00: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 16:05:14 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
virtual void SetLabel( const wxString &label );
|
|
|
|
virtual wxString GetLabel() const;
|
2005-12-18 16:37:56 +00:00
|
|
|
|
2004-05-06 17:26:25 +00:00
|
|
|
virtual wxVisualAttributes GetDefaultAttributes() const;
|
|
|
|
|
1998-07-23 16:05:14 +00:00
|
|
|
protected:
|
1999-11-19 21:01:20 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2004-05-04 07:09:32 +00:00
|
|
|
void PostCreation(const wxSize& size);
|
|
|
|
|
2005-12-18 16:37:56 +00:00
|
|
|
// sets the label to the given string and also sets it for the given widget
|
|
|
|
void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
|
|
|
|
|
|
|
|
// as GTKSetLabelForLabel() but for a GtkFrame widget
|
|
|
|
void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
|
|
|
|
|
|
|
|
// remove mnemonics ("&"s) from the label
|
|
|
|
static wxString GTKRemoveMnemonics(const wxString& label);
|
|
|
|
|
2004-05-06 17:26:25 +00:00
|
|
|
// These are used by GetDefaultAttributes
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
static wxVisualAttributes
|
2005-03-21 23:42:26 +00:00
|
|
|
GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
|
2004-05-06 17:26:25 +00:00
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
static wxVisualAttributes
|
2005-03-21 23:42:26 +00:00
|
|
|
GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
|
2004-05-06 17:26:25 +00:00
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
|
|
|
|
static wxVisualAttributes
|
2005-03-21 23:42:26 +00:00
|
|
|
GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
|
2004-05-06 17:26:25 +00:00
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
|
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
|
|
|
virtual bool UseGTKStyleBase() const { return false; }
|
|
|
|
|
2005-12-18 16:37:56 +00:00
|
|
|
// this field contains the label in wx format, i.e. with "&" mnemonics
|
|
|
|
wxString m_label;
|
1999-12-23 19:23:13 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
private:
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxControl);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKCONTROLH__
|