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$
|
|
|
|
// Copyright: (c) wxWindows team
|
2003-03-17 05:34:04 -05: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-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-10-12 17:52:17 -04:00
|
|
|
#pragma interface "controlbase.h"
|
1999-07-26 19:02:32 -04:00
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
2001-07-02 11:19:03 -04:00
|
|
|
WXDLLEXPORT_DATA(extern 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:
|
2003-07-21 20:24:07 -04:00
|
|
|
wxControlBase() { }
|
|
|
|
|
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);
|
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// simulates the event of given type (i.e. wxButton::Command() is just as
|
|
|
|
// if the button was clicked)
|
|
|
|
virtual void Command(wxCommandEvent &event);
|
|
|
|
|
2001-06-26 16:59:19 -04:00
|
|
|
// get the control alignment (left/right/centre, top/bottom/centre)
|
|
|
|
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
|
|
|
|
|
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; }
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
// inherit colour and font settings from the parent window
|
|
|
|
void InheritAttributes();
|
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
|
|
|
|
|
|
|
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"
|
|
|
|
#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"
|
1998-07-10 10:15:17 -04:00
|
|
|
#elif defined(__WXGTK__)
|
1999-07-26 19:02:32 -04:00
|
|
|
#include "wx/gtk/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_
|