]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbox.cpp
cleanup - reformat
[wxWidgets.git] / src / mac / carbon / statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbox.cpp
3 // Purpose: wxStaticBox
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_STATBOX
15
16 #include "wx/statbox.h"
17 #include "wx/mac/uma.h"
18
19 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
20
21 /*
22 * Static box
23 */
24
25 bool 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 {
32 m_macIsUserPane = FALSE ;
33
34 if ( !wxControl::Create(parent, id, pos, size,
35 style, wxDefaultValidator, name) )
36 return false;
37
38 m_label = label ;
39
40 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
41
42 m_peer = new wxMacControl(this) ;
43 verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
44 true /*primary*/ , m_peer->GetControlRefAddr() ) ) ;
45
46 MacPostControlCreate(pos,size) ;
47
48 return TRUE;
49 }
50
51 void 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
73 *borderTop = extraTop + GetCharHeight();
74 *borderOther = other;
75 }
76
77 #endif // wxUSE_STATBOX
78