/////////////////////////////////////////////////////////////////////////////
-// Name: msw/slider.cpp
+// Name: src/msw/slider.cpp
// Purpose: wxSlider, using the Win95 (and later) trackbar control
// Author: Julian Smart
// Modified by:
// declarations
// ============================================================================
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "slider95.h"
-#endif
-
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#if wxUSE_SLIDER
+#include "wx/slider.h"
+
#ifndef WX_PRECOMP
+ #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
#include "wx/brush.h"
#endif
-#include "wx/slider.h"
#include "wx/msw/subwin.h"
-#if !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
- #include <commctrl.h>
-#endif
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
wxEND_FLAGS( wxSliderStyle )
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/scrolbar.h")
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/slider.h")
wxBEGIN_PROPERTIES_TABLE(wxSlider)
wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_CHANGED , wxScrollEvent )
}
};
- wxASSERT_MSG( !(style & wxSL_VERTICAL) | !(style & wxSL_HORIZONTAL),
+ wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
_T("incompatible slider direction and orientation") );
HWND hwndParent = GetHwndOf(parent);
for ( size_t n = 0; n < SliderLabel_Last; n++ )
{
- (*m_labels)[n] = ::CreateWindow
- (
- wxT("STATIC"),
- NULL,
- WS_CHILD | WS_VISIBLE | SS_CENTER,
- 0, 0, 0, 0,
- hwndParent,
- (HMENU)NewControlId(),
- wxGetInstance(),
- NULL
- );
+ wxWindowIDRef lblid = NewControlId();
+
+ HWND wnd = ::CreateWindow
+ (
+ wxT("STATIC"),
+ NULL,
+ WS_CHILD | WS_VISIBLE | SS_CENTER,
+ 0, 0, 0, 0,
+ hwndParent,
+ (HMENU)lblid.GetValue(),
+ wxGetInstance(),
+ NULL
+ );
+
+ m_labels->Set(n, wnd, lblid);
}
m_labels->SetFont(GetFont());
wxScrollEvent event(scrollEvent, m_windowId);
event.SetPosition(newPos);
event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
cevent.SetInt( newPos );
cevent.SetEventObject( this );
- return GetEventHandler()->ProcessEvent( cevent );
+ return HandleWindowEvent( cevent );
}
void wxSlider::Command (wxCommandEvent & event)
if ( m_labels )
{
- ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value));
+ ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).wx_str());
}
}
if ( m_labels )
{
- ::SetWindowText((*m_labels)[SliderLabel_Min], Format(ValueInvertOrNot(m_rangeMin)));
- ::SetWindowText((*m_labels)[SliderLabel_Max], Format(ValueInvertOrNot(m_rangeMax)));
+ ::SetWindowText((*m_labels)[SliderLabel_Min],
+ Format(ValueInvertOrNot(m_rangeMin)).wx_str());
+ ::SetWindowText((*m_labels)[SliderLabel_Max],
+ Format(ValueInvertOrNot(m_rangeMax)).wx_str());
}
}