X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d656ea93c0f3d53f97a1c67244baa39d72b7334..8f8e45c4d941c9b17a77ec71595e3d7a39058234:/src/cocoa/gauge.mm diff --git a/src/cocoa/gauge.mm b/src/cocoa/gauge.mm index aafc5b6b76..028064b74a 100644 --- a/src/cocoa/gauge.mm +++ b/src/cocoa/gauge.mm @@ -9,11 +9,13 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/setup.h" +#include "wx/wxprec.h" #if wxUSE_GAUGE -#include "wx/app.h" -#include "wx/gauge.h" +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/gauge.h" +#endif //WX_PRECOMP #import @@ -30,6 +32,10 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID winid, int range, return false; SetNSView([[NSProgressIndicator alloc] initWithFrame: MakeDefaultNSRect(size)]); [m_cocoaNSView release]; + + [(NSProgressIndicator*)m_cocoaNSView setMaxValue:range]; + [(NSProgressIndicator*)m_cocoaNSView setIndeterminate:NO]; + if(m_parent) m_parent->CocoaAddChild(this); SetInitialFrameRect(pos,size); @@ -41,4 +47,25 @@ wxGauge::~wxGauge() { } +int wxGauge::GetValue() const +{ + return (int)[(NSProgressIndicator*)m_cocoaNSView doubleValue]; +} + +void wxGauge::SetValue(int value) +{ + [(NSProgressIndicator*)m_cocoaNSView setDoubleValue:value]; +} + +int wxGauge::GetRange() const +{ + return (int)[(NSProgressIndicator*)m_cocoaNSView maxValue]; +} + +void wxGauge::SetRange(int maxValue) +{ + [(NSProgressIndicator*)m_cocoaNSView setMinValue:0.0]; + [(NSProgressIndicator*)m_cocoaNSView setMaxValue:maxValue]; +} + #endif // wxUSE_GAUGE