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> |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 30 | #include <rfb/ScreenSet.h> |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 31 | |
| 32 | namespace rdr { class InStream; } |
| 33 | |
| 34 | namespace rfb { |
| 35 | |
| 36 | class CMsgHandler { |
| 37 | public: |
| 38 | CMsgHandler(); |
| 39 | virtual ~CMsgHandler(); |
| 40 | |
| 41 | // The following methods are called as corresponding messages are read. A |
| 42 | // derived class should override these methods as desired. Note that for |
Pierre Ossman | 49f8822 | 2009-03-20 13:02:50 +0000 | [diff] [blame] | 43 | // the setDesktopSize(), setExtendedDesktopSize(), setPixelFormat() and |
| 44 | // setName() methods, a derived class should call on to CMsgHandler's |
| 45 | // methods to set the members of cp appropriately. |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 46 | |
| 47 | virtual void setDesktopSize(int w, int h); |
Pierre Ossman | cbd1b2c | 2009-03-20 16:05:04 +0000 | [diff] [blame] | 48 | virtual void setExtendedDesktopSize(int reason, int result, |
| 49 | int w, int h, |
| 50 | const ScreenSet& layout); |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 51 | virtual void setCursor(int width, int height, const Point& hotspot, |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 52 | void* data, void* mask) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 53 | virtual void setPixelFormat(const PixelFormat& pf); |
| 54 | virtual void setName(const char* name); |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 55 | virtual void serverInit() = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 56 | |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 57 | virtual void framebufferUpdateStart() = 0; |
| 58 | virtual void framebufferUpdateEnd() = 0; |
Peter Åstrand | 98fe98c | 2010-02-10 07:43:02 +0000 | [diff] [blame] | 59 | virtual void beginRect(const Rect& r, int encoding) = 0; |
| 60 | virtual void endRect(const Rect& r, int encoding) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 61 | |
| 62 | virtual void setColourMapEntries(int firstColour, int nColours, |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 63 | rdr::U16* rgbs) = 0; |
| 64 | virtual void bell() = 0; |
| 65 | virtual void serverCutText(const char* str, rdr::U32 len) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 66 | |
Adam Tkac | c184d95 | 2009-06-16 10:50:06 +0000 | [diff] [blame] | 67 | virtual void fillRect(const Rect& r, Pixel pix) = 0; |
| 68 | virtual void imageRect(const Rect& r, void* pixels) = 0; |
| 69 | virtual void copyRect(const Rect& r, int srcX, int srcY) = 0; |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 70 | |
Constantin Kaplinsky | a2adc8d | 2006-05-25 05:01:55 +0000 | [diff] [blame] | 71 | ConnParams cp; |
| 72 | }; |
| 73 | } |
| 74 | #endif |