]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/statbox.mm
The alignment controls are now left-aligned if the floating controls are not shown.
[wxWidgets.git] / src / osx / cocoa / statbox.mm
CommitLineData
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
f033830e
SC
7// Copyright: (c) Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#include "wx/wxprec.h"
12
13#if wxUSE_STATBOX
14
15#include "wx/statbox.h"
16#include "wx/osx/private.h"
17
dbeddfb9
SC
18@implementation wxNSBox
19
4dd9fdf8
SC
20+ (void)initialize
21{
22 static BOOL initialized = NO;
03647350 23 if (!initialized)
4dd9fdf8
SC
24 {
25 initialized = YES;
26 wxOSXCocoaClassAddWXMethods( self );
27 }
28}
dbeddfb9
SC
29
30@end
31
03647350 32namespace
aa30d6c8
SC
33{
34 class wxStaticBoxCocoaImpl : public wxWidgetCocoaImpl
35 {
36 public:
37 wxStaticBoxCocoaImpl(wxWindowMac *wxpeer, wxNSBox *v)
38 : wxWidgetCocoaImpl(wxpeer, v)
39 {
40 }
03647350 41
aa30d6c8
SC
42 virtual void SetLabel( const wxString& title, wxFontEncoding encoding )
43 {
44 if (title.empty())
45 [GetNSBox() setTitlePosition:NSNoTitle];
46 else
47 [GetNSBox() setTitlePosition:NSAtTop];
03647350 48
aa30d6c8
SC
49 wxWidgetCocoaImpl::SetLabel(title, encoding);
50 }
03647350 51
aa30d6c8
SC
52 private:
53 NSBox *GetNSBox() const
54 {
55 wxASSERT( [m_osxView isKindOfClass:[NSBox class]] );
03647350 56
aa30d6c8
SC
57 return static_cast<NSBox*>(m_osxView);
58 }
59 };
60} // anonymous namespace
61
62
03647350
VZ
63wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
64 wxWindowMac* WXUNUSED(parent),
65 wxWindowID WXUNUSED(id),
d8207702 66 const wxString& WXUNUSED(label),
03647350 67 const wxPoint& pos,
f033830e 68 const wxSize& size,
03647350 69 long WXUNUSED(style),
d8207702 70 long WXUNUSED(extraStyle))
f033830e 71{
dbeddfb9 72 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
f033830e 73 wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
aa30d6c8 74 wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v );
c551dc29 75#if !wxOSX_USE_NATIVE_FLIPPED
4dd9fdf8 76 c->SetFlipped(false);
c551dc29 77#endif
f033830e
SC
78 return c;
79}
80
81#endif // wxUSE_STATBOX
82