]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/statbox.mm
Implement HasSelection for the OSX WebKit backend.
[wxWidgets.git] / src / osx / cocoa / statbox.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/statbox.mm
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 @implementation wxNSBox
20
21 + (void)initialize
22 {
23 static BOOL initialized = NO;
24 if (!initialized)
25 {
26 initialized = YES;
27 wxOSXCocoaClassAddWXMethods( self );
28 }
29 }
30
31 @end
32
33 namespace
34 {
35 class wxStaticBoxCocoaImpl : public wxWidgetCocoaImpl
36 {
37 public:
38 wxStaticBoxCocoaImpl(wxWindowMac *wxpeer, wxNSBox *v)
39 : wxWidgetCocoaImpl(wxpeer, v)
40 {
41 }
42
43 virtual void SetLabel( const wxString& title, wxFontEncoding encoding )
44 {
45 if (title.empty())
46 [GetNSBox() setTitlePosition:NSNoTitle];
47 else
48 [GetNSBox() setTitlePosition:NSAtTop];
49
50 wxWidgetCocoaImpl::SetLabel(title, encoding);
51 }
52
53 private:
54 NSBox *GetNSBox() const
55 {
56 wxASSERT( [m_osxView isKindOfClass:[NSBox class]] );
57
58 return static_cast<NSBox*>(m_osxView);
59 }
60 };
61 } // anonymous namespace
62
63
64 wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
65 wxWindowMac* WXUNUSED(parent),
66 wxWindowID WXUNUSED(id),
67 const wxString& WXUNUSED(label),
68 const wxPoint& pos,
69 const wxSize& size,
70 long WXUNUSED(style),
71 long WXUNUSED(extraStyle))
72 {
73 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
74 wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
75 wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v );
76 c->SetFlipped(false);
77 return c;
78 }
79
80 #endif // wxUSE_STATBOX
81