1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbui.hxx"
26
27 #ifndef DBAUI_SCROLLHELPER_HXX
28 #include "ScrollHelper.hxx"
29 #endif
30 #ifndef _TOOLS_DEBUG_HXX
31 #include <tools/debug.hxx>
32 #endif
33
34 #define LISTBOX_SCROLLING_AREA 12
35 namespace dbaui
36 {
DBG_NAME(OScrollHelper)37 DBG_NAME(OScrollHelper)
38
39 // -----------------------------------------------------------------------------
40
41
42 OScrollHelper::OScrollHelper()
43 {
44 DBG_CTOR(OScrollHelper,NULL);
45 }
46 // -----------------------------------------------------------------------------
~OScrollHelper()47 OScrollHelper::~OScrollHelper()
48 {
49
50 DBG_DTOR(OScrollHelper,NULL);
51 }
52 // -----------------------------------------------------------------------------
scroll(const Point & _rPoint,const Size & _rOutputSize)53 void OScrollHelper::scroll(const Point& _rPoint, const Size& _rOutputSize)
54 {
55 // Scrolling Areas
56 Rectangle aScrollArea( Point(0, _rOutputSize.Height() - LISTBOX_SCROLLING_AREA),
57 Size(_rOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
58
59 Link aToCall;
60 // if pointer in bottom area begin scroll
61 if( aScrollArea.IsInside(_rPoint) )
62 aToCall = m_aUpScroll;
63 else
64 {
65 aScrollArea.SetPos(Point(0,0));
66 // if pointer in top area begin scroll
67 if( aScrollArea.IsInside(_rPoint) )
68 aToCall = m_aDownScroll;
69 }
70 if ( aToCall.IsSet() )
71 aToCall.Call( NULL );
72 }
73 // -----------------------------------------------------------------------------
74 }
75 // -----------------------------------------------------------------------------
76
77
78