]>
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 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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(__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
)
79 // ============================================================================
81 // ============================================================================
83 bool wxGauge95::Create(wxWindow
*parent
, wxWindowID id
,
88 const wxValidator
& validator
,
93 SetValidator(validator
);
94 #endif // wxUSE_VALIDATORS
96 if (parent
) parent
->AddChild(this);
100 m_windowStyle
= style
;
103 m_windowId
= (int)NewControlId();
113 long msFlags
= MSWGetStyle(style
, & exStyle
) ;
115 if (m_windowStyle
& wxGA_VERTICAL
)
116 msFlags
|= PBS_VERTICAL
;
118 if (m_windowStyle
& wxGA_SMOOTH
)
119 msFlags
|= PBS_SMOOTH
;
122 CreateWindowEx(exStyle
, PROGRESS_CLASS
, NULL
, msFlags
,
123 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
124 wxGetInstance(), NULL
);
126 m_hWnd
= (WXHWND
)wx_button
;
128 SetBackgroundColour(parent
->GetBackgroundColour());
129 SetForegroundColour(parent
->GetForegroundColour());
131 // Subclass again for purposes of dialog editing mode
132 SubclassWin((WXHWND
) wx_button
);
134 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
136 SetFont(parent
->GetFont());
142 SetSize(x
, y
, width
, height
);
144 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
149 void wxGauge95::SetShadowWidth(int WXUNUSED(w
))
153 void wxGauge95::SetBezelFace(int WXUNUSED(w
))
157 void wxGauge95::SetRange(int r
)
161 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
164 void wxGauge95::SetValue(int pos
)
168 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
171 int wxGauge95::GetShadowWidth() const
176 int wxGauge95::GetBezelFace() const
181 int wxGauge95::GetRange() const
186 int wxGauge95::GetValue() const
191 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
193 if ( !wxControl::SetForegroundColour(col
) )
196 SendMessage(GetHwnd(), PBM_SETBARCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
201 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
203 if ( !wxControl::SetBackgroundColour(col
) )
206 SendMessage(GetHwnd(), PBM_SETBKCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
211 #endif // wxUSE_GAUGE