update dev300-m58
[ooovba.git] / dbaccess / source / ui / control / ScrollHelper.cxx
blobc0055d0a9b02d4d5f26e04f4973b9829f468b584
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ScrollHelper.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef DBAUI_SCROLLHELPER_HXX
35 #include "ScrollHelper.hxx"
36 #endif
37 #ifndef _TOOLS_DEBUG_HXX
38 #include <tools/debug.hxx>
39 #endif
41 #define LISTBOX_SCROLLING_AREA 12
42 namespace dbaui
44 DBG_NAME(OScrollHelper)
46 // -----------------------------------------------------------------------------
49 OScrollHelper::OScrollHelper()
51 DBG_CTOR(OScrollHelper,NULL);
53 // -----------------------------------------------------------------------------
54 OScrollHelper::~OScrollHelper()
57 DBG_DTOR(OScrollHelper,NULL);
59 // -----------------------------------------------------------------------------
60 void OScrollHelper::scroll(const Point& _rPoint, const Size& _rOutputSize)
62 // Scrolling Areas
63 Rectangle aScrollArea( Point(0, _rOutputSize.Height() - LISTBOX_SCROLLING_AREA),
64 Size(_rOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
66 Link aToCall;
67 // if pointer in bottom area begin scroll
68 if( aScrollArea.IsInside(_rPoint) )
69 aToCall = m_aUpScroll;
70 else
72 aScrollArea.SetPos(Point(0,0));
73 // if pointer in top area begin scroll
74 if( aScrollArea.IsInside(_rPoint) )
75 aToCall = m_aDownScroll;
77 if ( aToCall.IsSet() )
78 aToCall.Call( NULL );
80 // -----------------------------------------------------------------------------
82 // -----------------------------------------------------------------------------