]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/gauge.cpp
Version 0.4 of wxPython for MSW.
[wxWidgets.git] / src / gtk1 / gauge.cpp
CommitLineData
1a56f55c
RR
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
21IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
22
debe6624 23bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
1a56f55c 24 const wxPoint& pos, const wxSize& size,
6de97a3b 25 long style, const wxValidator& validator, const wxString& name )
1a56f55c
RR
26{
27 m_needParent = TRUE;
28
1a56f55c
RR
29 PreCreation( parent, id, pos, size, style, name );
30
6de97a3b
RR
31 SetValidator( validator );
32
1a56f55c
RR
33 m_rangeMax = range;
34 m_gaugePos = 0;
35 m_useProgressBar = TRUE;
36
37 m_widget = gtk_progress_bar_new();
38
39 PostCreation();
40
41 Show( TRUE );
42
43 return TRUE;
6de97a3b 44}
1a56f55c 45
debe6624 46void wxGauge::SetRange( int r )
1a56f55c
RR
47{
48 m_rangeMax = r;
49 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
50
5a8c6c9a 51 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 52}
1a56f55c 53
debe6624 54void wxGauge::SetValue( int pos )
1a56f55c
RR
55{
56 m_gaugePos = pos;
57 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
58
5a8c6c9a 59 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 60}
1a56f55c
RR
61
62int wxGauge::GetRange(void) const
63{
64 return m_rangeMax;
6de97a3b 65}
1a56f55c
RR
66
67int wxGauge::GetValue(void) const
68{
69 return m_gaugePos;
6de97a3b 70}
1a56f55c 71