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