]> git.saurik.com Git - wxWidgets.git/blame - src/os2/statbox.cpp
Update OpenVMS compile support
[wxWidgets.git] / src / os2 / statbox.cpp
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
670f9935 2// Name: src/os2/statbox.cpp
0e320a79 3// Purpose: wxStaticBox
409c9842 4// Author: David Webster
0e320a79
DW
5// Modified by:
6// Created: ??/??/98
409c9842 7// Copyright: (c) David Webster
65571936 8// Licence: wxWindows licence
0e320a79
DW
9/////////////////////////////////////////////////////////////////////////////
10
409c9842
DW
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
670f9935 14#include "wx/statbox.h"
409c9842
DW
15
16#ifndef WX_PRECOMP
670f9935
WS
17 #include "wx/app.h"
18 #include "wx/dcclient.h"
cdccdfab 19 #include "wx/window.h"
0e320a79
DW
20#endif
21
670f9935 22#include "wx/os2/private.h"
0e320a79 23
670f9935
WS
24bool 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 )
0e320a79 31{
b9b1d6c8
DW
32 if(!CreateControl( pParent
33 ,vId
34 ,rPos
35 ,rSize
36 ,lStyle
b9b1d6c8 37 ,wxDefaultValidator
b9b1d6c8
DW
38 ,rsName
39 ))
3c299c3a 40 {
670f9935 41 return false;
3c299c3a 42 }
409c9842 43
670f9935
WS
44 wxPoint vPos(0,0);
45 wxSize vSize(0,0);
409c9842 46
0fba44b4 47 if (!OS2CreateControl( wxT("STATIC")
3c299c3a
DW
48 ,SS_GROUPBOX
49 ,vPos
50 ,vSize
51 ,rsLabel
52 ))
53 {
670f9935 54 return false;
3c299c3a 55 }
409c9842 56
b9b1d6c8
DW
57 //
58 // To be transparent we should have the same colour as the parent as well
59 //
60 SetBackgroundColour(GetParent()->GetBackgroundColour());
61
19bc1514 62 LONG lColor = (LONG)wxBLACK->GetPixel();
3c299c3a
DW
63 ::WinSetPresParam( m_hWnd
64 ,PP_FOREGROUNDCOLOR
65 ,sizeof(LONG)
66 ,(PVOID)&lColor
67 );
7993e67c 68
154daa94 69 lColor = (LONG)m_backgroundColour.GetPixel();
7993e67c
DW
70 ::WinSetPresParam( m_hWnd
71 ,PP_BACKGROUNDCOLOR
72 ,sizeof(LONG)
73 ,(PVOID)&lColor
74 );
3c299c3a
DW
75 SetSize( rPos.x
76 ,rPos.y
77 ,rSize.x
78 ,rSize.y
79 );
670f9935 80 return true;
3c299c3a 81} // end of wxStaticBox::Create
0e320a79 82
3c299c3a 83wxSize wxStaticBox::DoGetBestSize() const
0e320a79 84{
3c299c3a
DW
85 int nCx;
86 int nCy;
87 int wBox;
88
c5f975dd
SN
89 nCx = GetCharWidth();
90 nCy = GetCharHeight();
3c299c3a
DW
91 GetTextExtent( wxGetWindowText(m_hWnd)
92 ,&wBox
c5f975dd 93 ,NULL
3c299c3a
DW
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
670f9935
WS
104MRESULT wxStaticBox::OS2WindowProc( WXUINT nMsg,
105 WXWPARAM wParam,
106 WXLPARAM lParam )
409c9842 107{
a885d89a 108 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
3c299c3a 109} // end of wxStaticBox::OS2WindowProc