]> git.saurik.com Git - wxWidgets.git/blame - src/os2/statbox.cpp
Implemented user dashes for PS print.
[wxWidgets.git] / src / os2 / statbox.cpp
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbox.cpp
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
15#include "wx/window.h"
16#include "wx/os2/private.h"
17
18#ifndef WX_PRECOMP
19#include "wx/app.h"
20#include "wx/dcclient.h"
0e320a79
DW
21#endif
22
23#include "wx/statbox.h"
24
0e320a79
DW
25IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
26
3c299c3a
DW
27bool wxStaticBox::Create(
28 wxWindow* pParent
29, wxWindowID vId
30, const wxString& rsLabel
31, const wxPoint& rPos
32, const wxSize& rSize
33, long lStyle
34, const wxString& rsName
35)
0e320a79 36{
b9b1d6c8
DW
37 if(!CreateControl( pParent
38 ,vId
39 ,rPos
40 ,rSize
41 ,lStyle
b9b1d6c8 42 ,wxDefaultValidator
b9b1d6c8
DW
43 ,rsName
44 ))
3c299c3a
DW
45 {
46 return FALSE;
47 }
409c9842 48
3c299c3a
DW
49 wxPoint vPos(0,0);
50 wxSize vSize(0,0);
409c9842 51
0fba44b4 52 if (!OS2CreateControl( wxT("STATIC")
3c299c3a
DW
53 ,SS_GROUPBOX
54 ,vPos
55 ,vSize
56 ,rsLabel
57 ))
58 {
59 return FALSE;
60 }
409c9842 61
b9b1d6c8
DW
62 //
63 // To be transparent we should have the same colour as the parent as well
64 //
65 SetBackgroundColour(GetParent()->GetBackgroundColour());
66
3c299c3a 67 wxColour vColour;
0fba44b4 68 vColour.Set(wxString(wxT("BLACK")));
3c299c3a 69 LONG lColor = (LONG)vColour.GetPixel();
3c299c3a
DW
70 ::WinSetPresParam( m_hWnd
71 ,PP_FOREGROUNDCOLOR
72 ,sizeof(LONG)
73 ,(PVOID)&lColor
74 );
7993e67c 75
154daa94 76 lColor = (LONG)m_backgroundColour.GetPixel();
7993e67c
DW
77 ::WinSetPresParam( m_hWnd
78 ,PP_BACKGROUNDCOLOR
79 ,sizeof(LONG)
80 ,(PVOID)&lColor
81 );
3c299c3a
DW
82 SetSize( rPos.x
83 ,rPos.y
84 ,rSize.x
85 ,rSize.y
86 );
87 return TRUE;
88} // end of wxStaticBox::Create
0e320a79 89
3c299c3a 90wxSize wxStaticBox::DoGetBestSize() const
0e320a79 91{
3c299c3a
DW
92 int nCx;
93 int nCy;
94 int wBox;
95
c5f975dd
SN
96 nCx = GetCharWidth();
97 nCy = GetCharHeight();
3c299c3a
DW
98 GetTextExtent( wxGetWindowText(m_hWnd)
99 ,&wBox
c5f975dd 100 ,NULL
3c299c3a
DW
101 );
102 wBox += 3 * nCx;
103
104 int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
105
106 return wxSize( wBox
107 ,hBox
108 );
109} // end of wxStaticBox::DoGetBestSize
110
111MRESULT wxStaticBox::OS2WindowProc(
112 WXUINT nMsg
113, WXWPARAM wParam
114, WXLPARAM lParam
115)
409c9842 116{
a885d89a 117 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
3c299c3a 118} // end of wxStaticBox::OS2WindowProc
0e320a79 119
409c9842 120