Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame^] | 2 | * Copyright 2009 Pierre Ossman for Cendio AB |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 3 | * |
| 4 | * This is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This software is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this software; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 17 | * USA. |
| 18 | */ |
| 19 | // |
| 20 | // CMsgHandler - class to handle incoming messages on the client side. |
| 21 | // |
| 22 | |
| 23 | #ifndef __RFB_CMSGHANDLER_H__ |
| 24 | #define __RFB_CMSGHANDLER_H__ |
| 25 | |
| 26 | #include <rdr/types.h> |
| 27 | #include <rfb/Pixel.h> |
| 28 | #include <rfb/ConnParams.h> |
| 29 | #include <rfb/Rect.h> |
| 30 | |
| 31 | namespace rdr { class InStream; } |
| 32 | |
| 33 | namespace rfb { |
| 34 | |
| 35 | class CMsgHandler { |
| 36 | public: |
| 37 | CMsgHandler(); |
| 38 | virtual ~CMsgHandler(); |
| 39 | |
| 40 | // The following methods are called as corresponding messages are read. A |
| 41 | // derived class should override these methods as desired. Note that for |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame^] | 42 | // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat() and |
| 43 | // setName() methods, a derived class should call on to CMsgHandler's |
| 44 | // methods to set the members of cp appropriately. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 45 | |
| 46 | virtual void setDesktopSize(int w, int h); |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame^] | 47 | virtual void setExtendedDesktopSize(int reason, int result, int w, int h); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 48 | virtual void setCursor(int width, int height, const Point& hotspot, |
| 49 | void* data, void* mask); |
| 50 | virtual void setPixelFormat(const PixelFormat& pf); |
| 51 | virtual void setName(const char* name); |
| 52 | virtual void serverInit(); |
| 53 | |
| 54 | virtual void framebufferUpdateStart(); |
| 55 | virtual void framebufferUpdateEnd(); |
| 56 | virtual void beginRect(const Rect& r, unsigned int encoding); |
| 57 | virtual void endRect(const Rect& r, unsigned int encoding); |
| 58 | |
| 59 | virtual void setColourMapEntries(int firstColour, int nColours, |
| 60 | rdr::U16* rgbs); |
| 61 | virtual void bell(); |
Adam Tkac | acf6c6b | 2009-02-13 12:42:05 +0000 | [diff] [blame] | 62 | virtual void serverCutText(const char* str, rdr::U32 len); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 63 | |
| 64 | virtual void fillRect(const Rect& r, Pixel pix); |
| 65 | virtual void imageRect(const Rect& r, void* pixels); |
| 66 | virtual void copyRect(const Rect& r, int srcX, int srcY); |
| 67 | |
| 68 | virtual bool processFTMsg(int type); |
| 69 | |
| 70 | ConnParams cp; |
| 71 | }; |
| 72 | } |
| 73 | #endif |