]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/msw/gauge95.cpp
*** empty log message ***
[wxWidgets.git] / src / msw / gauge95.cpp
... / ...
CommitLineData
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
27#if wxUSE_GAUGE && defined(__WIN95__)
28
29#include "wx/msw/gauge95.h"
30#include "wx/msw/private.h"
31
32#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
33#include <commctrl.h>
34#endif
35
36IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl)
37
38bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
39 int range,
40 const wxPoint& pos,
41 const wxSize& size,
42 long style,
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;
51 m_gaugePos = 0;
52
53 SetBackgroundColour(parent->GetBackgroundColour()) ;
54 SetForegroundColour(parent->GetForegroundColour()) ;
55
56 m_windowStyle = style;
57
58 if ( id == -1 )
59 m_windowId = (int)NewControlId();
60 else
61 m_windowId = id;
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;
69
70#ifndef PBS_VERTICAL
71#define PBS_VERTICAL 0x04
72#endif
73
74 if (m_windowStyle & wxGA_VERTICAL)
75 msFlags |= PBS_VERTICAL;
76
77#ifndef PBS_SMOOTH
78#define PBS_SMOOTH 0x01
79#endif
80
81 if (m_windowStyle & wxGA_SMOOTH)
82 msFlags |= PBS_SMOOTH;
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
96 SetFont(parent->GetFont());
97
98 if (width == -1)
99 width = 50;
100 if (height == -1)
101 height = 28;
102 SetSize(x, y, width, height);
103
104 ShowWindow((HWND) GetHWND(), SW_SHOW);
105
106 return TRUE;
107}
108
109void wxGauge95::SetShadowWidth(int w)
110{
111}
112
113void wxGauge95::SetBezelFace(int w)
114{
115}
116
117void wxGauge95::SetRange(int r)
118{
119 m_rangeMax = r;
120
121 SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
122}
123
124void wxGauge95::SetValue(int pos)
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
151bool wxGauge95::SetForegroundColour(const wxColour& col)
152{
153 if ( !wxControl::SetForegroundColour(col) )
154 return FALSE;
155
156 m_foregroundColour = col ;
157
158 return TRUE;
159}
160
161bool wxGauge95::SetBackgroundColour(const wxColour& col)
162{
163 if ( !wxControl::SetBackgroundColour(col) )
164 return FALSE;
165
166 m_backgroundColour = col ;
167
168 return TRUE;
169}
170
171#endif // wxUSE_GAUGE