1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSpinButton
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: spinbutt.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/spinbutt.h"
17 #include "wx/osx/private.h"
19 @interface wxNSStepper : NSStepper
24 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
25 - (wxWidgetImpl*) implementation;
27 - (void) clickedAction: (id) sender;
31 @implementation wxNSStepper
33 - (id)initWithFrame:(NSRect)frame
35 [super initWithFrame:frame];
37 [self setTarget: self];
38 [self setAction: @selector(clickedAction:)];
42 - (void) clickedAction: (id) sender
46 wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
48 wxpeer->HandleClicked(0);
52 - (void)setImplementation: (wxWidgetImpl *) theImplementation
54 impl = theImplementation;
57 - (wxWidgetImpl*) implementation
69 wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer,
80 NSView* sv = (wxpeer->GetParent()->GetHandle() );
82 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
83 wxNSStepper* v = [[wxNSStepper alloc] initWithFrame:r];
85 [v setMinValue: minimum];
86 [v setMaxValue: maximum];
87 [v setIntValue: value];
89 if ( style & wxSP_WRAP )
90 [v setValueWraps:YES];
93 wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
94 [v setImplementation:c];
98 #endif // wxUSE_SPINBTN