]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/control.h
fixed incorrect assert (patch #943970)
[wxWidgets.git] / include / wx / os2 / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose: wxControl class
4 // Author: David Webster
5 // Modified by:
6 // Created: 09/17/99
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
14
15 #include "wx/dynarray.h"
16
17 // General item class
18 class WXDLLEXPORT wxControl : public wxControlBase
19 {
20 DECLARE_ABSTRACT_CLASS(wxControl)
21
22 public:
23 wxControl();
24 wxControl( wxWindow* pParent
25 ,wxWindowID vId
26 ,const wxPoint& rPos = wxDefaultPosition
27 ,const wxSize& rSize = wxDefaultSize
28 ,long lStyle = 0
29 ,const wxValidator& rValidator = wxDefaultValidator
30 ,const wxString& rsName = wxControlNameStr
31 )
32 {
33 Create( pParent
34 ,vId
35 ,rPos
36 ,rSize
37 ,lStyle
38 ,rValidator
39 ,rsName
40 );
41 }
42 virtual ~wxControl();
43
44 bool Create( wxWindow* pParent
45 ,wxWindowID vId
46 ,const wxPoint& rPos = wxDefaultPosition
47 ,const wxSize& rSize = wxDefaultSize
48 ,long lStyle = 0
49 ,const wxValidator& rValidator = wxDefaultValidator
50 ,const wxString& rsName = wxControlNameStr
51 );
52
53 virtual void SetLabel(const wxString& rsLabel);
54
55 //
56 // Simulates an event
57 //
58 virtual void Command(wxCommandEvent& rEvent) { ProcessCommand(rEvent); }
59
60 //
61 // Implementation from now on
62 // --------------------------
63 //
64
65 //
66 // Calls the callback and appropriate event handlers
67 //
68 bool ProcessCommand(wxCommandEvent& rEvent);
69
70 //
71 // For ownerdraw items
72 //
73 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
74 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; };
75
76 wxArrayLong& GetSubcontrols() { return m_aSubControls; }
77 void OnEraseBackground(wxEraseEvent& rEvent);
78 virtual WXHBRUSH OnCtlColor( WXHDC hDC
79 ,WXHWND pWnd
80 ,WXUINT nCtlColor
81 ,WXUINT uMessage
82 ,WXWPARAM wParam
83 ,WXLPARAM lParam
84 );
85
86 public:
87 //
88 // For controls like radiobuttons which are really composite
89 //
90 wxArrayLong m_aSubControls;
91
92 virtual wxSize DoGetBestSize(void) const;
93
94 //
95 // Create the control of the given PM class
96 //
97 bool OS2CreateControl( const wxChar* zClassname
98 ,const wxString& rsLabel
99 ,const wxPoint& rPos
100 ,const wxSize& rSize
101 ,long lStyle
102 );
103 //
104 // Create the control of the given class with the given style, returns FALSE
105 // if creation failed.
106 //
107 bool OS2CreateControl( const wxChar* zClassname
108 ,WXDWORD dwStyle
109 ,const wxPoint& rPos = wxDefaultPosition
110 ,const wxSize& rSize = wxDefaultSize
111 ,const wxString& rsLabel = wxEmptyString
112 ,WXDWORD dwExstyle = (WXDWORD)-1
113 );
114
115 //
116 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
117 //
118 virtual WXDWORD OS2GetStyle( long lStyle
119 ,WXDWORD* pdwExstyle
120 ) const;
121
122 inline int GetXComp(void) const {return m_nXComp;}
123 inline int GetYComp(void) const {return m_nYComp;}
124 inline void SetXComp(const int nXComp) {m_nXComp = nXComp;}
125 inline void SetYComp(const int nYComp) {m_nYComp = nYComp;}
126
127 private:
128 int m_nXComp;
129 int m_nYComp;
130 DECLARE_EVENT_TABLE()
131 }; // end of wxControl
132
133 #endif // _WX_CONTROL_H_
134