]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/gauge.cpp
temp linking quick fix
[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
4a0f7f3f 7// Licence: wxWindows licence
1a56f55c
RR
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "gauge.h"
12#endif
13
14#include "wx/gauge.h"
dcf924a3
RR
15
16#if wxUSE_GAUGE
17
55703c91
RR
18#include <gdk/gdk.h>
19#include <gtk/gtk.h>
1a56f55c
RR
20
21//-----------------------------------------------------------------------------
22// wxGauge
23//-----------------------------------------------------------------------------
24
25IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
26
debe6624 27bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
1a56f55c 28 const wxPoint& pos, const wxSize& size,
6de97a3b 29 long style, const wxValidator& validator, const wxString& name )
1a56f55c 30{
4dcaf11a 31 m_needParent = TRUE;
4a0f7f3f 32
4dcaf11a
RR
33 if (!PreCreation( parent, pos, size ) ||
34 !CreateBase( parent, id, pos, size, style, validator, name ))
35 {
223d09f6 36 wxFAIL_MSG( wxT("wxGauge creation failed") );
4a0f7f3f 37 return FALSE;
4dcaf11a 38 }
6de97a3b 39
4dcaf11a
RR
40 m_rangeMax = range;
41 m_gaugePos = 0;
42 m_useProgressBar = TRUE;
4a0f7f3f 43
4dcaf11a 44 m_widget = gtk_progress_bar_new();
61f04363
VZ
45 if( style & wxGA_VERTICAL)
46 gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR(m_widget) , GTK_PROGRESS_BOTTOM_TO_TOP );
4a0f7f3f 47
4dcaf11a 48 m_parent->DoAddChild( this );
4a0f7f3f 49
4dcaf11a 50 PostCreation();
4a0f7f3f 51
4dcaf11a 52 Show( TRUE );
4a0f7f3f 53
4dcaf11a 54 return TRUE;
6de97a3b 55}
1a56f55c 56
debe6624 57void wxGauge::SetRange( int r )
1a56f55c 58{
4dcaf11a
RR
59 m_rangeMax = r;
60 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
4a0f7f3f 61
4dcaf11a 62 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 63}
1a56f55c 64
debe6624 65void wxGauge::SetValue( int pos )
1a56f55c 66{
4dcaf11a
RR
67 m_gaugePos = pos;
68 if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
4a0f7f3f 69
4dcaf11a 70 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
6de97a3b 71}
1a56f55c 72
4dcaf11a 73int wxGauge::GetRange() const
1a56f55c 74{
4dcaf11a 75 return m_rangeMax;
6de97a3b 76}
1a56f55c 77
4dcaf11a 78int wxGauge::GetValue() const
1a56f55c 79{
4dcaf11a 80 return m_gaugePos;
6de97a3b 81}
1a56f55c 82
58614078
RR
83void wxGauge::ApplyWidgetStyle()
84{
4dcaf11a
RR
85 SetWidgetStyle();
86 gtk_widget_set_style( m_widget, m_widgetStyle );
58614078
RR
87}
88
4a0f7f3f
VZ
89#endif // wxUSE_GAUGE
90