]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbox.cpp
make XPM data pointer parameter fully const
[wxWidgets.git] / src / mac / carbon / statbox.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbox.cpp
3// Purpose: wxStaticBox
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878 12#include "wx/wxprec.h"
d8c736e5 13
179e085f
RN
14#if wxUSE_STATBOX
15
e9576ca5 16#include "wx/statbox.h"
519cb848 17#include "wx/mac/uma.h"
e9576ca5 18
e9576ca5 19IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
e9576ca5 20
43524b15
DS
21
22bool wxStaticBox::Create( wxWindow *parent,
23 wxWindowID id,
24 const wxString& label,
25 const wxPoint& pos,
26 const wxSize& size,
27 long style,
28 const wxString& name )
e9576ca5 29{
43524b15 30 m_macIsUserPane = false;
5dd070c2 31
43524b15 32 if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
b45ed7a2
VZ
33 return false;
34
ab0f37b9 35 m_labelOrig = m_label = label;
facd6764 36
43524b15 37 Rect bounds = wxMacGetBoundsForControl( this, pos, size );
5dd070c2 38
43524b15
DS
39 m_peer = new wxMacControl( this );
40 OSStatus err = CreateGroupBoxControl(
41 MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
42 true /*primary*/, m_peer->GetControlRefAddr() );
43 verify_noerr( err );
4c37f124 44
43524b15 45 MacPostControlCreate( pos, size );
5dd070c2 46
43524b15 47 return true;
e9576ca5 48}
179e085f 49
5dd070c2
VZ
50void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
51{
52 static int extraTop = -1; // Uninitted
53 static int other = 5;
54
55 if ( extraTop == -1 )
56 {
43524b15
DS
57 // The minimal border used for the top.
58 // Later on, the staticbox's font height is added to this.
5dd070c2
VZ
59 extraTop = 0;
60
9d463591
SC
61 // As indicated by the HIG, Panther needs an extra border of 11
62 // pixels (otherwise overlapping occurs at the top). The "other"
63 // border has to be 11.
64 extraTop = 11;
65 other = 11;
5dd070c2
VZ
66 }
67
6fa2dd0e
VZ
68 *borderTop = extraTop;
69 if ( !m_label.empty() )
70 *borderTop += GetCharHeight();
71
5dd070c2
VZ
72 *borderOther = other;
73}
74
75#endif // wxUSE_STATBOX
76