]> git.saurik.com Git - wxWidgets.git/blame - src/osx/iphone/gauge.mm
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / src / osx / iphone / gauge.mm
CommitLineData
d09d7f11 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/osx/iphone/gauge.mm
d09d7f11
SC
3// Purpose: wxGauge class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
d09d7f11
SC
7// Copyright: (c) Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#include "wx/wxprec.h"
12
13#if wxUSE_GAUGE
14
15#include "wx/gauge.h"
16
17#include "wx/osx/private.h"
18
19@interface wxUIProgressView : UIProgressView
20{
21}
22
23@end
24
25@implementation wxUIProgressView
26
27+ (void)initialize
28{
29 static BOOL initialized = NO;
30 if (!initialized)
31 {
32 initialized = YES;
33 wxOSXIPhoneClassAddWXMethods( self );
34 }
35}
36
37@end
38
39class wxOSXGaugeIPhoneImpl : public wxWidgetIPhoneImpl
40{
41public :
42 wxOSXGaugeIPhoneImpl( wxWindowMac* peer, WXWidget w) : wxWidgetIPhoneImpl( peer, w )
43 {
44 }
45
46 void SetMaximum(wxInt32 m)
47 {
48 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
49 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
50 SetDeterminateMode();
51 [v setProgress:(float) wxpeer->GetValue() / m];
52 }
53
54 void SetValue(wxInt32 n)
55 {
56 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
57 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
58 SetDeterminateMode();
59 [v setProgress:(float) n / wxpeer->GetRange()];
60 }
61
62 void PulseGauge()
63 {
64 }
65protected:
66 void SetDeterminateMode()
67 {
68 // switch back to determinate mode if necessary
69 }
70};
71
72
73wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
74 wxWindowMac* WXUNUSED(parent),
75 wxWindowID WXUNUSED(id),
76 wxInt32 value,
77 wxInt32 minimum,
78 wxInt32 maximum,
79 const wxPoint& pos,
80 const wxSize& size,
81 long WXUNUSED(style),
82 long WXUNUSED(extraStyle))
83{
84 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
85 wxUIProgressView* v = [[wxUIProgressView alloc] initWithFrame:r];
86 [v setProgress:(float) value/maximum];
87
88 wxWidgetIPhoneImpl* c = new wxOSXGaugeIPhoneImpl( wxpeer, v );
89 return c;
90}
91
92#endif // wxUSE_GAUGE
93