]> git.saurik.com Git - wxWidgets.git/blame - src/msw/gauge95.cpp
fixes for icon-inherits-from-bitmap mode
[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
36#if !USE_SHARED_LIBRARY
37IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl)
38#endif
39
debe6624
JS
40bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
41 int range,
da87a1ca
JS
42 const wxPoint& pos,
43 const wxSize& size,
debe6624 44 long style,
da87a1ca
JS
45 const wxValidator& validator,
46 const wxString& name)
47{
48 SetName(name);
49 SetValidator(validator);
50
51 if (parent) parent->AddChild(this);
52 m_rangeMax = range;
9c331ded 53 m_gaugePos = 0;
da87a1ca 54
fd71308f
JS
55 SetBackgroundColour(parent->GetBackgroundColour()) ;
56 SetForegroundColour(parent->GetForegroundColour()) ;
da87a1ca
JS
57
58 m_windowStyle = style;
59
60 if ( id == -1 )
4438caf4 61 m_windowId = (int)NewControlId();
da87a1ca 62 else
4438caf4 63 m_windowId = id;
da87a1ca
JS
64
65 int x = pos.x;
66 int y = pos.y;
67 int width = size.x;
68 int height = size.y;
69
70 long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
04a65123
JS
71
72#ifndef PBS_VERTICAL
73#define PBS_VERTICAL 0x04
74#endif
75
aeab10d0
JS
76 if (m_windowStyle & wxGA_VERTICAL)
77 msFlags |= PBS_VERTICAL;
78
04a65123
JS
79#ifndef PBS_SMOOTH
80#define PBS_SMOOTH 0x01
81#endif
82
aeab10d0
JS
83 if (m_windowStyle & wxGA_SMOOTH)
84 msFlags |= PBS_SMOOTH;
da87a1ca
JS
85
86 HWND wx_button =
87 CreateWindowEx(MakeExtendedStyle(m_windowStyle), PROGRESS_CLASS, NULL, msFlags,
88 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
89 wxGetInstance(), NULL);
90
91 m_hWnd = (WXHWND)wx_button;
92
93 // Subclass again for purposes of dialog editing mode
94 SubclassWin((WXHWND) wx_button);
95
96 SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, range));
97
c0ed460c 98 SetFont(parent->GetFont());
da87a1ca
JS
99
100 if (width == -1)
101 width = 50;
102 if (height == -1)
92976ab6 103 height = 28;
da87a1ca
JS
104 SetSize(x, y, width, height);
105
106 ShowWindow((HWND) GetHWND(), SW_SHOW);
107
108 return TRUE;
109}
110
debe6624 111void wxGauge95::SetShadowWidth(int w)
da87a1ca
JS
112{
113}
114
debe6624 115void wxGauge95::SetBezelFace(int w)
da87a1ca
JS
116{
117}
118
debe6624 119void wxGauge95::SetRange(int r)
da87a1ca
JS
120{
121 m_rangeMax = r;
122
123 SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
124}
125
debe6624 126void wxGauge95::SetValue(int pos)
da87a1ca
JS
127{
128 m_gaugePos = pos;
129
130 SendMessage((HWND) GetHWND(), PBM_SETPOS, pos, 0);
131}
132
133int wxGauge95::GetShadowWidth(void) const
134{
135 return 0;
136}
137
138int wxGauge95::GetBezelFace(void) const
139{
140 return 0;
141}
142
143int wxGauge95::GetRange(void) const
144{
145 return m_rangeMax;
146}
147
148int wxGauge95::GetValue(void) const
149{
150 return m_gaugePos;
151}
152
cc2b7472 153bool wxGauge95::SetForegroundColour(const wxColour& col)
da87a1ca 154{
cc2b7472
VZ
155 if ( !wxControl::SetForegroundColour(col) )
156 return FALSE;
157
158 m_foregroundColour = col ;
159
160 return TRUE;
da87a1ca
JS
161}
162
cc2b7472 163bool wxGauge95::SetBackgroundColour(const wxColour& col)
da87a1ca 164{
cc2b7472
VZ
165 if ( !wxControl::SetBackgroundColour(col) )
166 return FALSE;
167
168 m_backgroundColour = col ;
169
170 return TRUE;
da87a1ca
JS
171}
172
47d67540 173#endif // wxUSE_GAUGE