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 #include <vcl/floatwin.hxx> 25 #include <vcl/bitmap.hxx> 26 #include <vcl/image.hxx> 27 28 // ----------- 29 // - Defines - 30 // ----------- 31 32 #define WHEELMODE_NONE 0x00000000UL 33 #define WHEELMODE_VH 0x00000001UL 34 #define WHEELMODE_V 0x00000002UL 35 #define WHEELMODE_H 0x00000004UL 36 #define WHEELMODE_SCROLL_VH 0x00000008UL 37 #define WHEELMODE_SCROLL_V 0x00000010UL 38 #define WHEELMODE_SCROLL_H 0x00000020UL 39 40 // ------------------- 41 // - ImplWheelWindow - 42 // ------------------- 43 44 class Timer; 45 46 class ImplWheelWindow : public FloatingWindow 47 { 48 private: 49 50 ImageList maImgList; 51 Bitmap maWheelBmp; 52 CommandScrollData maCommandScrollData; 53 Point maLastMousePos; 54 Point maCenter; 55 Timer* mpTimer; 56 sal_uLong mnRepaintTime; 57 sal_uLong mnTimeout; 58 sal_uLong mnWheelMode; 59 sal_uLong mnMaxWidth; 60 sal_uLong mnActWidth; 61 sal_uLong mnActDist; 62 long mnActDeltaX; 63 long mnActDeltaY; 64 65 void ImplCreateImageList(); 66 void ImplSetRegion( const Bitmap& rRegionBmp ); 67 using Window::ImplGetMousePointer; 68 PointerStyle ImplGetMousePointer( long nDistX, long nDistY ); 69 void ImplDrawWheel(); 70 void ImplRecalcScrollValues(); 71 72 DECL_LINK( ImplScrollHdl, Timer* pTimer ); 73 74 protected: 75 76 virtual void Paint( const Rectangle& rRect ); 77 virtual void MouseMove( const MouseEvent& rMEvt ); 78 virtual void MouseButtonUp( const MouseEvent& rMEvt ); 79 80 public: 81 82 ImplWheelWindow( Window* pParent ); 83 ~ImplWheelWindow(); 84 85 void ImplStop(); 86 void ImplSetWheelMode( sal_uLong nWheelMode ); ImplGetWheelMode() const87 sal_uLong ImplGetWheelMode() const { return mnWheelMode; } 88 }; 89