]>
Commit | Line | Data |
---|---|---|
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" | |
0e320a79 DW |
20 | #endif |
21 | ||
670f9935 WS |
22 | #include "wx/window.h" |
23 | #include "wx/os2/private.h" | |
0e320a79 | 24 | |
0e320a79 DW |
25 | IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) |
26 | ||
670f9935 WS |
27 | bool 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 | ||
3c299c3a | 65 | wxColour vColour; |
0fba44b4 | 66 | vColour.Set(wxString(wxT("BLACK"))); |
3c299c3a | 67 | LONG lColor = (LONG)vColour.GetPixel(); |
3c299c3a DW |
68 | ::WinSetPresParam( m_hWnd |
69 | ,PP_FOREGROUNDCOLOR | |
70 | ,sizeof(LONG) | |
71 | ,(PVOID)&lColor | |
72 | ); | |
7993e67c | 73 | |
154daa94 | 74 | lColor = (LONG)m_backgroundColour.GetPixel(); |
7993e67c DW |
75 | ::WinSetPresParam( m_hWnd |
76 | ,PP_BACKGROUNDCOLOR | |
77 | ,sizeof(LONG) | |
78 | ,(PVOID)&lColor | |
79 | ); | |
3c299c3a DW |
80 | SetSize( rPos.x |
81 | ,rPos.y | |
82 | ,rSize.x | |
83 | ,rSize.y | |
84 | ); | |
670f9935 | 85 | return true; |
3c299c3a | 86 | } // end of wxStaticBox::Create |
0e320a79 | 87 | |
3c299c3a | 88 | wxSize wxStaticBox::DoGetBestSize() const |
0e320a79 | 89 | { |
3c299c3a DW |
90 | int nCx; |
91 | int nCy; | |
92 | int wBox; | |
93 | ||
c5f975dd SN |
94 | nCx = GetCharWidth(); |
95 | nCy = GetCharHeight(); | |
3c299c3a DW |
96 | GetTextExtent( wxGetWindowText(m_hWnd) |
97 | ,&wBox | |
c5f975dd | 98 | ,NULL |
3c299c3a DW |
99 | ); |
100 | wBox += 3 * nCx; | |
101 | ||
102 | int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy); | |
103 | ||
104 | return wxSize( wBox | |
105 | ,hBox | |
106 | ); | |
107 | } // end of wxStaticBox::DoGetBestSize | |
108 | ||
670f9935 WS |
109 | MRESULT wxStaticBox::OS2WindowProc( WXUINT nMsg, |
110 | WXWPARAM wParam, | |
111 | WXLPARAM lParam ) | |
409c9842 | 112 | { |
a885d89a | 113 | return wxControl::OS2WindowProc(nMsg, wParam, lParam); |
3c299c3a | 114 | } // end of wxStaticBox::OS2WindowProc |