]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/gauge.cpp
New generated code
[wxWidgets.git] / src / gtk / gauge.cpp
CommitLineData
1a56f55c
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: gauge.cpp
3// Purpose:
4// Author: Robert Roebling
a81258be 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
1a56f55c
RR
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "gauge.h"
12#endif
13
14#include "wx/gauge.h"
15
16//-----------------------------------------------------------------------------
17// wxGauge
18//-----------------------------------------------------------------------------
19
20IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
21
debe6624 22bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
1a56f55c 23 const wxPoint& pos, const wxSize& size,
6de97a3b 24 long style, const wxValidator& validator, const wxString& name )
1a56f55c
RR
25{
26 m_needParent = TRUE;
27
1a56f55c
RR
28 PreCreation( parent, id, pos, size, style, name );
29
6de97a3b
RR
30 SetValidator( validator );
31
1a56f55c
RR
32 m_rangeMax = range;
33 m_gaugePos = 0;
34 m_useProgressBar = TRUE;
35
36 m_widget = gtk_progress_bar_new();
37
38 PostCreation();
39
40 Show( TRUE );
41
42 return TRUE;
6de97a3b 43}
1a56f55c 44
debe6624 45void wxGauge::SetRange( int r )
1a56f55c
RR
46{
47 m_rangeMax = r;
48 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
49
5a8c6c9a 50 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 51}
1a56f55c 52
debe6624 53void wxGauge::SetValue( int pos )
1a56f55c
RR
54{
55 m_gaugePos = pos;
56 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
57
5a8c6c9a 58 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 59}
1a56f55c
RR
60
61int wxGauge::GetRange(void) const
62{
63 return m_rangeMax;
6de97a3b 64}
1a56f55c
RR
65
66int wxGauge::GetValue(void) const
67{
68 return m_gaugePos;
6de97a3b 69}
1a56f55c 70
58614078
RR
71void wxGauge::ApplyWidgetStyle()
72{
73 SetWidgetStyle();
74 gtk_widget_set_style( m_widget, m_widgetStyle );
75}
76