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