1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: control.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 05:56:58 -05:00
|
|
|
// Id: $Id$
|
|
|
|
// 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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCONTROLH__
|
|
|
|
#define __GTKCONTROLH__
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1998-05-20 10:01:55 -04:00
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
#include "wx/window.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxControl;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxControl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-10-18 11:45:28 -04:00
|
|
|
class wxControl : public wxControlBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
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
|
|
|
|
|
|
|
// this function will filter out '&' characters and will put the accelerator
|
1999-07-26 19:02:32 -04:00
|
|
|
// char (the one immediately after '&') into m_chAccel (TODO not yet)
|
|
|
|
virtual void SetLabel( const wxString &label );
|
|
|
|
virtual wxString GetLabel() const;
|
2004-06-18 21:35:10 -04:00
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
virtual wxVisualAttributes GetDefaultAttributes() const;
|
|
|
|
|
1998-07-23 12:05:14 -04:00
|
|
|
protected:
|
2004-06-18 04:02:01 -04:00
|
|
|
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
2004-06-14 13:34:00 -04:00
|
|
|
// helper function to ease native widgets wrapping, called by
|
|
|
|
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
|
|
|
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
2004-05-04 03:09:32 -04:00
|
|
|
void PostCreation(const wxSize& size);
|
2004-06-18 21:35:10 -04:00
|
|
|
void PostSetLabel();
|
2004-05-04 03:09:32 -04:00
|
|
|
|
2003-03-04 18:34:52 -05:00
|
|
|
#ifdef __WXGTK20__
|
|
|
|
wxString PrepareLabelMnemonics( const wxString &label ) const;
|
|
|
|
#endif
|
1999-11-19 16:01:20 -05:00
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
// These are used by GetDefaultAttributes
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void),
|
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*),
|
|
|
|
bool useBase = false,
|
|
|
|
int state = -1);
|
|
|
|
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*),
|
|
|
|
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; }
|
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
wxString m_label;
|
|
|
|
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
2004-06-18 21:35:10 -04:00
|
|
|
bool m_createComplete;
|
1999-12-23 14:23:13 -05:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxControl)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKCONTROLH__
|