1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/control.h
3 // Purpose: wxControl class
4 // Author: David Webster
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_CONTROL_H_
12 #define _WX_CONTROL_H_
14 #include "wx/dynarray.h"
17 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
19 DECLARE_ABSTRACT_CLASS(wxControl
)
23 wxControl( wxWindow
* pParent
25 ,const wxPoint
& rPos
= wxDefaultPosition
26 ,const wxSize
& rSize
= wxDefaultSize
28 ,const wxValidator
& rValidator
= wxDefaultValidator
29 ,const wxString
& rsName
= wxControlNameStr
32 Create( pParent
, vId
, rPos
, rSize
, lStyle
, rValidator
, rsName
);
35 bool Create( wxWindow
* pParent
37 ,const wxPoint
& rPos
= wxDefaultPosition
38 ,const wxSize
& rSize
= wxDefaultSize
40 ,const wxValidator
& rValidator
= wxDefaultValidator
41 ,const wxString
& rsName
= wxControlNameStr
44 virtual void SetLabel(const wxString
& rsLabel
);
45 virtual wxString
GetLabel() const { return m_label
; }
50 virtual void Command(wxCommandEvent
& rEvent
) { ProcessCommand(rEvent
); }
53 // Implementation from now on
54 // --------------------------
58 // Calls the callback and appropriate event handlers
60 bool ProcessCommand(wxCommandEvent
& rEvent
);
63 // For ownerdraw items
65 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT
* WXUNUSED(pItem
)) { return false; }
66 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT
* WXUNUSED(pItem
)) { return 0L; }
68 wxArrayLong
& GetSubcontrols() { return m_aSubControls
; }
69 void OnEraseBackground(wxEraseEvent
& rEvent
);
70 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
80 // For controls like radiobuttons which are really composite
82 wxArrayLong m_aSubControls
;
84 virtual wxSize
DoGetBestSize(void) const;
87 // Create the control of the given PM class
89 bool OS2CreateControl( const wxChar
* zClassname
90 ,const wxString
& rsLabel
96 // Create the control of the given class with the given style, returns false
97 // if creation failed.
99 bool OS2CreateControl( const wxChar
* zClassname
101 ,const wxPoint
& rPos
= wxDefaultPosition
102 ,const wxSize
& rSize
= wxDefaultSize
103 ,const wxString
& rsLabel
= wxEmptyString
104 ,WXDWORD dwExstyle
= (WXDWORD
)-1
108 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
110 virtual WXDWORD
OS2GetStyle( long lStyle
114 inline int GetXComp(void) const {return m_nXComp
;}
115 inline int GetYComp(void) const {return m_nYComp
;}
116 inline void SetXComp(const int nXComp
) {m_nXComp
= nXComp
;}
117 inline void SetYComp(const int nYComp
) {m_nYComp
= nYComp
;}
126 DECLARE_EVENT_TABLE()
127 }; // end of wxControl
129 #endif // _WX_CONTROL_H_