]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: statbox.cpp | |
3 | // Purpose: wxStaticBox | |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
65571936 | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3d1a4878 | 12 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
e9576ca5 SC |
13 | #pragma implementation "statbox.h" |
14 | #endif | |
15 | ||
3d1a4878 | 16 | #include "wx/wxprec.h" |
d8c736e5 | 17 | |
179e085f RN |
18 | #if wxUSE_STATBOX |
19 | ||
e9576ca5 | 20 | #include "wx/statbox.h" |
519cb848 | 21 | #include "wx/mac/uma.h" |
e9576ca5 | 22 | |
2f1ae414 | 23 | #if !USE_SHARED_LIBRARY |
e9576ca5 | 24 | IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) |
2f1ae414 | 25 | #endif |
e9576ca5 SC |
26 | |
27 | /* | |
28 | * Static box | |
29 | */ | |
5dd070c2 | 30 | |
e9576ca5 SC |
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 | { | |
facd6764 | 38 | m_macIsUserPane = FALSE ; |
5dd070c2 | 39 | |
b45ed7a2 VZ |
40 | if ( !wxControl::Create(parent, id, pos, size, |
41 | style, wxDefaultValidator, name) ) | |
42 | return false; | |
43 | ||
facd6764 SC |
44 | m_label = label ; |
45 | ||
46 | Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; | |
5dd070c2 | 47 | |
b905d6cc | 48 | m_peer = new wxMacControl(this) ; |
5dd070c2 VZ |
49 | verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , |
50 | true /*primary*/ , m_peer->GetControlRefAddr() ) ) ; | |
4c37f124 | 51 | |
facd6764 | 52 | MacPostControlCreate(pos,size) ; |
5dd070c2 | 53 | |
e40298d5 | 54 | return TRUE; |
e9576ca5 | 55 | } |
179e085f | 56 | |
5dd070c2 VZ |
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 | ||
b1f87262 | 79 | *borderTop = extraTop + GetCharHeight(); |
5dd070c2 VZ |
80 | *borderOther = other; |
81 | } | |
82 | ||
83 | #endif // wxUSE_STATBOX | |
84 |