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
|
|
|
|
// 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
|
2000-01-05 09:07:15 -05:00
|
|
|
#if wxUSE_VALIDATORS
|
2001-04-18 16:46:23 -04:00
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
2000-01-05 09:07:15 -05:00
|
|
|
#endif
|
2001-04-18 16:46:23 -04:00
|
|
|
,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
|
2000-01-05 09:07:15 -05:00
|
|
|
#if wxUSE_VALIDATORS
|
2001-04-18 16:46:23 -04:00
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
2000-01-05 09:07:15 -05:00
|
|
|
#endif
|
2001-04-18 16:46:23 -04:00
|
|
|
,const wxString& rsName = wxControlNameStr
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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; };
|
|
|
|
virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
|
|
|
|
|
|
|
|
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
|
|
|
|
1999-09-20 00:49:19 -04:00
|
|
|
#if WXWIN_COMPATIBILITY
|
2001-04-18 16:46:23 -04:00
|
|
|
virtual void SetButtonColour(const wxColour& WXUNUSED(rCol)) { }
|
|
|
|
wxColour* GetButtonColour(void) const { return NULL; }
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
inline virtual void SetLabelFont(const wxFont& rFont);
|
|
|
|
inline virtual void SetButtonFont(const wxFont& rFont);
|
|
|
|
inline wxFont& GetLabelFont(void) const;
|
|
|
|
inline wxFont& GetButtonFont(void) const;
|
1999-09-20 00:49:19 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Adds callback
|
|
|
|
//
|
|
|
|
inline void Callback(const wxFunction function);
|
|
|
|
wxFunction GetCallback(void) { return m_callback; }
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
protected:
|
2001-04-18 16:46:23 -04:00
|
|
|
wxFunction m_callback; // Callback associated with the window
|
1999-09-20 00:49:19 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
|
|
|
|
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;
|
|
|
|
|
2001-11-16 13:40:45 -05:00
|
|
|
bool OS2CreateControl( wxWindow* pParent
|
|
|
|
,wxWindowID lId
|
|
|
|
,const wxPoint& rPos
|
|
|
|
,const wxSize& rSize
|
|
|
|
,long lStyle
|
|
|
|
#if wxUSE_VALIDATORS
|
|
|
|
,const wxValidator& rValidator
|
|
|
|
#endif
|
|
|
|
,const wxString& rsName
|
|
|
|
);
|
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
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Determine the extended styles combination for this window (may slightly
|
|
|
|
// modify styl parameter)
|
|
|
|
//
|
|
|
|
WXDWORD GetExStyle(WXDWORD& rStyle) 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
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY
|
|
|
|
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
|
2001-04-18 16:46:23 -04:00
|
|
|
inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); }
|
|
|
|
inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); }
|
|
|
|
inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); }
|
|
|
|
inline void wxControl::SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
|
1999-09-20 00:49:19 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
#endif // _WX_CONTROL_H_
|
|
|
|
|