]> git.saurik.com Git - wxWidgets.git/blob - src/os2/statbox.cpp
Move constant strings to .rodata/.data.rel.ro ELF segment from .data by making them...
[wxWidgets.git] / src / os2 / statbox.cpp
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
25 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
26
27 bool 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(!CreateControl( pParent
38 ,vId
39 ,rPos
40 ,rSize
41 ,lStyle
42 ,wxDefaultValidator
43 ,rsName
44 ))
45 {
46 return FALSE;
47 }
48
49 wxPoint vPos(0,0);
50 wxSize vSize(0,0);
51
52 if (!OS2CreateControl( wxT("STATIC")
53 ,SS_GROUPBOX
54 ,vPos
55 ,vSize
56 ,rsLabel
57 ))
58 {
59 return FALSE;
60 }
61
62 //
63 // To be transparent we should have the same colour as the parent as well
64 //
65 SetBackgroundColour(GetParent()->GetBackgroundColour());
66
67 wxColour vColour;
68 vColour.Set(wxString(wxT("BLACK")));
69 LONG lColor = (LONG)vColour.GetPixel();
70 ::WinSetPresParam( m_hWnd
71 ,PP_FOREGROUNDCOLOR
72 ,sizeof(LONG)
73 ,(PVOID)&lColor
74 );
75
76 lColor = (LONG)m_backgroundColour.GetPixel();
77 ::WinSetPresParam( m_hWnd
78 ,PP_BACKGROUNDCOLOR
79 ,sizeof(LONG)
80 ,(PVOID)&lColor
81 );
82 SetSize( rPos.x
83 ,rPos.y
84 ,rSize.x
85 ,rSize.y
86 );
87 return TRUE;
88 } // end of wxStaticBox::Create
89
90 wxSize wxStaticBox::DoGetBestSize() const
91 {
92 int nCx;
93 int nCy;
94 int wBox;
95
96 nCx = GetCharWidth();
97 nCy = GetCharHeight();
98 GetTextExtent( wxGetWindowText(m_hWnd)
99 ,&wBox
100 ,NULL
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
111 MRESULT wxStaticBox::OS2WindowProc(
112 WXUINT nMsg
113 , WXWPARAM wParam
114 , WXLPARAM lParam
115 )
116 {
117 return wxControl::OS2WindowProc(nMsg, wParam, lParam);
118 } // end of wxStaticBox::OS2WindowProc
119
120