// Guacamole namespace
var Guacamole = Guacamole || {};
+/**
+ * Guacamole protocol client. Given a display element and {@link Guacamole.Tunnel},
+ * automatically handles incoming and outgoing Guacamole instructions via the
+ * provided tunnel, updating the display using one or more canvas elements.
+ *
+ * @constructor
+ * @param {Element} display The display element to add canvas elements to.
+ * @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive
+ * Guacamole instructions.
+ */
Guacamole.Client = function(display, tunnel) {
var guac_client = this;
};
+/**
+ * Simple container for properties describing the state of a mouse.
+ *
+ * @constructor
+ * @param {Number} x The X position of the mouse pointer in pixels.
+ * @param {Number} y The Y position of the mouse pointer in pixels.
+ * @param {Boolean} left Whether the left mouse button is pressed.
+ * @param {Boolean} middle Whether the middle mouse button is pressed.
+ * @param {Boolean} right Whether the right mouse button is pressed.
+ * @param {Boolean} up Whether the up mouse button is pressed (the fourth
+ * button, usually part of a scroll wheel).
+ * @param {Boolean} down Whether the down mouse button is pressed (the fifth
+ * button, usually part of a scroll wheel).
+ */
Guacamole.Mouse.State = function(x, y, left, middle, right, up, down) {
+ /**
+ * The current X position of the mouse pointer.
+ * @type Number
+ */
this.x = x;
+
+ /**
+ * The current Y position of the mouse pointer.
+ * @type Number
+ */
this.y = y;
+
+ /**
+ * Whether the left mouse button is currently pressed.
+ * @type Boolean
+ */
this.left = left;
+
+ /**
+ * Whether the middle mouse button is currently pressed.
+ * @type Boolean
+ */
this.middle = middle
+
+ /**
+ * Whether the right mouse button is currently pressed.
+ * @type Boolean
+ */
this.right = right;
+
+ /**
+ * Whether the up mouse button is currently pressed. This is the fourth
+ * mouse button, associated with upward scrolling of the mouse scroll
+ * wheel.
+ * @type Boolean
+ */
this.up = up;
+
+ /**
+ * Whether the down mouse button is currently pressed. This is the fifth
+ * mouse button, associated with downward scrolling of the mouse scroll
+ * wheel.
+ * @type Boolean
+ */
this.down = down;
};
// Guacamole namespace
var Guacamole = Guacamole || {};
+/**
+ * Dynamic on-screen keyboard. Given the URL to an XML keyboard layout file,
+ * this object will download and use the XML to construct a clickable on-screen
+ * keyboard with its own key events.
+ *
+ * @constructor
+ * @param {String} url The URL of an XML keyboard layout file.
+ */
Guacamole.OnScreenKeyboard = function(url) {
var allKeys = new Array();
// Guacamole namespace
var Guacamole = Guacamole || {};
+/**
+ * Core object providing abstract communication for Guacamole. This object
+ * is a null implementation whose functions do nothing. Guacamole applications
+ * should use {@link Guacamole.HTTPTunnel} instead, or implement their own tunnel based
+ * on this one.
+ *
+ * @constructor
+ * @see Guacamole.HTTPTunnel
+ */
+Guacamole.Tunnel = function() {
+
+ this.connect = function(data) {};
+
+ this.disconnect = function() {};
+
+ this.sendMessage = function(message) {};
+
+ this.onerror = null;
+ this.oninstruction = null;
+
+};
+
+/**
+ * Guacamole Tunnel implemented over HTTP via XMLHttpRequest.
+ *
+ * @constructor
+ * @augments Guacamole.Tunnel
+ * @param {String} tunnelURL The URL of the HTTP tunneling service.
+ */
Guacamole.HTTPTunnel = function(tunnelURL) {
var tunnel = this;
var sendingMessages = 0;
var outputMessageBuffer = "";
- // Handlers
- tunnel.onerror = null;
- tunnel.oninstruction = null;
-
function sendMessage(message) {
// Do not attempt to send messages if not connected
tunnel.disconnect = disconnect;
tunnel.sendMessage = sendMessage;
-}
+};
+
+Guacamole.HTTPTunnel.prototype = new Guacamole.Tunnel();