]> git.saurik.com Git - wxWidgets.git/blob - src/osx/statbox_osx.cpp
Draw the underline 1 pixel higher in wxDC::DrawLabel().
[wxWidgets.git] / src / osx / statbox_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/statbox_osx.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/osx/private.h"
18
19 bool wxStaticBox::Create( wxWindow *parent,
20 wxWindowID id,
21 const wxString& label,
22 const wxPoint& pos,
23 const wxSize& size,
24 long style,
25 const wxString& name )
26 {
27 m_macIsUserPane = false;
28
29 if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
30 return false;
31
32 m_labelOrig = m_label = label;
33
34 m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() );
35
36 MacPostControlCreate( pos, size );
37
38 return true;
39 }
40
41 void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
42 {
43 #if wxOSX_USE_COCOA
44 int l,t,w,h;
45 m_peer->GetContentArea(l, t, w, h);
46 *borderTop = t + 10;
47 *borderOther = l + 10;
48 #else
49 static int extraTop = -1; // Uninitted
50 static int other = 5;
51
52 if ( extraTop == -1 )
53 {
54 // The minimal border used for the top.
55 // Later on, the staticbox's font height is added to this.
56 extraTop = 0;
57
58 // As indicated by the HIG, Panther needs an extra border of 11
59 // pixels (otherwise overlapping occurs at the top). The "other"
60 // border has to be 11.
61 extraTop = 11;
62 other = 11;
63 }
64
65 *borderTop = extraTop;
66 if ( !m_label.empty() )
67 *borderTop += GetCharHeight();
68
69 *borderOther = other;
70 #endif
71 }
72
73 bool wxStaticBox::SetFont(const wxFont& font)
74 {
75 bool retval = wxWindowBase::SetFont( font );
76
77 // dont' update the native control, it has its own small font
78
79 return retval;
80 }
81
82 #endif // wxUSE_STATBOX
83