]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbox.cpp
added wxPowerEvent; moved power functions stubs to common/powercmn.cpp
[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 bool 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 )
29 {
30 m_macIsUserPane = false;
31
32 if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
33 return false;
34
35 m_label = label;
36
37 Rect bounds = wxMacGetBoundsForControl( this, pos, size );
38
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 );
44
45 MacPostControlCreate( pos, size );
46
47 return true;
48 }
49
50 void 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 {
57 // The minimal border used for the top.
58 // Later on, the staticbox's font height is added to this.
59 extraTop = 0;
60
61 if ( UMAGetSystemVersion() >= 0x1030 ) // Panther
62 {
63 // As indicated by the HIG, Panther needs an extra border of 11
64 // pixels (otherwise overlapping occurs at the top). The "other"
65 // border has to be 11.
66 extraTop = 11;
67 other = 11;
68 }
69 }
70
71 *borderTop = extraTop + GetCharHeight();
72 *borderOther = other;
73 }
74
75 #endif // wxUSE_STATBOX
76