]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbox.cpp
f4bd92905d414b4dd953973566bba31656dede0d
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "statbox.h"
14 #endif
15
16 #include "wx/wxprec.h"
17
18 #if wxUSE_STATBOX
19
20 #include "wx/statbox.h"
21 #include "wx/mac/uma.h"
22
23 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
24
25 /*
26 * Static box
27 */
28
29 bool 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 {
36 m_macIsUserPane = FALSE ;
37
38 if ( !wxControl::Create(parent, id, pos, size,
39 style, wxDefaultValidator, name) )
40 return false;
41
42 m_label = label ;
43
44 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
45
46 m_peer = new wxMacControl(this) ;
47 verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
48 true /*primary*/ , m_peer->GetControlRefAddr() ) ) ;
49
50 MacPostControlCreate(pos,size) ;
51
52 return TRUE;
53 }
54
55 void 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
77 *borderTop = extraTop + GetCharHeight();
78 *borderOther = other;
79 }
80
81 #endif // wxUSE_STATBOX
82