]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/gauge.mm
I don't understand what the original author
[wxWidgets.git] / src / cocoa / gauge.mm
index aafc5b6b76a717d373b79f18f5c24bb19d89aa5f..028064b74a954506aa03fc1b3064d5b866dbf01e 100644 (file)
@@ -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 <AppKit/NSProgressIndicator.h>
 
@@ -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