1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: control.h
|
|
|
|
// Purpose: wxControl class
|
1999-09-20 00:49:19 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-09-20 00:49:19 -04:00
|
|
|
// Created: 09/17/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-09-20 00:49:19 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CONTROL_H_
|
|
|
|
#define _WX_CONTROL_H_
|
|
|
|
|
2000-02-24 23:16:19 -05:00
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
// General item class
|
1999-09-20 00:49:19 -04:00
|
|
|
class WXDLLEXPORT wxControl : public wxControlBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
1999-09-20 00:49:19 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxControl)
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
public:
|
|
|
|
wxControl();
|
2001-04-18 16:46:23 -04:00
|
|
|
wxControl( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxControlNameStr
|
|
|
|
)
|
2000-01-05 09:07:15 -05:00
|
|
|
{
|
2001-04-18 16:46:23 -04:00
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,lStyle
|
|
|
|
,rValidator
|
|
|
|
,rsName
|
|
|
|
);
|
2000-01-05 09:07:15 -05:00
|
|
|
}
|
2001-04-18 16:46:23 -04:00
|
|
|
virtual ~wxControl();
|
2000-01-05 09:07:15 -05:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxControlNameStr
|
|
|
|
);
|
|
|
|
|
2004-02-15 13:00:27 -05:00
|
|
|
virtual void SetLabel(const wxString& rsLabel);
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Simulates an event
|
|
|
|
//
|
|
|
|
virtual void Command(wxCommandEvent& rEvent) { ProcessCommand(rEvent); }
|
|
|
|
|
|
|
|
//
|
|
|
|
// Implementation from now on
|
|
|
|
// --------------------------
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Calls the callback and appropriate event handlers
|
|
|
|
//
|
|
|
|
bool ProcessCommand(wxCommandEvent& rEvent);
|
|
|
|
|
|
|
|
//
|
|
|
|
// For ownerdraw items
|
|
|
|
//
|
|
|
|
virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
|
2002-09-03 18:26:53 -04:00
|
|
|
virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; };
|
2001-04-18 16:46:23 -04:00
|
|
|
|
|
|
|
wxArrayLong& GetSubcontrols() { return m_aSubControls; }
|
|
|
|
void OnEraseBackground(wxEraseEvent& rEvent);
|
|
|
|
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
|
|
|
,WXHWND pWnd
|
|
|
|
,WXUINT nCtlColor
|
|
|
|
,WXUINT uMessage
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-10-22 01:11:09 -04:00
|
|
|
public:
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// For controls like radiobuttons which are really composite
|
|
|
|
//
|
|
|
|
wxArrayLong m_aSubControls;
|
|
|
|
|
|
|
|
virtual wxSize DoGetBestSize(void) const;
|
|
|
|
|
2002-02-22 18:30:31 -05:00
|
|
|
//
|
|
|
|
// Create the control of the given PM class
|
|
|
|
//
|
|
|
|
bool OS2CreateControl( const wxChar* zClassname
|
|
|
|
,const wxString& rsLabel
|
|
|
|
,const wxPoint& rPos
|
|
|
|
,const wxSize& rSize
|
|
|
|
,long lStyle
|
2001-11-16 13:40:45 -05:00
|
|
|
);
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Create the control of the given class with the given style, returns FALSE
|
|
|
|
// if creation failed.
|
|
|
|
//
|
|
|
|
bool OS2CreateControl( const wxChar* zClassname
|
|
|
|
,WXDWORD dwStyle
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,const wxString& rsLabel = wxEmptyString
|
|
|
|
,WXDWORD dwExstyle = (WXDWORD)-1
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
2002-02-22 18:30:31 -05:00
|
|
|
// Default style for the control include WS_TABSTOP if it AcceptsFocus()
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
2002-02-22 18:30:31 -05:00
|
|
|
virtual WXDWORD OS2GetStyle( long lStyle
|
|
|
|
,WXDWORD* pdwExstyle
|
|
|
|
) const;
|
1999-09-20 00:49:19 -04:00
|
|
|
|
2001-10-22 01:11:09 -04:00
|
|
|
inline int GetXComp(void) const {return m_nXComp;}
|
|
|
|
inline int GetYComp(void) const {return m_nYComp;}
|
|
|
|
inline void SetXComp(const int nXComp) {m_nXComp = nXComp;}
|
|
|
|
inline void SetYComp(const int nYComp) {m_nYComp = nYComp;}
|
|
|
|
|
1999-09-20 00:49:19 -04:00
|
|
|
private:
|
2001-10-22 01:11:09 -04:00
|
|
|
int m_nXComp;
|
|
|
|
int m_nYComp;
|
1999-09-20 00:49:19 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-04-18 16:46:23 -04:00
|
|
|
}; // end of wxControl
|
1999-09-20 00:49:19 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
#endif // _WX_CONTROL_H_
|
|
|
|
|