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