]>
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 #if wxUSE_EXTENDED_RTTI
70 IMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge95
, wxControl
,"wx/gauge.h")
72 WX_BEGIN_PROPERTIES_TABLE(wxGauge95
)
73 WX_PROPERTY( Value
, int , SetValue
, GetValue
, 0 )
74 WX_PROPERTY( Range
, int , SetRange
, GetRange
, 0 )
75 WX_PROPERTY( ShadowWidth
, int , SetShadowWidth
, GetShadowWidth
, 0 )
76 WX_PROPERTY( BezelFace
, int , SetBezelFace
, GetBezelFace
, 0 )
81 WX_END_PROPERTIES_TABLE()
83 WX_BEGIN_HANDLERS_TABLE(wxGauge95
)
84 WX_END_HANDLERS_TABLE()
86 WX_CONSTRUCTOR_6( wxGauge95
, wxWindow
* , Parent
, wxWindowID
, Id
, int , Range
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
88 IMPLEMENT_DYNAMIC_CLASS(wxGauge95
, wxControl
)
91 // ============================================================================
93 // ============================================================================
95 bool wxGauge95::Create(wxWindow
*parent
, wxWindowID id
,
100 const wxValidator
& validator
,
101 const wxString
& name
)
105 SetValidator(validator
);
106 #endif // wxUSE_VALIDATORS
108 if (parent
) parent
->AddChild(this);
112 m_windowStyle
= style
;
115 m_windowId
= (int)NewControlId();
125 long msFlags
= MSWGetStyle(style
, & exStyle
) ;
127 if (m_windowStyle
& wxGA_VERTICAL
)
128 msFlags
|= PBS_VERTICAL
;
130 if (m_windowStyle
& wxGA_SMOOTH
)
131 msFlags
|= PBS_SMOOTH
;
134 CreateWindowEx(exStyle
, PROGRESS_CLASS
, NULL
, msFlags
,
135 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
136 wxGetInstance(), NULL
);
138 m_hWnd
= (WXHWND
)wx_button
;
140 SetBackgroundColour(parent
->GetBackgroundColour());
141 SetForegroundColour(parent
->GetForegroundColour());
143 // Subclass again for purposes of dialog editing mode
144 SubclassWin((WXHWND
) wx_button
);
146 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
148 SetFont(parent
->GetFont());
154 SetSize(x
, y
, width
, height
);
156 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
161 void wxGauge95::SetShadowWidth(int WXUNUSED(w
))
165 void wxGauge95::SetBezelFace(int WXUNUSED(w
))
169 void wxGauge95::SetRange(int r
)
173 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
176 void wxGauge95::SetValue(int pos
)
180 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
183 int wxGauge95::GetShadowWidth() const
188 int wxGauge95::GetBezelFace() const
193 int wxGauge95::GetRange() const
198 int wxGauge95::GetValue() const
203 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
205 if ( !wxControl::SetForegroundColour(col
) )
208 SendMessage(GetHwnd(), PBM_SETBARCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
213 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
215 if ( !wxControl::SetBackgroundColour(col
) )
218 SendMessage(GetHwnd(), PBM_SETBKCOLOR
, 0, (LPARAM
)wxColourToRGB(col
));
223 #endif // wxUSE_GAUGE