Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | // -=- CPointer.h |
| 20 | // |
| 21 | // Client-side pointer event handling for Win32 |
| 22 | |
| 23 | #ifndef __RFB_WIN32_CPOINTER_H__ |
| 24 | #define __RFB_WIN32_CPOINTER_H__ |
| 25 | |
| 26 | #include <rdr/Exception.h> |
| 27 | #include <rfb/Configuration.h> |
| 28 | #include <rfb/InputHandler.h> |
| 29 | #include <rfb/Rect.h> |
| 30 | #include <rfb_win32/IntervalTimer.h> |
| 31 | |
| 32 | namespace rfb { |
| 33 | |
| 34 | namespace win32 { |
| 35 | |
| 36 | class CPointer { |
| 37 | public: |
| 38 | CPointer(); |
| 39 | ~CPointer(); |
| 40 | |
| 41 | void pointerEvent(InputHandler* writer, const Point& pos, int buttonMask); |
| 42 | void handleTimer(InputHandler* writer, int timerId); |
| 43 | |
| 44 | void setHWND(HWND w) {intervalTimer.setHWND(w); threeTimer.setHWND(w);} |
| 45 | void setIntervalTimerId(int id) {intervalTimer.setId(id);} |
| 46 | void set3ButtonTimerId(int id) {threeTimer.setId(id);} |
| 47 | |
| 48 | void enableEmulate3(bool enable) {emulate3 = enable;} |
| 49 | void enableInterval(int millis) {pointerEventInterval = millis;} |
| 50 | private: |
| 51 | Point currPos; |
| 52 | int currButtonMask; |
| 53 | |
| 54 | bool emulate3; |
| 55 | int pointerEventInterval; |
| 56 | |
| 57 | void intervalPointerEvent(InputHandler* writer, const Point& pos, int buttonMask); |
| 58 | IntervalTimer intervalTimer; |
| 59 | bool intervalQueued; |
| 60 | Point intervalPos; |
| 61 | int intervalMask; |
| 62 | |
| 63 | void threePointerEvent(InputHandler* writer, const Point& pos, int buttonMask); |
| 64 | IntervalTimer threeTimer; |
| 65 | Point threePos; |
| 66 | int threeMask; |
| 67 | bool threeEmulating; |
| 68 | }; |
| 69 | |
| 70 | }; // win32 |
| 71 | |
| 72 | }; // rfb |
| 73 | |
| 74 | #endif // __RFB_WIN32_CPOINTER_H__ |