]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/gauge.cpp
Small modifications
[wxWidgets.git] / src / gtk / 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,
debe6624 25 long style, const wxString& name )
1a56f55c
RR
26{
27 m_needParent = TRUE;
28
1a56f55c
RR
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
debe6624 44void wxGauge::SetRange( int r )
1a56f55c
RR
45{
46 m_rangeMax = r;
47 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
48
5a8c6c9a 49 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
1a56f55c
RR
50};
51
debe6624 52void wxGauge::SetValue( int pos )
1a56f55c
RR
53{
54 m_gaugePos = pos;
55 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
56
5a8c6c9a 57 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
1a56f55c
RR
58};
59
60int wxGauge::GetRange(void) const
61{
62 return m_rangeMax;
63};
64
65int wxGauge::GetValue(void) const
66{
67 return m_gaugePos;
68};
69