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