]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/control.h
Correction for wxFileConfig where UNIX was taken
[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
a5569657
DW
17WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
18
0e320a79 19// General item class
45fcbf3b 20class WXDLLEXPORT wxControl : public wxControlBase
0e320a79 21{
45fcbf3b
DW
22 DECLARE_ABSTRACT_CLASS(wxControl)
23
0e320a79
DW
24public:
25 wxControl();
d608dde1
DW
26 wxControl( wxWindow* pParent
27 ,wxWindowID vId
28 ,const wxPoint& rPos = wxDefaultPosition
29 ,const wxSize& rSize = wxDefaultSize
30 ,long lStyle = 0
a5569657 31#if wxUSE_VALIDATORS
d608dde1 32 ,const wxValidator& rValidator = wxDefaultValidator
a5569657 33#endif
d608dde1
DW
34 ,const wxString& rsName = wxControlNameStr
35 )
a5569657 36 {
d608dde1
DW
37 Create( pParent
38 ,vId
39 ,rPos
40 ,rSize
41 ,lStyle
42 ,rValidator
43 ,rsName
44 );
a5569657 45 }
d608dde1 46 virtual ~wxControl();
a5569657 47
d608dde1
DW
48 bool Create( wxWindow* pParent
49 ,wxWindowID vId
50 ,const wxPoint& rPos = wxDefaultPosition
51 ,const wxSize& rSize = wxDefaultSize
52 ,long lStyle = 0
a5569657 53#if wxUSE_VALIDATORS
d608dde1 54 ,const wxValidator& rValidator = wxDefaultValidator
a5569657 55#endif
d608dde1
DW
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 );
0e320a79 89
45fcbf3b 90#if WXWIN_COMPATIBILITY
d608dde1
DW
91 virtual void SetButtonColour(const wxColour& WXUNUSED(rCol)) { }
92 wxColour* GetButtonColour(void) const { return NULL; }
0e320a79 93
d608dde1
DW
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;
45fcbf3b 98
d608dde1
DW
99 //
100 // Adds callback
101 //
102 inline void Callback(const wxFunction function);
103 wxFunction GetCallback(void) { return m_callback; }
0e320a79
DW
104
105protected:
d608dde1 106 wxFunction m_callback; // Callback associated with the window
45fcbf3b
DW
107#endif // WXWIN_COMPATIBILITY
108
109protected:
d608dde1
DW
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;
45fcbf3b
DW
134
135private:
136 DECLARE_EVENT_TABLE()
d608dde1 137}; // end of wxControl
45fcbf3b
DW
138
139#if WXWIN_COMPATIBILITY
140 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
d608dde1
DW
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); }
45fcbf3b
DW
145#endif // WXWIN_COMPATIBILITY
146
d608dde1
DW
147#endif // _WX_CONTROL_H_
148