]>
Commit | Line | Data |
---|---|---|
f033830e | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: src/osx/cocoa/statbox.mm |
f033830e SC |
3 | // Purpose: wxStaticBox |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
a9a4f229 | 7 | // RCS-ID: $Id$ |
f033830e SC |
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 | ||
dbeddfb9 SC |
19 | @implementation wxNSBox |
20 | ||
4dd9fdf8 SC |
21 | + (void)initialize |
22 | { | |
23 | static BOOL initialized = NO; | |
03647350 | 24 | if (!initialized) |
4dd9fdf8 SC |
25 | { |
26 | initialized = YES; | |
27 | wxOSXCocoaClassAddWXMethods( self ); | |
28 | } | |
29 | } | |
dbeddfb9 SC |
30 | |
31 | @end | |
32 | ||
03647350 | 33 | namespace |
aa30d6c8 SC |
34 | { |
35 | class wxStaticBoxCocoaImpl : public wxWidgetCocoaImpl | |
36 | { | |
37 | public: | |
38 | wxStaticBoxCocoaImpl(wxWindowMac *wxpeer, wxNSBox *v) | |
39 | : wxWidgetCocoaImpl(wxpeer, v) | |
40 | { | |
41 | } | |
03647350 | 42 | |
aa30d6c8 SC |
43 | virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) |
44 | { | |
45 | if (title.empty()) | |
46 | [GetNSBox() setTitlePosition:NSNoTitle]; | |
47 | else | |
48 | [GetNSBox() setTitlePosition:NSAtTop]; | |
03647350 | 49 | |
aa30d6c8 SC |
50 | wxWidgetCocoaImpl::SetLabel(title, encoding); |
51 | } | |
03647350 | 52 | |
aa30d6c8 SC |
53 | private: |
54 | NSBox *GetNSBox() const | |
55 | { | |
56 | wxASSERT( [m_osxView isKindOfClass:[NSBox class]] ); | |
03647350 | 57 | |
aa30d6c8 SC |
58 | return static_cast<NSBox*>(m_osxView); |
59 | } | |
60 | }; | |
61 | } // anonymous namespace | |
62 | ||
63 | ||
03647350 VZ |
64 | wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer, |
65 | wxWindowMac* WXUNUSED(parent), | |
66 | wxWindowID WXUNUSED(id), | |
d8207702 | 67 | const wxString& WXUNUSED(label), |
03647350 | 68 | const wxPoint& pos, |
f033830e | 69 | const wxSize& size, |
03647350 | 70 | long WXUNUSED(style), |
d8207702 | 71 | long WXUNUSED(extraStyle)) |
f033830e | 72 | { |
dbeddfb9 | 73 | NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; |
f033830e | 74 | wxNSBox* v = [[wxNSBox alloc] initWithFrame:r]; |
aa30d6c8 | 75 | wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v ); |
4dd9fdf8 | 76 | c->SetFlipped(false); |
f033830e SC |
77 | return c; |
78 | } | |
79 | ||
80 | #endif // wxUSE_STATBOX | |
81 |