blob: 36fc48ef3905afe961f5092b88d14483299ab9a7 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
Pierre Ossman49f88222009-03-20 13:02:50 +00002 * Copyright 2009 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00003 *
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 Ossmancbd1b2c2009-03-20 16:05:04 +000030#include <rfb/ScreenSet.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000031
32namespace rdr { class InStream; }
33
34namespace 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 Ossman49f88222009-03-20 13:02:50 +000043 // 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 Kaplinskya2adc8d2006-05-25 05:01:55 +000046
47 virtual void setDesktopSize(int w, int h);
Pierre Ossmancbd1b2c2009-03-20 16:05:04 +000048 virtual void setExtendedDesktopSize(int reason, int result,
49 int w, int h,
50 const ScreenSet& layout);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000051 virtual void setCursor(int width, int height, const Point& hotspot,
52 void* data, void* mask);
53 virtual void setPixelFormat(const PixelFormat& pf);
54 virtual void setName(const char* name);
55 virtual void serverInit();
56
57 virtual void framebufferUpdateStart();
58 virtual void framebufferUpdateEnd();
59 virtual void beginRect(const Rect& r, unsigned int encoding);
60 virtual void endRect(const Rect& r, unsigned int encoding);
61
62 virtual void setColourMapEntries(int firstColour, int nColours,
63 rdr::U16* rgbs);
64 virtual void bell();
Adam Tkacacf6c6b2009-02-13 12:42:05 +000065 virtual void serverCutText(const char* str, rdr::U32 len);
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000066
67 virtual void fillRect(const Rect& r, Pixel pix);
68 virtual void imageRect(const Rect& r, void* pixels);
69 virtual void copyRect(const Rect& r, int srcX, int srcY);
70
71 virtual bool processFTMsg(int type);
72
73 ConnParams cp;
74 };
75}
76#endif