2002-03-26 08:20:37 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
2008-04-10 13:21:29 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-03-26 08:20:37 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 06:00:23 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
2011-04-14 10:03:55 +02:00
|
|
|
#include "precompiled_dbui.hxx"
|
2006-09-17 06:00:23 +00:00
|
|
|
|
2002-03-26 08:20:37 +00:00
|
|
|
#ifndef DBAUI_SCROLLHELPER_HXX
|
|
|
|
#include "ScrollHelper.hxx"
|
|
|
|
#endif
|
2005-09-23 11:23:36 +00:00
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
2002-03-26 08:20:37 +00:00
|
|
|
|
2002-07-05 08:28:33 +00:00
|
|
|
#define LISTBOX_SCROLLING_AREA 12
|
2002-03-26 08:20:37 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
2005-09-23 11:23:36 +00:00
|
|
|
DBG_NAME(OScrollHelper)
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2002-03-26 08:20:37 +00:00
|
|
|
OScrollHelper::OScrollHelper()
|
|
|
|
{
|
2005-09-23 11:23:36 +00:00
|
|
|
DBG_CTOR(OScrollHelper,NULL);
|
2002-03-26 08:20:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OScrollHelper::~OScrollHelper()
|
|
|
|
{
|
2005-09-23 11:23:36 +00:00
|
|
|
|
|
|
|
DBG_DTOR(OScrollHelper,NULL);
|
2002-03-26 08:20:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OScrollHelper::scroll(const Point& _rPoint, const Size& _rOutputSize)
|
|
|
|
{
|
|
|
|
// Scrolling Areas
|
|
|
|
Rectangle aScrollArea( Point(0, _rOutputSize.Height() - LISTBOX_SCROLLING_AREA),
|
|
|
|
Size(_rOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
|
|
|
|
|
|
|
|
Link aToCall;
|
|
|
|
// if pointer in bottom area begin scroll
|
|
|
|
if( aScrollArea.IsInside(_rPoint) )
|
|
|
|
aToCall = m_aUpScroll;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aScrollArea.SetPos(Point(0,0));
|
|
|
|
// if pointer in top area begin scroll
|
|
|
|
if( aScrollArea.IsInside(_rPoint) )
|
|
|
|
aToCall = m_aDownScroll;
|
|
|
|
}
|
|
|
|
if ( aToCall.IsSet() )
|
2002-07-05 08:28:33 +00:00
|
|
|
aToCall.Call( NULL );
|
2002-03-26 08:20:37 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|