]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/gauge.mm
fix for get best size when having empty labels
[wxWidgets.git] / src / cocoa / gauge.mm
index 58eca4a6751f6637594e7ffdc5684a5dd40f0d68..028064b74a954506aa03fc1b3064d5b866dbf01e 100644 (file)
@@ -32,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);
@@ -43,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