]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbox.cpp
cleanup - reformat
[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
SC
20
21/*
22 * Static box
23 */
5dd070c2 24
e9576ca5
SC
25bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
26 const wxString& label,
27 const wxPoint& pos,
28 const wxSize& size,
29 long style,
30 const wxString& name)
31{
facd6764 32 m_macIsUserPane = FALSE ;
5dd070c2 33
b45ed7a2
VZ
34 if ( !wxControl::Create(parent, id, pos, size,
35 style, wxDefaultValidator, name) )
36 return false;
37
facd6764
SC
38 m_label = label ;
39
40 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
5dd070c2 41
b905d6cc 42 m_peer = new wxMacControl(this) ;
5dd070c2
VZ
43 verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
44 true /*primary*/ , m_peer->GetControlRefAddr() ) ) ;
4c37f124 45
facd6764 46 MacPostControlCreate(pos,size) ;
5dd070c2 47
e40298d5 48 return TRUE;
e9576ca5 49}
179e085f 50
5dd070c2
VZ
51void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
52{
53 static int extraTop = -1; // Uninitted
54 static int other = 5;
55
56 if ( extraTop == -1 )
57 {
58 // The minimal border used for the top. Later on the staticbox'
59 // font height is added to this.
60 extraTop = 0;
61
62 if ( UMAGetSystemVersion() >= 0x1030 /*Panther*/ )
63 {
64 // As indicated by the HIG, Panther needs an extra border of 11
65 // pixels (otherwise overlapping occurs at the top). The "other"
66 // border has to be 11.
67 extraTop = 11;
68 other = 11;
69 }
70
71 }
72
b1f87262 73 *borderTop = extraTop + GetCharHeight();
5dd070c2
VZ
74 *borderOther = other;
75}
76
77#endif // wxUSE_STATBOX
78