01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // This program is free software; you can redistribute it and/or modify
04: // it under the terms of the GNU General Public License and GNU Library
05: // General Public License as published by the Free Software Foundation;
06: // either version 2, or (at your option) any later version.
07: //
08: // This program is distributed in the hope that it will be useful,
09: // 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 and GNU Library General Public License
12: // for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // and GNU Library General Public License along with this program; if
16: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
17: // MA 02139, USA.
18: //
19: ///////////////////////////////////////////////////////////////////////////////
20:
21: package org.rdesktop.server.rdp;
22:
23: import java.awt.*;
24: import java.awt.event.*;
25:
26: import org.rdesktop.server.*;
27: import org.rdesktop.server.rdp.RdpProto;
28: import org.rdesktop.server.rdp.rdp5.cliprdr.ClipChannel;
29: import org.rdesktop.server.rdp.keymapping.KeyCode_FileBased;
30:
31: public class RdpDesktopFrame {
32: public RdpProto m_rdp;
33: public RemoteDesktopApplet m_applet;
34: public RdpAbstractDesktopCanvas m_canvas;
35: public ScrollPane m_desktopScrollPane;
36:
37: public RdpDesktopFrame(RdpViewer viewer, int width, int height,
38: RemoteDesktopApplet applet) {
39: m_canvas = new RdpDesktopCanvas(width, height);
40: m_desktopScrollPane = new ScrollPane(
41: ScrollPane.SCROLLBARS_AS_NEEDED);
42: m_desktopScrollPane.add(m_canvas);
43:
44: m_applet = applet;
45: m_applet.getContentPane().add(m_desktopScrollPane);
46: }
47:
48: public void setClip(ClipChannel c) {
49: m_canvas.addFocusListener(c);
50: }
51:
52: public boolean action(Event event, Object arg) {
53: return false;
54: }
55:
56: public RdpAbstractDesktopCanvas getCanvas() {
57: return m_canvas;
58: }
59:
60: public void registerCommLayer(RdpProto rdp) {
61: m_rdp = rdp;
62: m_canvas.registerCommLayer(m_rdp);
63:
64: m_applet.addComponentListener(new RdpDesktopComponentAdapter());
65: m_canvas.addFocusListener(new RdpDesktopFocusListener());
66: m_canvas.requestFocus();
67: }
68:
69: public void registerKeyboard(KeyCode_FileBased keys) {
70: m_canvas.registerKeyboard(keys);
71: }
72:
73: class RdpDesktopFocusListener implements FocusListener {
74: public void focusGained(FocusEvent arg0) {
75: m_canvas.repaint(0, 0, m_rdp.m_width, m_rdp.m_height);
76: m_canvas.gainedFocus();
77: }
78:
79: public void focusLost(FocusEvent arg0) {
80: m_canvas.lostFocus();
81: }
82: }
83:
84: class RdpDesktopComponentAdapter extends ComponentAdapter {
85: public void componentMoved(ComponentEvent e) {
86: m_canvas.repaint(0, 0, m_rdp.m_width, m_rdp.m_height);
87: }
88: }
89:
90: public void triggerReadyToSend() {
91: m_canvas.triggerReadyToSend();
92: }
93: }
|