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