]> git.saurik.com Git - wxWidgets.git/blame - src/msw/gauge95.cpp
patches for BC++ 5.3 from Ricky Gonzales <gonzales@pyramid3.net>
[wxWidgets.git] / src / msw / gauge95.cpp
CommitLineData
da87a1ca
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: gauge95.cpp
3// Purpose: wxGauge95 class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "gauge95.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24#include "wx/defs.h"
25#endif
26
47d67540 27#if wxUSE_GAUGE && defined(__WIN95__)
da87a1ca
JS
28
29#include "wx/msw/gauge95.h"
30#include "wx/msw/private.h"
31
65fd5cb0 32#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
da87a1ca
JS
33#include <commctrl.h>
34#endif
35
da87a1ca 36IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl)
da87a1ca 37
debe6624
JS
38bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
39 int range,
da87a1ca
JS
40 const wxPoint& pos,
41 const wxSize& size,
debe6624 42 long style,
da87a1ca
JS
43 const wxValidator& validator,
44 const wxString& name)
45{
46 SetName(name);
47 SetValidator(validator);
48
49 if (parent) parent->AddChild(this);
50 m_rangeMax = range;
9c331ded 51 m_gaugePos = 0;
da87a1ca 52
fd71308f
JS
53 SetBackgroundColour(parent->GetBackgroundColour()) ;
54 SetForegroundColour(parent->GetForegroundColour()) ;
da87a1ca
JS
55
56 m_windowStyle = style;
57
58 if ( id == -1 )
4438caf4 59 m_windowId = (int)NewControlId();
da87a1ca 60 else
4438caf4 61 m_windowId = id;
da87a1ca
JS
62
63 int x = pos.x;
64 int y = pos.y;
65 int width = size.x;
66 int height = size.y;
67
68 long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
04a65123
JS
69
70#ifndef PBS_VERTICAL
71#define PBS_VERTICAL 0x04
72#endif
73
aeab10d0
JS
74 if (m_windowStyle & wxGA_VERTICAL)
75 msFlags |= PBS_VERTICAL;
76
04a65123
JS
77#ifndef PBS_SMOOTH
78#define PBS_SMOOTH 0x01
79#endif
80
aeab10d0
JS
81 if (m_windowStyle & wxGA_SMOOTH)
82 msFlags |= PBS_SMOOTH;
da87a1ca
JS
83
84 HWND wx_button =
85 CreateWindowEx(MakeExtendedStyle(m_windowStyle), PROGRESS_CLASS, NULL, msFlags,
86 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
87 wxGetInstance(), NULL);
88
89 m_hWnd = (WXHWND)wx_button;
90
91 // Subclass again for purposes of dialog editing mode
92 SubclassWin((WXHWND) wx_button);
93
94 SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, range));
95
c0ed460c 96 SetFont(parent->GetFont());
da87a1ca
JS
97
98 if (width == -1)
99 width = 50;
100 if (height == -1)
92976ab6 101 height = 28;
da87a1ca
JS
102 SetSize(x, y, width, height);
103
104 ShowWindow((HWND) GetHWND(), SW_SHOW);
105
106 return TRUE;
107}
108
debe6624 109void wxGauge95::SetShadowWidth(int w)
da87a1ca
JS
110{
111}
112
debe6624 113void wxGauge95::SetBezelFace(int w)
da87a1ca
JS
114{
115}
116
debe6624 117void wxGauge95::SetRange(int r)
da87a1ca
JS
118{
119 m_rangeMax = r;
120
121 SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
122}
123
debe6624 124void wxGauge95::SetValue(int pos)
da87a1ca
JS
125{
126 m_gaugePos = pos;
127
128 SendMessage((HWND) GetHWND(), PBM_SETPOS, pos, 0);
129}
130
131int wxGauge95::GetShadowWidth(void) const
132{
133 return 0;
134}
135
136int wxGauge95::GetBezelFace(void) const
137{
138 return 0;
139}
140
141int wxGauge95::GetRange(void) const
142{
143 return m_rangeMax;
144}
145
146int wxGauge95::GetValue(void) const
147{
148 return m_gaugePos;
149}
150
cc2b7472 151bool wxGauge95::SetForegroundColour(const wxColour& col)
da87a1ca 152{
cc2b7472
VZ
153 if ( !wxControl::SetForegroundColour(col) )
154 return FALSE;
155
156 m_foregroundColour = col ;
157
158 return TRUE;
da87a1ca
JS
159}
160
cc2b7472 161bool wxGauge95::SetBackgroundColour(const wxColour& col)
da87a1ca 162{
cc2b7472
VZ
163 if ( !wxControl::SetBackgroundColour(col) )
164 return FALSE;
165
166 m_backgroundColour = col ;
167
168 return TRUE;
da87a1ca
JS
169}
170
47d67540 171#endif // wxUSE_GAUGE