]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/control.h
Implemented Enable for wxMenuBar to avoid assert
[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
d608dde1 29 ,const wxValidator& rValidator = wxDefaultValidator
d608dde1
DW
30 ,const wxString& rsName = wxControlNameStr
31 )
a5569657 32 {
d608dde1
DW
33 Create( pParent
34 ,vId
35 ,rPos
36 ,rSize
37 ,lStyle
38 ,rValidator
39 ,rsName
40 );
a5569657 41 }
d608dde1 42 virtual ~wxControl();
a5569657 43
d608dde1
DW
44 bool Create( wxWindow* pParent
45 ,wxWindowID vId
46 ,const wxPoint& rPos = wxDefaultPosition
47 ,const wxSize& rSize = wxDefaultSize
48 ,long lStyle = 0
d608dde1 49 ,const wxValidator& rValidator = wxDefaultValidator
d608dde1
DW
50 ,const wxString& rsName = wxControlNameStr
51 );
52
d37bb826
SN
53 virtual void SetLabel(const wxString& rsLabel);
54
d608dde1
DW
55 //
56 // Simulates an event
57 //
58 virtual void Command(wxCommandEvent& rEvent) { ProcessCommand(rEvent); }
59
60 //
61 // Implementation from now on
62 // --------------------------
63 //
64
65 //
66 // Calls the callback and appropriate event handlers
67 //
68 bool ProcessCommand(wxCommandEvent& rEvent);
69
70 //
71 // For ownerdraw items
72 //
73 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
f5ea767e 74 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; };
d608dde1
DW
75
76 wxArrayLong& GetSubcontrols() { return m_aSubControls; }
77 void OnEraseBackground(wxEraseEvent& rEvent);
78 virtual WXHBRUSH OnCtlColor( WXHDC hDC
79 ,WXHWND pWnd
80 ,WXUINT nCtlColor
81 ,WXUINT uMessage
82 ,WXWPARAM wParam
83 ,WXLPARAM lParam
84 );
0e320a79 85
afa59b4e 86public:
d608dde1
DW
87 //
88 // For controls like radiobuttons which are really composite
89 //
90 wxArrayLong m_aSubControls;
91
92 virtual wxSize DoGetBestSize(void) const;
93
b9b1d6c8
DW
94 //
95 // Create the control of the given PM class
96 //
97 bool OS2CreateControl( const wxChar* zClassname
98 ,const wxString& rsLabel
99 ,const wxPoint& rPos
100 ,const wxSize& rSize
101 ,long lStyle
fb49f3b3 102 );
d608dde1
DW
103 //
104 // Create the control of the given class with the given style, returns FALSE
105 // if creation failed.
106 //
107 bool OS2CreateControl( const wxChar* zClassname
108 ,WXDWORD dwStyle
109 ,const wxPoint& rPos = wxDefaultPosition
110 ,const wxSize& rSize = wxDefaultSize
111 ,const wxString& rsLabel = wxEmptyString
112 ,WXDWORD dwExstyle = (WXDWORD)-1
113 );
114
115 //
b9b1d6c8 116 // Default style for the control include WS_TABSTOP if it AcceptsFocus()
d608dde1 117 //
b9b1d6c8
DW
118 virtual WXDWORD OS2GetStyle( long lStyle
119 ,WXDWORD* pdwExstyle
120 ) const;
45fcbf3b 121
afa59b4e
DW
122 inline int GetXComp(void) const {return m_nXComp;}
123 inline int GetYComp(void) const {return m_nYComp;}
124 inline void SetXComp(const int nXComp) {m_nXComp = nXComp;}
125 inline void SetYComp(const int nYComp) {m_nYComp = nYComp;}
126
45fcbf3b 127private:
afa59b4e
DW
128 int m_nXComp;
129 int m_nYComp;
45fcbf3b 130 DECLARE_EVENT_TABLE()
d608dde1 131}; // end of wxControl
45fcbf3b 132
d608dde1
DW
133#endif // _WX_CONTROL_H_
134