1999-07-26 19:02:32 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/control.h
|
|
|
|
// Purpose: wxControl common interface
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 26.07.99
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 10:56:36 -04:00
|
|
|
// Copyright: (c) wxWidgets team
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-26 19:02:32 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_CONTROL_H_BASE_
|
|
|
|
#define _WX_CONTROL_H_BASE_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-07-09 17:48:53 -04:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if wxUSE_CONTROLS
|
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/window.h" // base class
|
|
|
|
|
2006-01-16 09:59:55 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[];
|
2001-06-26 16:59:19 -04:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxControl is the base class for all controls
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxControlBase : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
2004-06-21 18:58:13 -04:00
|
|
|
wxControlBase() { }
|
2003-07-21 20:24:07 -04:00
|
|
|
|
2002-01-07 16:52:28 -05:00
|
|
|
virtual ~wxControlBase();
|
|
|
|
|
2001-06-26 16:59:19 -04: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-03-31 19:19:39 -05:00
|
|
|
|
2003-10-16 06:00:12 -04: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-03-31 19:19:39 -05: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 16:09:45 -04:00
|
|
|
virtual void SetLabel( const wxString &label );
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
|
2006-02-12 11:32:50 -05:00
|
|
|
// wxControl-specific processing after processing the update event
|
|
|
|
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
|
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
protected:
|
1999-11-10 19:25:57 -05:00
|
|
|
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
|
|
|
|
// to the list of parents children
|
1999-07-26 19:02:32 -04:00
|
|
|
bool CreateControl(wxWindowBase *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style,
|
|
|
|
const wxValidator& validator,
|
|
|
|
const wxString& name);
|
|
|
|
|
2000-02-25 18:49:41 -05:00
|
|
|
// initialize the common fields of wxCommandEvent
|
|
|
|
void InitCommandEvent(wxCommandEvent& event) const;
|
2003-07-21 20:24:07 -04:00
|
|
|
|
2004-05-03 08:38:20 -04: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-21 20:24:07 -04:00
|
|
|
DECLARE_NO_COPY_CLASS(wxControlBase)
|
1999-07-26 19:02:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// include platform-dependent wxControl declarations
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-05-09 18:17:03 -04:00
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/univ/control.h"
|
2004-12-20 07:44:22 -05:00
|
|
|
#elif defined(__WXPALMOS__)
|
2004-10-19 09:40:30 -04:00
|
|
|
#include "wx/palmos/control.h"
|
2001-06-26 16:59:19 -04:00
|
|
|
#elif defined(__WXMSW__)
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/msw/control.h"
|
1998-07-10 10:15:17 -04:00
|
|
|
#elif defined(__WXMOTIF__)
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/motif/control.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK20__)
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/gtk/control.h"
|
2006-01-22 22:27:34 -05:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "wx/gtk1/control.h"
|
1998-08-14 20:23:28 -04:00
|
|
|
#elif defined(__WXMAC__)
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/mac/control.h"
|
2003-03-22 01:18:36 -05:00
|
|
|
#elif defined(__WXCOCOA__)
|
|
|
|
#include "wx/cocoa/control.h"
|
1999-07-27 23:38:12 -04:00
|
|
|
#elif defined(__WXPM__)
|
|
|
|
#include "wx/os2/control.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
#endif // wxUSE_CONTROLS
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1998-08-14 20:23:28 -04:00
|
|
|
// _WX_CONTROL_H_BASE_
|