Implement wxGauge
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,12 +56,12 @@ protected:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
// Pure Virtuals
|
// Pure Virtuals
|
||||||
virtual int GetValue() const { return 0; }
|
virtual int GetValue() const;
|
||||||
virtual void SetValue(int value) { }
|
virtual void SetValue(int value);
|
||||||
|
|
||||||
// retrieve/change the range
|
// retrieve/change the range
|
||||||
virtual void SetRange(int maxValue) { }
|
virtual void SetRange(int maxValue);
|
||||||
int GetRange(void) const { return 0; }
|
int GetRange(void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __WX_COCOA_GAUGE_H__
|
#endif // __WX_COCOA_GAUGE_H__
|
||||||
|
@@ -32,6 +32,10 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID winid, int range,
|
|||||||
return false;
|
return false;
|
||||||
SetNSView([[NSProgressIndicator alloc] initWithFrame: MakeDefaultNSRect(size)]);
|
SetNSView([[NSProgressIndicator alloc] initWithFrame: MakeDefaultNSRect(size)]);
|
||||||
[m_cocoaNSView release];
|
[m_cocoaNSView release];
|
||||||
|
|
||||||
|
[(NSProgressIndicator*)m_cocoaNSView setMaxValue:range];
|
||||||
|
[(NSProgressIndicator*)m_cocoaNSView setIndeterminate:NO];
|
||||||
|
|
||||||
if(m_parent)
|
if(m_parent)
|
||||||
m_parent->CocoaAddChild(this);
|
m_parent->CocoaAddChild(this);
|
||||||
SetInitialFrameRect(pos,size);
|
SetInitialFrameRect(pos,size);
|
||||||
@@ -43,4 +47,25 @@ wxGauge::~wxGauge()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxGauge::GetValue() const
|
||||||
|
{
|
||||||
|
return [(NSProgressIndicator*)m_cocoaNSView doubleValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge::SetValue(int value)
|
||||||
|
{
|
||||||
|
[(NSProgressIndicator*)m_cocoaNSView setDoubleValue:value];
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxGauge::GetRange() const
|
||||||
|
{
|
||||||
|
return [(NSProgressIndicator*)m_cocoaNSView maxValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge::SetRange(int maxValue)
|
||||||
|
{
|
||||||
|
[(NSProgressIndicator*)m_cocoaNSView setMinValue:0.0];
|
||||||
|
[(NSProgressIndicator*)m_cocoaNSView setMaxValue:maxValue];
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GAUGE
|
#endif // wxUSE_GAUGE
|
||||||
|
Reference in New Issue
Block a user