xref: /trunk/main/vcl/source/window/scrwnd.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <vcl/floatwin.hxx>
29 #include <vcl/bitmap.hxx>
30 #include <vcl/image.hxx>
31 
32 // -----------
33 // - Defines -
34 // -----------
35 
36 #define WHEELMODE_NONE      0x00000000UL
37 #define WHEELMODE_VH        0x00000001UL
38 #define WHEELMODE_V         0x00000002UL
39 #define WHEELMODE_H         0x00000004UL
40 #define WHEELMODE_SCROLL_VH 0x00000008UL
41 #define WHEELMODE_SCROLL_V  0x00000010UL
42 #define WHEELMODE_SCROLL_H  0x00000020UL
43 
44 // -------------------
45 // - ImplWheelWindow -
46 // -------------------
47 
48 class Timer;
49 
50 class ImplWheelWindow : public FloatingWindow
51 {
52 private:
53 
54     ImageList           maImgList;
55     Bitmap              maWheelBmp;
56     CommandScrollData   maCommandScrollData;
57     Point               maLastMousePos;
58     Point               maCenter;
59     Timer*              mpTimer;
60     sal_uLong               mnRepaintTime;
61     sal_uLong               mnTimeout;
62     sal_uLong               mnWheelMode;
63     sal_uLong               mnMaxWidth;
64     sal_uLong               mnActWidth;
65     sal_uLong               mnActDist;
66     long                mnActDeltaX;
67     long                mnActDeltaY;
68 
69     void                ImplCreateImageList();
70     void                ImplSetRegion( const Bitmap& rRegionBmp );
71     using Window::ImplGetMousePointer;
72     PointerStyle        ImplGetMousePointer( long nDistX, long nDistY );
73     void                ImplDrawWheel();
74     void                ImplRecalcScrollValues();
75 
76                         DECL_LINK( ImplScrollHdl, Timer* pTimer );
77 
78 protected:
79 
80     virtual void        Paint( const Rectangle& rRect );
81     virtual void        MouseMove( const MouseEvent& rMEvt );
82     virtual void        MouseButtonUp( const MouseEvent& rMEvt );
83 
84 public:
85 
86                         ImplWheelWindow( Window* pParent );
87                         ~ImplWheelWindow();
88 
89     void                ImplStop();
90     void                ImplSetWheelMode( sal_uLong nWheelMode );
91     sal_uLong               ImplGetWheelMode() const { return mnWheelMode; }
92 };
93