X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65fd5cb0124e62ab1fc41f93382a205d95b00e75..342751763793b5cdad252d731aac0618d0674e5b:/src/msw/slider95.cpp diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index d6334217be..69af911269 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -22,8 +22,8 @@ #ifndef WX_PRECOMP #include -#include -#include +#include "wx/utils.h" +#include "wx/brush.h" #endif #ifdef __WIN95__ @@ -35,9 +35,7 @@ #include #endif -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl) -#endif // Slider wxSlider95::wxSlider95() @@ -60,7 +58,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, const wxString& name) { SetName(name); +#if wxUSE_VALIDATORS SetValidator(validator); +#endif // wxUSE_VALIDATORS if (parent) parent->AddChild(this); SetBackgroundColour(parent->GetBackgroundColour()) ; @@ -93,14 +93,14 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, bool want3D; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; - m_staticValue = (WXHWND) CreateWindowEx(exStyle, _T("STATIC"), NULL, + m_staticValue = (WXHWND) CreateWindowEx(exStyle, wxT("STATIC"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); // Now create min static control - wxSprintf(wxBuffer, _T("%d"), minValue); - m_staticMin = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, + wxSprintf(wxBuffer, wxT("%d"), minValue); + m_staticMin = (WXHWND) CreateWindowEx(0, wxT("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -149,15 +149,15 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, SubclassWin(GetHWND()); - SetWindowText((HWND) m_hWnd, _T("")); + SetWindowText((HWND) m_hWnd, wxT("")); SetFont(parent->GetFont()); if ( m_windowStyle & wxSL_LABELS ) { // Finally, create max value static item - wxSprintf(wxBuffer, _T("%d"), maxValue); - m_staticMax = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, + wxSprintf(wxBuffer, wxT("%d"), maxValue); + m_staticMax = (WXHWND) CreateWindowEx(0, wxT("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -239,7 +239,7 @@ bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, nScrollInc = 0; } - if ( nScrollInc == 0 ) + if (scrollEvent == wxEVT_NULL) { // no event... return FALSE; @@ -285,7 +285,7 @@ void wxSlider95::SetValue(int value) ::SendMessage(GetHwnd(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value); if (m_staticValue) { - wxSprintf(wxBuffer, _T("%d"), value); + wxSprintf(wxBuffer, wxT("%d"), value); SetWindowText((HWND) m_staticValue, wxBuffer); } } @@ -355,9 +355,9 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags) int currentX, currentY; GetPosition(¤tX, ¤tY); - if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) x1 = currentX; - if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y1 = currentY; AdjustForParentClientOrigin(x1, y1, sizeFlags); @@ -513,13 +513,13 @@ void wxSlider95::SetRange(int minValue, int maxValue) wxChar buf[40]; if ( m_staticMin ) { - wxSprintf(buf, _T("%d"), m_rangeMin); + wxSprintf(buf, wxT("%d"), m_rangeMin); SetWindowText((HWND) m_staticMin, buf); } if ( m_staticMax ) { - wxSprintf(buf, _T("%d"), m_rangeMax); + wxSprintf(buf, wxT("%d"), m_rangeMax); SetWindowText((HWND) m_staticMax, buf); } } @@ -531,16 +531,7 @@ WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, return 0; // Otherwise, it's a static - if (GetParent()->GetTransparentBackground()) - SetBkMode((HDC) pDC, TRANSPARENT); - else - SetBkMode((HDC) pDC, OPAQUE); - - ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); - ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); - - wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID); - return (WXHBRUSH) backgroundBrush->GetResourceHandle(); + return wxControl::OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); } // For trackbars only