]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/control.h
applied tons of wxGrid patches
[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 WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
18
19 // General item class
20 class WXDLLEXPORT wxControl : public wxControlBase
21 {
22 DECLARE_ABSTRACT_CLASS(wxControl)
23
24 public:
25 wxControl();
26 wxControl( wxWindow* pParent
27 ,wxWindowID vId
28 ,const wxPoint& rPos = wxDefaultPosition
29 ,const wxSize& rSize = wxDefaultSize
30 ,long lStyle = 0
31 #if wxUSE_VALIDATORS
32 ,const wxValidator& rValidator = wxDefaultValidator
33 #endif
34 ,const wxString& rsName = wxControlNameStr
35 )
36 {
37 Create( pParent
38 ,vId
39 ,rPos
40 ,rSize
41 ,lStyle
42 ,rValidator
43 ,rsName
44 );
45 }
46 virtual ~wxControl();
47
48 bool Create( wxWindow* pParent
49 ,wxWindowID vId
50 ,const wxPoint& rPos = wxDefaultPosition
51 ,const wxSize& rSize = wxDefaultSize
52 ,long lStyle = 0
53 #if wxUSE_VALIDATORS
54 ,const wxValidator& rValidator = wxDefaultValidator
55 #endif
56 ,const wxString& rsName = wxControlNameStr
57 );
58
59 //
60 // Simulates an event
61 //
62 virtual void Command(wxCommandEvent& rEvent) { ProcessCommand(rEvent); }
63
64 //
65 // Implementation from now on
66 // --------------------------
67 //
68
69 //
70 // Calls the callback and appropriate event handlers
71 //
72 bool ProcessCommand(wxCommandEvent& rEvent);
73
74 //
75 // For ownerdraw items
76 //
77 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
78 virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
79
80 wxArrayLong& GetSubcontrols() { return m_aSubControls; }
81 void OnEraseBackground(wxEraseEvent& rEvent);
82 virtual WXHBRUSH OnCtlColor( WXHDC hDC
83 ,WXHWND pWnd
84 ,WXUINT nCtlColor
85 ,WXUINT uMessage
86 ,WXWPARAM wParam
87 ,WXLPARAM lParam
88 );
89
90 #if WXWIN_COMPATIBILITY
91 virtual void SetButtonColour(const wxColour& WXUNUSED(rCol)) { }
92 wxColour* GetButtonColour(void) const { return NULL; }
93
94 inline virtual void SetLabelFont(const wxFont& rFont);
95 inline virtual void SetButtonFont(const wxFont& rFont);
96 inline wxFont& GetLabelFont(void) const;
97 inline wxFont& GetButtonFont(void) const;
98
99 //
100 // Adds callback
101 //
102 inline void Callback(const wxFunction function);
103 wxFunction GetCallback(void) { return m_callback; }
104
105 protected:
106 wxFunction m_callback; // Callback associated with the window
107 #endif // WXWIN_COMPATIBILITY
108
109 protected:
110 //
111 // For controls like radiobuttons which are really composite
112 //
113 wxArrayLong m_aSubControls;
114
115 virtual wxSize DoGetBestSize(void) const;
116
117 //
118 // Create the control of the given class with the given style, returns FALSE
119 // if creation failed.
120 //
121 bool OS2CreateControl( const wxChar* zClassname
122 ,WXDWORD dwStyle
123 ,const wxPoint& rPos = wxDefaultPosition
124 ,const wxSize& rSize = wxDefaultSize
125 ,const wxString& rsLabel = wxEmptyString
126 ,WXDWORD dwExstyle = (WXDWORD)-1
127 );
128
129 //
130 // Determine the extended styles combination for this window (may slightly
131 // modify styl parameter)
132 //
133 WXDWORD GetExStyle(WXDWORD& rStyle) const;
134
135 private:
136 DECLARE_EVENT_TABLE()
137 }; // end of wxControl
138
139 #if WXWIN_COMPATIBILITY
140 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
141 inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); }
142 inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); }
143 inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); }
144 inline void wxControl::SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
145 #endif // WXWIN_COMPATIBILITY
146
147 #endif // _WX_CONTROL_H_
148