]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/gauge.cpp
warning msgs
[wxWidgets.git] / src / gtk1 / gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gauge.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "gauge.h"
13 #endif
14
15 #include "wx/gauge.h"
16
17 //-----------------------------------------------------------------------------
18 // wxGauge
19 //-----------------------------------------------------------------------------
20
21 IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
22
23 bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
24 const wxPoint& pos, const wxSize& size,
25 long style, const wxString& name )
26 {
27 m_needParent = TRUE;
28
29 PreCreation( parent, id, pos, size, style, name );
30
31 m_rangeMax = range;
32 m_gaugePos = 0;
33 m_useProgressBar = TRUE;
34
35 m_widget = gtk_progress_bar_new();
36
37 PostCreation();
38
39 Show( TRUE );
40
41 return TRUE;
42 };
43
44 void wxGauge::SetRange( int r )
45 {
46 m_rangeMax = r;
47 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
48
49 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
50 };
51
52 void wxGauge::SetValue( int pos )
53 {
54 m_gaugePos = pos;
55 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
56
57 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
58 };
59
60 int wxGauge::GetRange(void) const
61 {
62 return m_rangeMax;
63 };
64
65 int wxGauge::GetValue(void) const
66 {
67 return m_gaugePos;
68 };
69