]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/statbox.cpp
ugh. Nesting the (per class) plugin sentries can require them to
[wxWidgets.git] / src / os2 / statbox.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbox.cpp
3// Purpose: wxStaticBox
4// Author: David Webster
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
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"
21#endif
22
23#include "wx/statbox.h"
24
25IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
26
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)
36{
37 if(!OS2CreateControl( pParent
38 ,vId
39 ,rPos
40 ,rSize
41 ,lStyle
42#if wxUSE_VALIDATORS
43 ,wxDefaultValidator
44#endif
45 ,rsName
46 ))
47 {
48 return FALSE;
49 }
50
51 wxPoint vPos(0,0);
52 wxSize vSize(0,0);
53
54 if (!OS2CreateControl( "STATIC"
55 ,SS_GROUPBOX
56 ,vPos
57 ,vSize
58 ,rsLabel
59 ))
60 {
61 return FALSE;
62 }
63
64 wxColour vColour;
65
66 vColour.Set(wxString("BLACK"));
67
68 LONG lColor = (LONG)vColour.GetPixel();
69
70 ::WinSetPresParam( m_hWnd
71 ,PP_FOREGROUNDCOLOR
72 ,sizeof(LONG)
73 ,(PVOID)&lColor
74 );
75 SetFont(pParent->GetFont());
76 SetSize( rPos.x
77 ,rPos.y
78 ,rSize.x
79 ,rSize.y
80 );
81 return TRUE;
82} // end of wxStaticBox::Create
83
84wxSize wxStaticBox::DoGetBestSize() const
85{
86 int nCx;
87 int nCy;
88 int wBox;
89
90 wxGetCharSize( GetHWND()
91 ,&nCx
92 ,&nCy
93 ,(wxFont*)&GetFont()
94 );
95 GetTextExtent( wxGetWindowText(m_hWnd)
96 ,&wBox
97 ,&nCy
98 );
99 wBox += 3 * nCx;
100
101 int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
102
103 return wxSize( wBox
104 ,hBox
105 );
106} // end of wxStaticBox::DoGetBestSize
107
108MRESULT wxStaticBox::OS2WindowProc(
109 WXUINT nMsg
110, WXWPARAM wParam
111, WXLPARAM lParam
112)
113{
114 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
115} // end of wxStaticBox::OS2WindowProc
116
117