]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/gauge95.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/gauge95.cpp
3 // Purpose: wxGauge95 class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "gauge95.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
35 #if wxUSE_GAUGE && defined(__WIN95__)
37 #include "wx/msw/gauge95.h"
38 #include "wx/msw/private.h"
40 #if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__))
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 // old commctrl.h (< 4.71) don't have those
50 #define PBS_SMOOTH 0x01
54 #define PBS_VERTICAL 0x04
57 #ifndef PBM_SETBARCOLOR
58 #define PBM_SETBARCOLOR (WM_USER+9)
61 #ifndef PBM_SETBKCOLOR
62 #define PBM_SETBKCOLOR 0x2001
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 IMPLEMENT_DYNAMIC_CLASS(wxGauge95
, wxControl
)
71 // ============================================================================
73 // ============================================================================
75 bool wxGauge95::Create(wxWindow
*parent
, wxWindowID id
,
80 const wxValidator
& validator
,
85 SetValidator(validator
);
86 #endif // wxUSE_VALIDATORS
88 if (parent
) parent
->AddChild(this);
92 m_windowStyle
= style
;
95 m_windowId
= (int)NewControlId();
105 long msFlags
= MSWGetStyle(style
, & exStyle
) ;
107 if (m_windowStyle
& wxGA_VERTICAL
)
108 msFlags
|= PBS_VERTICAL
;
110 if (m_windowStyle
& wxGA_SMOOTH
)
111 msFlags
|= PBS_SMOOTH
;
114 CreateWindowEx(exStyle
, PROGRESS_CLASS
, NULL
, msFlags
,
115 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
116 wxGetInstance(), NULL
);
118 m_hWnd
= (WXHWND
)wx_button
;
120 SetBackgroundColour(parent
->GetBackgroundColour());
121 SetForegroundColour(parent
->GetForegroundColour());
123 // Subclass again for purposes of dialog editing mode
124 SubclassWin((WXHWND
) wx_button
);
126 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
128 SetFont(parent
->GetFont());
134 SetSize(x
, y
, width
, height
);
136 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
141 void wxGauge95::SetShadowWidth(int WXUNUSED(w
))
145 void wxGauge95::SetBezelFace(int WXUNUSED(w
))
149 void wxGauge95::SetRange(int r
)
153 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
156 void wxGauge95::SetValue(int pos
)
160 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
163 int wxGauge95::GetShadowWidth() const
168 int wxGauge95::GetBezelFace() const
173 int wxGauge95::GetRange() const
178 int wxGauge95::GetValue() const
183 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
185 if ( !wxControl::SetForegroundColour(col
) )
188 SendMessage(GetHwnd(), PBM_SETBARCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
193 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
195 if ( !wxControl::SetBackgroundColour(col
) )
198 SendMessage(GetHwnd(), PBM_SETBKCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
203 #endif // wxUSE_GAUGE