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