X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..669b65b94575865adc226d35a0de0dd81dde1e5f:/src/msw/scrolbar.cpp diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index d10d08daad..14e71a1711 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -5,11 +5,11 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "scrolbar.h" #endif @@ -31,6 +31,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) +/* + TODO PROPERTIES + value (long,0) + thumbsize(long,1) + range( long , 10 ) + pagesize( long , 1) +*/ + BEGIN_EVENT_TABLE(wxScrollBar, wxControl) #if WXWIN_COMPATIBILITY EVT_SCROLL(wxScrollBar::OnScroll) @@ -53,6 +61,9 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, SetValidator(validator); #endif // wxUSE_VALIDATORS + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) + style |= wxNO_BORDER; + SetBackgroundColour(parent->GetBackgroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ; m_windowStyle = style; @@ -82,15 +93,13 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, height = 14; } - DWORD wstyle = WS_VISIBLE | WS_CHILD; - - if ( m_windowStyle & wxCLIP_SIBLINGS ) - wstyle |= WS_CLIPSIBLINGS; + WXDWORD exStyle = 0; + WXDWORD wstyle = MSWGetStyle(style, & exStyle) ; // Now create scrollbar DWORD _direction = (style & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT; - HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), wxT("SCROLLBAR"), wxT("scrollbar"), + HWND scroll_bar = CreateWindowEx(exStyle, wxT("SCROLLBAR"), wxT("scrollbar"), _direction | wstyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); @@ -120,16 +129,17 @@ wxScrollBar::~wxScrollBar(void) } bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, - WXWORD pos, WXHWND control) + WXWORD pos, WXHWND WXUNUSED(control)) { // current and max positions int position, maxPos, trackPos = pos; -#ifdef __WIN32__ // when we're dragging the scrollbar we can't use pos parameter because it // is limited to 16 bits - if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK ) + // JACS: now always using GetScrollInfo, since there's no reason + // not to +// if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK ) { SCROLLINFO scrollInfo; wxZeroMemory(scrollInfo); @@ -149,13 +159,14 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, position = scrollInfo.nPos; maxPos = scrollInfo.nMax; } +#if 0 else -#endif // Win32 { position = ::GetScrollPos((HWND) control, SB_CTL); int minPos; ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos); } +#endif #if defined(__WIN95__) // A page size greater than one has the effect of reducing the effective @@ -239,6 +250,7 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, } wxScrollEvent event(scrollEvent, m_windowId); + event.SetOrientation(IsVertical() ? wxVERTICAL : wxHORIZONTAL); event.SetPosition(position); event.SetEventObject( this ); @@ -263,7 +275,17 @@ void wxScrollBar::SetThumbPosition(int viewStart) int wxScrollBar::GetThumbPosition(void) const { - return ::GetScrollPos((HWND)m_hWnd, SB_CTL); + SCROLLINFO scrollInfo; + wxZeroMemory(scrollInfo); + scrollInfo.cbSize = sizeof(SCROLLINFO); + scrollInfo.fMask = SIF_POS; + + if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) ) + { + wxLogLastError(_T("GetScrollInfo")); + } + return scrollInfo.nPos; +// return ::GetScrollPos((HWND)m_hWnd, SB_CTL); } void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,