1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: control.h
|
|
|
|
// Purpose: wxControl class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
1999-03-30 06:09:48 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CONTROL_H_
|
|
|
|
#define _WX_CONTROL_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "control.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
#include "wx/validate.h"
|
|
|
|
|
1999-12-29 14:34:38 -05:00
|
|
|
#define wxControlNameStr _T("control")
|
|
|
|
|
1998-09-18 06:19:10 -04:00
|
|
|
// General item class
|
2000-01-07 09:59:14 -05:00
|
|
|
class WXDLLEXPORT wxControl: public wxControlBase
|
1998-09-18 06:19:10 -04:00
|
|
|
{
|
1998-10-18 18:31:48 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxControl)
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1998-09-18 06:19:10 -04:00
|
|
|
public:
|
1998-10-18 18:31:48 -04:00
|
|
|
wxControl();
|
1999-12-29 14:34:38 -05:00
|
|
|
wxControl( wxWindow *parent,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString &name = wxControlNameStr )
|
2000-01-07 09:59:14 -05:00
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
|
|
|
}
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2000-01-07 09:59:14 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
2002-02-05 11:34:33 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxControlNameStr);
|
|
|
|
|
1999-07-23 17:03:02 -04:00
|
|
|
// simulates the event, returns TRUE if the event was processed
|
|
|
|
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1999-07-23 17:03:02 -04:00
|
|
|
// calls the callback and appropriate event handlers, returns TRUE if
|
|
|
|
// event was processed
|
|
|
|
virtual bool ProcessCommand(wxCommandEvent& event);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1998-10-18 18:31:48 -04:00
|
|
|
virtual void SetLabel(const wxString& label);
|
|
|
|
virtual wxString GetLabel() const ;
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1999-07-23 17:03:02 -04:00
|
|
|
#if WXWIN_COMPATIBILITY
|
1999-03-30 06:09:48 -05:00
|
|
|
void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1999-03-30 06:09:48 -05:00
|
|
|
wxFunction GetCallback() { return m_callback; }
|
1999-07-23 17:03:02 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1999-03-30 06:09:48 -05:00
|
|
|
bool InSetValue() const { return m_inSetValue; }
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1998-09-18 06:19:10 -04:00
|
|
|
protected:
|
2002-12-08 13:48:05 -05:00
|
|
|
// calls wxControlBase::CreateControl, also sets foreground, background and
|
|
|
|
// font to parent's values
|
|
|
|
bool CreateControl(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style,
|
|
|
|
const wxValidator& validator,
|
|
|
|
const wxString& name);
|
|
|
|
|
1999-07-23 17:03:02 -04:00
|
|
|
#if WXWIN_COMPATIBILITY
|
1998-10-18 18:31:48 -04:00
|
|
|
wxFunction m_callback; // Callback associated with the window
|
1999-07-23 17:03:02 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
2002-02-05 11:34:33 -05:00
|
|
|
|
1998-10-18 18:31:48 -04:00
|
|
|
bool m_inSetValue; // Motif: prevent callbacks being called while
|
2002-02-05 11:34:33 -05:00
|
|
|
// in SetValue
|
|
|
|
|
1998-10-18 18:31:48 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-09-18 06:19:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2002-02-05 11:34:33 -05:00
|
|
|
// _WX_CONTROL_H_
|