]>
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 and Markus Holzem
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();
104 long msFlags
= WS_CHILD
| WS_VISIBLE
/* | WS_CLIPSIBLINGS */;
106 if ( m_windowStyle
& wxCLIP_SIBLINGS
)
107 msFlags
|= WS_CLIPSIBLINGS
;
110 if (m_windowStyle
& wxGA_VERTICAL
)
111 msFlags
|= PBS_VERTICAL
;
113 if (m_windowStyle
& wxGA_SMOOTH
)
114 msFlags
|= PBS_SMOOTH
;
117 CreateWindowEx(MakeExtendedStyle(m_windowStyle
), PROGRESS_CLASS
, NULL
, msFlags
,
118 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
119 wxGetInstance(), NULL
);
121 m_hWnd
= (WXHWND
)wx_button
;
123 SetBackgroundColour(parent
->GetBackgroundColour());
124 SetForegroundColour(parent
->GetForegroundColour());
126 // Subclass again for purposes of dialog editing mode
127 SubclassWin((WXHWND
) wx_button
);
129 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
131 SetFont(parent
->GetFont());
137 SetSize(x
, y
, width
, height
);
139 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
144 void wxGauge95::SetShadowWidth(int WXUNUSED(w
))
148 void wxGauge95::SetBezelFace(int WXUNUSED(w
))
152 void wxGauge95::SetRange(int r
)
156 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
159 void wxGauge95::SetValue(int pos
)
163 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
166 int wxGauge95::GetShadowWidth() const
171 int wxGauge95::GetBezelFace() const
176 int wxGauge95::GetRange() const
181 int wxGauge95::GetValue() const
186 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
188 if ( !wxControl::SetForegroundColour(col
) )
191 SendMessage(GetHwnd(), PBM_SETBARCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
196 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
198 if ( !wxControl::SetBackgroundColour(col
) )
201 SendMessage(GetHwnd(), PBM_SETBKCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
206 #endif // wxUSE_GAUGE