]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/gauge95.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGauge95 class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "gauge95.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #if wxUSE_GAUGE && defined(__WIN95__)
29 #include "wx/msw/gauge95.h"
30 #include "wx/msw/private.h"
32 #if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
36 #if !USE_SHARED_LIBRARY
37 IMPLEMENT_DYNAMIC_CLASS(wxGauge95
, wxControl
)
40 bool wxGauge95::Create(wxWindow
*parent
, wxWindowID id
,
45 const wxValidator
& validator
,
49 SetValidator(validator
);
51 if (parent
) parent
->AddChild(this);
55 SetBackgroundColour(parent
->GetBackgroundColour()) ;
56 SetForegroundColour(parent
->GetForegroundColour()) ;
58 m_windowStyle
= style
;
61 m_windowId
= (int)NewControlId();
70 long msFlags
= WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
73 #define PBS_VERTICAL 0x04
76 if (m_windowStyle
& wxGA_VERTICAL
)
77 msFlags
|= PBS_VERTICAL
;
80 #define PBS_SMOOTH 0x01
83 if (m_windowStyle
& wxGA_SMOOTH
)
84 msFlags
|= PBS_SMOOTH
;
87 CreateWindowEx(MakeExtendedStyle(m_windowStyle
), PROGRESS_CLASS
, NULL
, msFlags
,
88 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
89 wxGetInstance(), NULL
);
91 m_hWnd
= (WXHWND
)wx_button
;
93 // Subclass again for purposes of dialog editing mode
94 SubclassWin((WXHWND
) wx_button
);
96 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
98 SetFont(parent
->GetFont());
104 SetSize(x
, y
, width
, height
);
106 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
111 void wxGauge95::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
113 int currentX
, currentY
;
114 GetPosition(¤tX
, ¤tY
);
120 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
122 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
125 AdjustForParentClientOrigin(x1
, y1
, sizeFlags
);
127 // If we're prepared to use the existing size, then...
128 if (width
== -1 && height
== -1 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
133 // Deal with default size (using -1 values)
135 w1
= DEFAULT_ITEM_WIDTH
;
138 h1
= DEFAULT_ITEM_HEIGHT
;
140 MoveWindow((HWND
) GetHWND(), x1
, y1
, w1
, h1
, TRUE
);
143 void wxGauge95::SetShadowWidth(int w
)
147 void wxGauge95::SetBezelFace(int w
)
151 void wxGauge95::SetRange(int r
)
155 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
158 void wxGauge95::SetValue(int pos
)
162 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
165 int wxGauge95::GetShadowWidth(void) const
170 int wxGauge95::GetBezelFace(void) const
175 int wxGauge95::GetRange(void) const
180 int wxGauge95::GetValue(void) const
185 bool wxGauge95::SetForegroundColour(const wxColour
& col
)
187 if ( !wxControl::SetForegroundColour(col
) )
190 m_foregroundColour
= col
;
195 bool wxGauge95::SetBackgroundColour(const wxColour
& col
)
197 if ( !wxControl::SetBackgroundColour(col
) )
200 m_backgroundColour
= col
;
205 #endif // wxUSE_GAUGE