From aa99e0cd2242db04fe1f9bb7d91aea545def2422 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 20 Jul 2004 14:08:27 +0000 Subject: [PATCH] explicit scrollbar style flags needed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 6f21c231bb..bd85704aad 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -2699,6 +2699,8 @@ void wxWindowMac::MacCreateScrollBars( long style ) { wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ; +#if 0 + bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ; int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ; int width, height ; @@ -2729,6 +2731,34 @@ void wxWindowMac::MacCreateScrollBars( long style ) { m_hScrollBar->Show(false) ; } +#else + if ( style & ( wxVSCROLL | wxHSCROLL ) ) + { + bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ; + int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ; + int width, height ; + GetClientSize( &width , &height ) ; + + wxPoint vPoint(width-MAC_SCROLLBAR_SIZE, 0) ; + wxSize vSize(MAC_SCROLLBAR_SIZE, height - adjust) ; + wxPoint hPoint(0 , height-MAC_SCROLLBAR_SIZE ) ; + wxSize hSize( width - adjust, MAC_SCROLLBAR_SIZE) ; + + + if ( style & wxVSCROLL ) + { + m_vScrollBar = new wxScrollBar(this, wxWINDOW_VSCROLL, vPoint, + vSize , wxVERTICAL); + } + + if ( style & wxHSCROLL ) + { + m_hScrollBar = new wxScrollBar(this, wxWINDOW_HSCROLL, hPoint, + hSize , wxHORIZONTAL); + } + } +#endif + // because the create does not take into account the client area origin MacRepositionScrollBars() ; // we might have a real position shift @@ -2736,6 +2766,9 @@ void wxWindowMac::MacCreateScrollBars( long style ) void wxWindowMac::MacRepositionScrollBars() { + if ( !m_hScrollBar && !m_vScrollBar ) + return ; + bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ; int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1 : 0 ; -- 2.47.2