]> git.saurik.com Git - wxWidgets.git/blame - src/os2/statbox.cpp
Don't use "Cancel" button in the about dialog of the listctrl sample.
[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
670f9935
WS
25bool wxStaticBox::Create( wxWindow* pParent,
26 wxWindowID vId,
27 const wxString& rsLabel,
28 const wxPoint& rPos,
29 const wxSize& rSize,
30 long lStyle,
31 const wxString& rsName )
0e320a79 32{
b9b1d6c8
DW
33 if(!CreateControl( pParent
34 ,vId
35 ,rPos
36 ,rSize
37 ,lStyle
b9b1d6c8 38 ,wxDefaultValidator
b9b1d6c8
DW
39 ,rsName
40 ))
3c299c3a 41 {
670f9935 42 return false;
3c299c3a 43 }
409c9842 44
670f9935
WS
45 wxPoint vPos(0,0);
46 wxSize vSize(0,0);
409c9842 47
0fba44b4 48 if (!OS2CreateControl( wxT("STATIC")
3c299c3a
DW
49 ,SS_GROUPBOX
50 ,vPos
51 ,vSize
52 ,rsLabel
53 ))
54 {
670f9935 55 return false;
3c299c3a 56 }
409c9842 57
b9b1d6c8
DW
58 //
59 // To be transparent we should have the same colour as the parent as well
60 //
61 SetBackgroundColour(GetParent()->GetBackgroundColour());
62
19bc1514 63 LONG lColor = (LONG)wxBLACK->GetPixel();
3c299c3a
DW
64 ::WinSetPresParam( m_hWnd
65 ,PP_FOREGROUNDCOLOR
66 ,sizeof(LONG)
67 ,(PVOID)&lColor
68 );
7993e67c 69
154daa94 70 lColor = (LONG)m_backgroundColour.GetPixel();
7993e67c
DW
71 ::WinSetPresParam( m_hWnd
72 ,PP_BACKGROUNDCOLOR
73 ,sizeof(LONG)
74 ,(PVOID)&lColor
75 );
3c299c3a
DW
76 SetSize( rPos.x
77 ,rPos.y
78 ,rSize.x
79 ,rSize.y
80 );
670f9935 81 return true;
3c299c3a 82} // end of wxStaticBox::Create
0e320a79 83
3c299c3a 84wxSize wxStaticBox::DoGetBestSize() const
0e320a79 85{
3c299c3a
DW
86 int nCx;
87 int nCy;
88 int wBox;
89
c5f975dd
SN
90 nCx = GetCharWidth();
91 nCy = GetCharHeight();
3c299c3a
DW
92 GetTextExtent( wxGetWindowText(m_hWnd)
93 ,&wBox
c5f975dd 94 ,NULL
3c299c3a
DW
95 );
96 wBox += 3 * nCx;
97
98 int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
99
100 return wxSize( wBox
101 ,hBox
102 );
103} // end of wxStaticBox::DoGetBestSize
104
670f9935
WS
105MRESULT wxStaticBox::OS2WindowProc( WXUINT nMsg,
106 WXWPARAM wParam,
107 WXLPARAM lParam )
409c9842 108{
a885d89a 109 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
3c299c3a 110} // end of wxStaticBox::OS2WindowProc