Remove obsolete VisualAge-related files.
[wxWidgets.git] / src / os2 / statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/statbox.cpp
3 // Purpose: wxStaticBox
4 // Author: David Webster
5 // Modified by:
6 // Created: ??/??/98
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #include "wx/statbox.h"
15
16 #ifndef WX_PRECOMP
17 #include "wx/app.h"
18 #include "wx/dcclient.h"
19 #include "wx/window.h"
20 #endif
21
22 #include "wx/os2/private.h"
23
24 bool wxStaticBox::Create( wxWindow* pParent,
25 wxWindowID vId,
26 const wxString& rsLabel,
27 const wxPoint& rPos,
28 const wxSize& rSize,
29 long lStyle,
30 const wxString& rsName )
31 {
32 if(!CreateControl( pParent
33 ,vId
34 ,rPos
35 ,rSize
36 ,lStyle
37 ,wxDefaultValidator
38 ,rsName
39 ))
40 {
41 return false;
42 }
43
44 wxPoint vPos(0,0);
45 wxSize vSize(0,0);
46
47 if (!OS2CreateControl( wxT("STATIC")
48 ,SS_GROUPBOX
49 ,vPos
50 ,vSize
51 ,rsLabel
52 ))
53 {
54 return false;
55 }
56
57 //
58 // To be transparent we should have the same colour as the parent as well
59 //
60 SetBackgroundColour(GetParent()->GetBackgroundColour());
61
62 LONG lColor = (LONG)wxBLACK->GetPixel();
63 ::WinSetPresParam( m_hWnd
64 ,PP_FOREGROUNDCOLOR
65 ,sizeof(LONG)
66 ,(PVOID)&lColor
67 );
68
69 lColor = (LONG)m_backgroundColour.GetPixel();
70 ::WinSetPresParam( m_hWnd
71 ,PP_BACKGROUNDCOLOR
72 ,sizeof(LONG)
73 ,(PVOID)&lColor
74 );
75 SetSize( rPos.x
76 ,rPos.y
77 ,rSize.x
78 ,rSize.y
79 );
80 return true;
81 } // end of wxStaticBox::Create
82
83 wxSize wxStaticBox::DoGetBestSize() const
84 {
85 int nCx;
86 int nCy;
87 int wBox;
88
89 nCx = GetCharWidth();
90 nCy = GetCharHeight();
91 GetTextExtent( wxGetWindowText(m_hWnd)
92 ,&wBox
93 ,NULL
94 );
95 wBox += 3 * nCx;
96
97 int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
98
99 return wxSize( wBox
100 ,hBox
101 );
102 } // end of wxStaticBox::DoGetBestSize
103
104 MRESULT wxStaticBox::OS2WindowProc( WXUINT nMsg,
105 WXWPARAM wParam,
106 WXLPARAM lParam )
107 {
108 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
109 } // end of wxStaticBox::OS2WindowProc