]> git.saurik.com Git - wxWidgets.git/blame - src/univ/gauge.cpp
compilation fix for recent commit
[wxWidgets.git] / src / univ / gauge.cpp
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/gauge/gaugecmn.cpp
3// Purpose: wxGauge for wxUniversal
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 20.02.01
7// RCS-ID: $Id$
442b35b5 8// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
1e6feb95
VZ
9// License: wxWindows license
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
a3870b2f 21 #pragma implementation "gaugeuniv.h"
1e6feb95
VZ
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32#endif //WX_PRECOMP
33
34#include "wx/gauge.h"
35
36#if wxUSE_GAUGE
37
38#include "wx/univ/renderer.h"
39
40IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
41
42// ============================================================================
43// implementation
44// ============================================================================
45
46// ----------------------------------------------------------------------------
47// wxGauge creation
48// ----------------------------------------------------------------------------
49
50void wxGauge::Init()
51{
52 m_gaugePos =
53 m_rangeMax = 0;
54}
55
56bool wxGauge::Create(wxWindow *parent,
57 wxWindowID id,
58 int range,
59 const wxPoint& pos,
60 const wxSize& size,
61 long style,
62 const wxValidator& validator,
63 const wxString& name)
64{
65 if ( !wxGaugeBase::Create(parent, id, range, pos, size, style,
66 validator, name) )
67 {
68 return FALSE;
69 }
70
71 SetBestSize(size);
72
73 return TRUE;
74}
75
76// ----------------------------------------------------------------------------
77// wxGauge range/position
78// ----------------------------------------------------------------------------
79
80void wxGauge::SetRange(int range)
81{
82 wxGaugeBase::SetRange(range);
83
84 Refresh();
85}
86
87void wxGauge::SetValue(int pos)
88{
89 wxGaugeBase::SetValue(pos);
90
91 Refresh();
92}
93
94// ----------------------------------------------------------------------------
95// wxGauge geometry
96// ----------------------------------------------------------------------------
97
98wxSize wxGauge::DoGetBestClientSize() const
99{
100 wxSize size = GetRenderer()->GetProgressBarStep();
101
102 // these adjustments are really ridiculous - they are just done to find the
103 // "correct" result under Windows (FIXME)
104 if ( IsVertical() )
105 {
106 size.x = (3*size.y) / 2 + 2;
107 size.y = -1;
108 }
109 else
110 {
111 size.y = (3*size.x) / 2 + 2;
112 size.x = -1;
113 }
114
115 return size;
116}
117
118// ----------------------------------------------------------------------------
119// wxGauge drawing
120// ----------------------------------------------------------------------------
121
122wxBorder wxGauge::GetDefaultBorder() const
123{
124 return wxBORDER_STATIC;
125}
126
127void wxGauge::DoDraw(wxControlRenderer *renderer)
128{
129 renderer->DrawProgressBar(this);
130}
131
132#endif // wxUSE_GAUGE