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