Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 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 | #ifndef __DESKTOPWINDOW_H__ |
| 21 | #define __DESKTOPWINDOW_H__ |
| 22 | |
Pierre Ossman | d7c5b04 | 2011-04-14 14:05:13 +0000 | [diff] [blame] | 23 | #include <map> |
| 24 | |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 25 | #include <FL/Fl.H> |
| 26 | #include <FL/Fl_Window.H> |
| 27 | |
| 28 | #include <rfb/Rect.h> |
Pierre Ossman | d50b3d1 | 2011-04-15 07:46:56 +0000 | [diff] [blame] | 29 | |
| 30 | #include "Viewport.h" |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 31 | |
| 32 | class CConn; |
| 33 | |
| 34 | class DesktopWindow : public Fl_Window { |
| 35 | public: |
| 36 | |
| 37 | DesktopWindow(int w, int h, const char *name, |
| 38 | const rfb::PixelFormat& serverPF, CConn* cc_); |
| 39 | ~DesktopWindow(); |
| 40 | |
| 41 | // PixelFormat of incoming write operations |
| 42 | void setServerPF(const rfb::PixelFormat& pf); |
| 43 | // Most efficient format (from DesktopWindow's point of view) |
| 44 | const rfb::PixelFormat &getPreferredPF(); |
| 45 | |
| 46 | // setCursor() sets the shape of the local cursor |
| 47 | void setCursor(int width, int height, const rfb::Point& hotspot, |
| 48 | void* data, void* mask); |
| 49 | |
| 50 | // Flush updates to screen |
| 51 | void updateWindow(); |
| 52 | |
| 53 | // Methods forwarded from CConn |
| 54 | void setName(const char *name); |
| 55 | |
| 56 | void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs); |
| 57 | |
| 58 | void fillRect(const rfb::Rect& r, rfb::Pixel pix) { |
Pierre Ossman | d50b3d1 | 2011-04-15 07:46:56 +0000 | [diff] [blame] | 59 | viewport->fillRect(r, pix); |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 60 | } |
| 61 | void imageRect(const rfb::Rect& r, void* pixels) { |
Pierre Ossman | d50b3d1 | 2011-04-15 07:46:56 +0000 | [diff] [blame] | 62 | viewport->imageRect(r, pixels); |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 63 | } |
| 64 | void copyRect(const rfb::Rect& r, int srcX, int srcY) { |
Pierre Ossman | d50b3d1 | 2011-04-15 07:46:56 +0000 | [diff] [blame] | 65 | viewport->copyRect(r, srcX, srcY); |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 66 | } |
| 67 | |
Pierre Ossman | 4ae229f | 2011-04-15 12:58:31 +0000 | [diff] [blame^] | 68 | // Fl_Window callback methods |
| 69 | void resize(int x, int y, int w, int h); |
| 70 | |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 71 | private: |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 72 | static void handleClose(Fl_Widget *wnd, void *data); |
| 73 | |
| 74 | private: |
Pierre Ossman | d50b3d1 | 2011-04-15 07:46:56 +0000 | [diff] [blame] | 75 | Viewport *viewport; |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | #endif |