]>
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__))
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
& wxGA_VERTICAL
)
107 msFlags
|= PBS_VERTICAL
;
109 if (m_windowStyle
& wxGA_SMOOTH
)
110 msFlags
|= PBS_SMOOTH
;
113 CreateWindowEx(MakeExtendedStyle(m_windowStyle
), PROGRESS_CLASS
, NULL
, msFlags
,
114 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
115 wxGetInstance(), NULL
);
117 m_hWnd
= (WXHWND
)wx_button
;
119 SetBackgroundColour(parent
->GetBackgroundColour());
120 SetForegroundColour(parent
->GetForegroundColour());
122 // Subclass again for purposes of dialog editing mode
123 SubclassWin((WXHWND
) wx_button
);
125 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
127 SetFont(parent
->GetFont());
133 SetSize(x
, y
, width
, height
);
135 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
140 void wxGauge95::SetShadowWidth(int w
)
144 void wxGauge95::SetBezelFace(int w
)
148 void wxGauge95::SetRange(int r
)
152 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
155 void wxGauge95::SetValue(int pos
)
159 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
162 int wxGauge95::GetShadowWidth() const
167 int wxGauge95::GetBezelFace() const
172 int wxGauge95::GetRange() const
177 int wxGauge95::GetValue() const
182 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
184 if ( !wxControl::SetForegroundColour(col
) )
187 SendMessage(GetHwnd(), PBM_SETBARCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
192 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
194 if ( !wxControl::SetBackgroundColour(col
) )
197 SendMessage(GetHwnd(), PBM_SETBKCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
202 #endif // wxUSE_GAUGE