1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/control.h
3 // Purpose: wxControl class
4 // Author: David Webster
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
15 #include "wx/dynarray.h"
18 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
20 DECLARE_ABSTRACT_CLASS(wxControl
)
24 wxControl( wxWindow
* pParent
26 ,const wxPoint
& rPos
= wxDefaultPosition
27 ,const wxSize
& rSize
= wxDefaultSize
29 ,const wxValidator
& rValidator
= wxDefaultValidator
30 ,const wxString
& rsName
= wxControlNameStr
33 Create( pParent
, vId
, rPos
, rSize
, lStyle
, rValidator
, rsName
);
36 bool Create( wxWindow
* pParent
38 ,const wxPoint
& rPos
= wxDefaultPosition
39 ,const wxSize
& rSize
= wxDefaultSize
41 ,const wxValidator
& rValidator
= wxDefaultValidator
42 ,const wxString
& rsName
= wxControlNameStr
45 virtual void SetLabel(const wxString
& rsLabel
);
46 virtual wxString
GetLabel() const { return m_label
; }
51 virtual void Command(wxCommandEvent
& rEvent
) { ProcessCommand(rEvent
); }
54 // Implementation from now on
55 // --------------------------
59 // Calls the callback and appropriate event handlers
61 bool ProcessCommand(wxCommandEvent
& rEvent
);
64 // For ownerdraw items
66 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT
* WXUNUSED(pItem
)) { return false; };
67 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT
* WXUNUSED(pItem
)) { return 0L; };
69 wxArrayLong
& GetSubcontrols() { return m_aSubControls
; }
70 void OnEraseBackground(wxEraseEvent
& rEvent
);
71 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
81 // For controls like radiobuttons which are really composite
83 wxArrayLong m_aSubControls
;
85 virtual wxSize
DoGetBestSize(void) const;
88 // Create the control of the given PM class
90 bool OS2CreateControl( const wxChar
* zClassname
91 ,const wxString
& rsLabel
97 // Create the control of the given class with the given style, returns false
98 // if creation failed.
100 bool OS2CreateControl( const wxChar
* zClassname
102 ,const wxPoint
& rPos
= wxDefaultPosition
103 ,const wxSize
& rSize
= wxDefaultSize
104 ,const wxString
& rsLabel
= wxEmptyString
105 ,WXDWORD dwExstyle
= (WXDWORD
)-1
109 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
111 virtual WXDWORD
OS2GetStyle( long lStyle
115 inline int GetXComp(void) const {return m_nXComp
;}
116 inline int GetYComp(void) const {return m_nYComp
;}
117 inline void SetXComp(const int nXComp
) {m_nXComp
= nXComp
;}
118 inline void SetYComp(const int nYComp
) {m_nYComp
= nYComp
;}
127 DECLARE_EVENT_TABLE()
128 }; // end of wxControl
130 #endif // _WX_CONTROL_H_