1999-07-26 23:02:32 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/control.h
|
|
|
|
// Purpose: wxControl common interface
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 26.07.99
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 14:56:36 +00:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-07-26 23:02:32 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_CONTROL_H_BASE_
|
|
|
|
#define _WX_CONTROL_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-07-09 21:48:53 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if wxUSE_CONTROLS
|
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/window.h" // base class
|
|
|
|
|
2006-01-16 14:59:55 +00:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[];
|
2001-06-26 20:59:19 +00:00
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxControl is the base class for all controls
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxControlBase : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
2004-06-21 22:58:13 +00:00
|
|
|
wxControlBase() { }
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2002-01-07 21:52:28 +00:00
|
|
|
virtual ~wxControlBase();
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
// Create() function adds the validator parameter
|
|
|
|
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);
|
|
|
|
|
|
|
|
// get the control alignment (left/right/centre, top/bottom/centre)
|
|
|
|
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
|
|
|
|
|
2004-04-01 00:19:39 +00:00
|
|
|
|
2003-10-16 10:00:12 +00:00
|
|
|
// controls by default inherit the colours of their parents, if a
|
|
|
|
// particular control class doesn't want to do it, it can override
|
|
|
|
// ShouldInheritColours() to return false
|
|
|
|
virtual bool ShouldInheritColours() const { return true; }
|
|
|
|
|
2004-04-01 00:19:39 +00:00
|
|
|
|
|
|
|
// WARNING: this doesn't work for all controls nor all platforms!
|
|
|
|
//
|
|
|
|
// simulates the event of given type (i.e. wxButton::Command() is just as
|
|
|
|
// if the button was clicked)
|
|
|
|
virtual void Command(wxCommandEvent &event);
|
|
|
|
|
2004-06-24 20:09:45 +00:00
|
|
|
virtual void SetLabel( const wxString &label );
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
|
2005-06-26 15:46:12 +00:00
|
|
|
// Reserved for future use
|
|
|
|
virtual void ReservedControlFunc1() {}
|
|
|
|
virtual void ReservedControlFunc2() {}
|
|
|
|
virtual void ReservedControlFunc3() {}
|
|
|
|
virtual void ReservedControlFunc4() {}
|
|
|
|
virtual void ReservedControlFunc5() {}
|
|
|
|
virtual void ReservedControlFunc6() {}
|
|
|
|
virtual void ReservedControlFunc7() {}
|
|
|
|
virtual void ReservedControlFunc8() {}
|
|
|
|
virtual void ReservedControlFunc9() {}
|
|
|
|
|
1999-07-26 23:02:32 +00:00
|
|
|
protected:
|
1999-11-11 00:25:57 +00:00
|
|
|
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
|
|
|
|
// to the list of parents children
|
1999-07-26 23:02:32 +00:00
|
|
|
bool CreateControl(wxWindowBase *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style,
|
|
|
|
const wxValidator& validator,
|
|
|
|
const wxString& name);
|
|
|
|
|
2000-02-25 23:49:41 +00:00
|
|
|
// initialize the common fields of wxCommandEvent
|
|
|
|
void InitCommandEvent(wxCommandEvent& event) const;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2004-05-03 12:38:20 +00:00
|
|
|
// set the initial window size if none is given (i.e. at least one of the
|
|
|
|
// components of the size passed to ctor/Create() is -1)
|
|
|
|
//
|
|
|
|
// normally just calls SetBestSize() but can be overridden not to do it for
|
|
|
|
// the controls which have to do some additional initialization (e.g. add
|
|
|
|
// strings to list box) before their best size can be accurately calculated
|
|
|
|
virtual void SetInitialBestSize(const wxSize& size)
|
|
|
|
{
|
|
|
|
SetBestSize(size);
|
|
|
|
}
|
|
|
|
|
2003-07-22 00:24:07 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxControlBase)
|
1999-07-26 23:02:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include platform-dependent wxControl declarations
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-05-09 22:17:03 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/control.h"
|
2004-12-20 12:44:22 +00:00
|
|
|
#elif defined(__WXPALMOS__)
|
2004-10-19 13:40:30 +00:00
|
|
|
#include "wx/palmos/control.h"
|
2001-06-26 20:59:19 +00:00
|
|
|
#elif defined(__WXMSW__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/msw/control.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/motif/control.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXGTK__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/gtk/control.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
1999-07-26 23:02:32 +00:00
|
|
|
#include "wx/mac/control.h"
|
2003-03-22 06:18:36 +00:00
|
|
|
#elif defined(__WXCOCOA__)
|
|
|
|
#include "wx/cocoa/control.h"
|
1999-07-28 03:38:12 +00:00
|
|
|
#elif defined(__WXPM__)
|
|
|
|
#include "wx/os2/control.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // wxUSE_CONTROLS
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
1998-08-15 00:23:28 +00:00
|
|
|
// _WX_CONTROL_H_BASE_
|