]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/control.h
fixes to the new pointer array implementation
[wxWidgets.git] / include / wx / os2 / control.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
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
DW
8// Copyright: (c) Julian Smart
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
45fcbf3b 18class WXDLLEXPORT wxControl : public wxControlBase
0e320a79 19{
45fcbf3b
DW
20 DECLARE_ABSTRACT_CLASS(wxControl)
21
0e320a79
DW
22public:
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
a5569657 29#if wxUSE_VALIDATORS
d608dde1 30 ,const wxValidator& rValidator = wxDefaultValidator
a5569657 31#endif
d608dde1
DW
32 ,const wxString& rsName = wxControlNameStr
33 )
a5569657 34 {
d608dde1
DW
35 Create( pParent
36 ,vId
37 ,rPos
38 ,rSize
39 ,lStyle
40 ,rValidator
41 ,rsName
42 );
a5569657 43 }
d608dde1 44 virtual ~wxControl();
a5569657 45
d608dde1
DW
46 bool Create( wxWindow* pParent
47 ,wxWindowID vId
48 ,const wxPoint& rPos = wxDefaultPosition
49 ,const wxSize& rSize = wxDefaultSize
50 ,long lStyle = 0
a5569657 51#if wxUSE_VALIDATORS
d608dde1 52 ,const wxValidator& rValidator = wxDefaultValidator
a5569657 53#endif
d608dde1
DW
54 ,const wxString& rsName = wxControlNameStr
55 );
56
57 //
58 // Simulates an event
59 //
60 virtual void Command(wxCommandEvent& rEvent) { ProcessCommand(rEvent); }
61
62 //
63 // Implementation from now on
64 // --------------------------
65 //
66
67 //
68 // Calls the callback and appropriate event handlers
69 //
70 bool ProcessCommand(wxCommandEvent& rEvent);
71
72 //
73 // For ownerdraw items
74 //
75 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
76 virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
77
78 wxArrayLong& GetSubcontrols() { return m_aSubControls; }
79 void OnEraseBackground(wxEraseEvent& rEvent);
80 virtual WXHBRUSH OnCtlColor( WXHDC hDC
81 ,WXHWND pWnd
82 ,WXUINT nCtlColor
83 ,WXUINT uMessage
84 ,WXWPARAM wParam
85 ,WXLPARAM lParam
86 );
0e320a79 87
45fcbf3b 88#if WXWIN_COMPATIBILITY
d608dde1
DW
89 virtual void SetButtonColour(const wxColour& WXUNUSED(rCol)) { }
90 wxColour* GetButtonColour(void) const { return NULL; }
0e320a79 91
d608dde1
DW
92 inline virtual void SetLabelFont(const wxFont& rFont);
93 inline virtual void SetButtonFont(const wxFont& rFont);
94 inline wxFont& GetLabelFont(void) const;
95 inline wxFont& GetButtonFont(void) const;
45fcbf3b 96
d608dde1
DW
97 //
98 // Adds callback
99 //
100 inline void Callback(const wxFunction function);
101 wxFunction GetCallback(void) { return m_callback; }
0e320a79
DW
102
103protected:
d608dde1 104 wxFunction m_callback; // Callback associated with the window
45fcbf3b
DW
105#endif // WXWIN_COMPATIBILITY
106
afa59b4e 107public:
d608dde1
DW
108 //
109 // For controls like radiobuttons which are really composite
110 //
111 wxArrayLong m_aSubControls;
112
113 virtual wxSize DoGetBestSize(void) const;
114
b9b1d6c8
DW
115 //
116 // Create the control of the given PM class
117 //
118 bool OS2CreateControl( const wxChar* zClassname
119 ,const wxString& rsLabel
120 ,const wxPoint& rPos
121 ,const wxSize& rSize
122 ,long lStyle
fb49f3b3 123 );
d608dde1
DW
124 //
125 // Create the control of the given class with the given style, returns FALSE
126 // if creation failed.
127 //
128 bool OS2CreateControl( const wxChar* zClassname
129 ,WXDWORD dwStyle
130 ,const wxPoint& rPos = wxDefaultPosition
131 ,const wxSize& rSize = wxDefaultSize
132 ,const wxString& rsLabel = wxEmptyString
133 ,WXDWORD dwExstyle = (WXDWORD)-1
134 );
135
136 //
b9b1d6c8 137 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
d608dde1 138 //
b9b1d6c8
DW
139 virtual WXDWORD OS2GetStyle( long lStyle
140 ,WXDWORD* pdwExstyle
141 ) const;
45fcbf3b 142
afa59b4e
DW
143 inline int GetXComp(void) const {return m_nXComp;}
144 inline int GetYComp(void) const {return m_nYComp;}
145 inline void SetXComp(const int nXComp) {m_nXComp = nXComp;}
146 inline void SetYComp(const int nYComp) {m_nYComp = nYComp;}
147
45fcbf3b 148private:
afa59b4e
DW
149 int m_nXComp;
150 int m_nYComp;
45fcbf3b 151 DECLARE_EVENT_TABLE()
d608dde1 152}; // end of wxControl
45fcbf3b
DW
153
154#if WXWIN_COMPATIBILITY
155 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
d608dde1
DW
156 inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); }
157 inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); }
158 inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); }
159 inline void wxControl::SetButtonFont(const wxFont& rFont) { SetFont(rFont); }
45fcbf3b
DW
160#endif // WXWIN_COMPATIBILITY
161
d608dde1
DW
162#endif // _WX_CONTROL_H_
163