1 /////////////////////////////////////////////////////////////////////////////
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 WXDLLEXPORT 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
44 bool Create( wxWindow
* pParent
46 ,const wxPoint
& rPos
= wxDefaultPosition
47 ,const wxSize
& rSize
= wxDefaultSize
49 ,const wxValidator
& rValidator
= wxDefaultValidator
50 ,const wxString
& rsName
= wxControlNameStr
56 virtual void Command(wxCommandEvent
& rEvent
) { ProcessCommand(rEvent
); }
59 // Implementation from now on
60 // --------------------------
64 // Calls the callback and appropriate event handlers
66 bool ProcessCommand(wxCommandEvent
& rEvent
);
69 // For ownerdraw items
71 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT
* WXUNUSED(pItem
)) { return FALSE
; };
72 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT
* WXUNUSED(pItem
)) { return 0L; };
74 wxArrayLong
& GetSubcontrols() { return m_aSubControls
; }
75 void OnEraseBackground(wxEraseEvent
& rEvent
);
76 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
84 #if WXWIN_COMPATIBILITY
85 virtual void SetButtonColour(const wxColour
& WXUNUSED(rCol
)) { }
86 wxColour
* GetButtonColour(void) const { return NULL
; }
88 inline virtual void SetLabelFont(const wxFont
& rFont
);
89 inline virtual void SetButtonFont(const wxFont
& rFont
);
90 inline wxFont
& GetLabelFont(void) const;
91 inline wxFont
& GetButtonFont(void) const;
92 #endif // WXWIN_COMPATIBILITY
96 // For controls like radiobuttons which are really composite
98 wxArrayLong m_aSubControls
;
100 virtual wxSize
DoGetBestSize(void) const;
103 // Create the control of the given PM class
105 bool OS2CreateControl( const wxChar
* zClassname
106 ,const wxString
& rsLabel
112 // Create the control of the given class with the given style, returns FALSE
113 // if creation failed.
115 bool OS2CreateControl( const wxChar
* zClassname
117 ,const wxPoint
& rPos
= wxDefaultPosition
118 ,const wxSize
& rSize
= wxDefaultSize
119 ,const wxString
& rsLabel
= wxEmptyString
120 ,WXDWORD dwExstyle
= (WXDWORD
)-1
124 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
126 virtual WXDWORD
OS2GetStyle( long lStyle
130 inline int GetXComp(void) const {return m_nXComp
;}
131 inline int GetYComp(void) const {return m_nYComp
;}
132 inline void SetXComp(const int nXComp
) {m_nXComp
= nXComp
;}
133 inline void SetYComp(const int nYComp
) {m_nYComp
= nYComp
;}
138 DECLARE_EVENT_TABLE()
139 }; // end of wxControl
141 #if WXWIN_COMPATIBILITY
142 inline wxFont
& wxControl::GetLabelFont(void) const { return GetFont(); }
143 inline wxFont
& wxControl::GetButtonFont(void) const { return GetFont(); }
144 inline void wxControl::SetLabelFont(const wxFont
& rFont
) { SetFont(rFont
); }
145 inline void wxControl::SetButtonFont(const wxFont
& rFont
) { SetFont(rFont
); }
146 #endif // WXWIN_COMPATIBILITY
148 #endif // _WX_CONTROL_H_