1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/gauge.mm
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
20 #import <AppKit/NSProgressIndicator.h>
22 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
23 BEGIN_EVENT_TABLE(wxGauge, wxGaugeBase)
25 // WX_IMPLEMENT_COCOA_OWNER(wxGauge,NSProgressIndicator,NSView,NSView)
27 bool wxGauge::Create(wxWindow *parent, wxWindowID winid, int range,
28 const wxPoint& pos, const wxSize& size, long style,
29 const wxValidator& validator, const wxString& name)
31 if(!CreateControl(parent,winid,pos,size,style,validator,name))
33 SetNSView([[NSProgressIndicator alloc] initWithFrame: MakeDefaultNSRect(size)]);
34 [m_cocoaNSView release];
36 [(NSProgressIndicator*)m_cocoaNSView setMaxValue:range];
37 [(NSProgressIndicator*)m_cocoaNSView setIndeterminate:NO];
40 m_parent->CocoaAddChild(this);
41 SetInitialFrameRect(pos,size);
50 int wxGauge::GetValue() const
52 return [(NSProgressIndicator*)m_cocoaNSView doubleValue];
55 void wxGauge::SetValue(int value)
57 [(NSProgressIndicator*)m_cocoaNSView setDoubleValue:value];
60 int wxGauge::GetRange() const
62 return [(NSProgressIndicator*)m_cocoaNSView maxValue];
65 void wxGauge::SetRange(int maxValue)
67 [(NSProgressIndicator*)m_cocoaNSView setMinValue:0.0];
68 [(NSProgressIndicator*)m_cocoaNSView setMaxValue:maxValue];