]>
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 USE_GAUGE && defined(__WIN95__)
29 #include "wx/msw/gauge95.h"
30 #include "wx/msw/private.h"
32 #if defined(__WIN95__) && !defined(__GNUWIN32__)
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);
54 SetBackgroundColour(parent
->GetDefaultBackgroundColour()) ;
55 SetForegroundColour(parent
->GetDefaultForegroundColour()) ;
57 m_windowStyle
= style
;
60 m_windowId
= (int)NewControlId();
69 long msFlags
= WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
72 CreateWindowEx(MakeExtendedStyle(m_windowStyle
), PROGRESS_CLASS
, NULL
, msFlags
,
73 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
74 wxGetInstance(), NULL
);
76 m_hWnd
= (WXHWND
)wx_button
;
78 // Subclass again for purposes of dialog editing mode
79 SubclassWin((WXHWND
) wx_button
);
81 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, range
));
83 SetFont(* parent
->GetFont());
89 SetSize(x
, y
, width
, height
);
91 ShowWindow((HWND
) GetHWND(), SW_SHOW
);
96 void wxGauge95::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
98 int currentX
, currentY
;
99 GetPosition(¤tX
, ¤tY
);
105 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
107 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
110 // If we're prepared to use the existing size, then...
111 if (width
== -1 && height
== -1 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
116 // Deal with default size (using -1 values)
118 w1
= DEFAULT_ITEM_WIDTH
;
121 h1
= DEFAULT_ITEM_HEIGHT
;
123 MoveWindow((HWND
) GetHWND(), x1
, y1
, w1
, h1
, TRUE
);
126 void wxGauge95::SetShadowWidth(int w
)
130 void wxGauge95::SetBezelFace(int w
)
134 void wxGauge95::SetRange(int r
)
138 SendMessage((HWND
) GetHWND(), PBM_SETRANGE
, 0, MAKELPARAM(0, r
));
141 void wxGauge95::SetValue(int pos
)
145 SendMessage((HWND
) GetHWND(), PBM_SETPOS
, pos
, 0);
148 int wxGauge95::GetShadowWidth(void) const
153 int wxGauge95::GetBezelFace(void) const
158 int wxGauge95::GetRange(void) const
163 int wxGauge95::GetValue(void) const
168 void wxGauge95::SetForegroundColour(const wxColour
& col
)
170 m_foregroundColour
= col
;
173 void wxGauge95::SetBackgroundColour(const wxColour
& col
)
175 m_backgroundColour
= col
;