]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
use current mouse position as default position in wxWindow::PopupMenu (works better...
[wxWidgets.git] / src / mac / carbon / gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gauge.cpp
3 // Purpose: wxGauge class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "gauge.h"
14 #endif
15
16 #include "wx/gauge.h"
17
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
20 #endif
21
22 #include "wx/mac/uma.h"
23
24 bool wxGauge::Create(wxWindow *parent, wxWindowID id,
25 int range,
26 const wxPoint& pos,
27 const wxSize& s,
28 long style,
29 const wxValidator& validator,
30 const wxString& name)
31 {
32 m_macIsUserPane = FALSE ;
33
34 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) )
35 return false;
36
37 wxSize size = s ;
38
39 m_rangeMax = range ;
40 m_gaugePos = 0 ;
41
42 if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
43 {
44 size = wxSize( 200 , 16 ) ;
45 }
46
47 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
48 verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
49 m_gaugePos , 0 , m_rangeMax , false /* not indeterminate */ , (ControlRef*) &m_macControl ) ) ;
50
51 MacPostControlCreate(pos,size) ;
52
53 return TRUE;
54 }
55
56 void wxGauge::SetShadowWidth(int w)
57 {
58 }
59
60 void wxGauge::SetBezelFace(int w)
61 {
62 }
63
64 void wxGauge::SetRange(int r)
65 {
66 m_rangeMax = r;
67 ::SetControl32BitMaximum( (ControlRef) m_macControl , m_rangeMax ) ;
68 }
69
70 void wxGauge::SetValue(int pos)
71 {
72 m_gaugePos = pos;
73 ::SetControl32BitValue( (ControlRef) m_macControl , m_gaugePos ) ;
74 }
75
76 int wxGauge::GetShadowWidth() const
77 {
78 return 0;
79 }
80
81 int wxGauge::GetBezelFace() const
82 {
83 return 0;
84 }
85
86 int wxGauge::GetRange() const
87 {
88 return m_rangeMax;
89 }
90
91 int wxGauge::GetValue() const
92 {
93 return m_gaugePos;
94 }
95