]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbox.cpp
don't encode collons in file:// URLs under Windows as IE is incapable of opening...
[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_labelOrig = 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 // As indicated by the HIG, Panther needs an extra border of 11
62 // pixels (otherwise overlapping occurs at the top). The "other"
63 // border has to be 11.
64 extraTop = 11;
65 other = 11;
66 }
67
68 *borderTop = extraTop;
69 if ( !m_label.empty() )
70 *borderTop += GetCharHeight();
71
72 *borderOther = other;
73 }
74
75 #endif // wxUSE_STATBOX
76