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