blob: c38b3a1b86d4c88fb15dca49588f33d9b7a3d2a6 [file] [log] [blame]
Constantin Kaplinskyac306682006-05-16 08:48:31 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00003 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * 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 for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- ConnectingDialog.h
20
Constantin Kaplinskyac306682006-05-16 08:48:31 +000021// ConnectingDialog instances are used to display a status dialog while a
22// connection attempt is in progress. The connection attempt is performed
23// in a background thread by the ConnectingDialog, to allow the status dialog
24// to remain interactive. If the dialog is cancelled then it will close and
25// the connection dialog will eventually tidy itself up.
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000026
27#ifndef __RFB_WIN32_CONNECTING_DLG_H__
28#define __RFB_WIN32_CONNECTING_DLG_H__
29
Constantin Kaplinskyac306682006-05-16 08:48:31 +000030#include <windows.h>
31#include <network/Socket.h>
32#include <rfb/util.h>
33#include <rfb_win32/Handle.h>
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000034
35namespace rfb {
36
37 namespace win32 {
38
Constantin Kaplinskyac306682006-05-16 08:48:31 +000039 class ConnectingDialog {
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000040 public:
Constantin Kaplinskyac306682006-05-16 08:48:31 +000041 ConnectingDialog();
42
43 // connect
44 // Show a Connecting dialog and attempt to connect to the specified host
45 // in the background.
46 // If the connection succeeds then the Socket is returned.
47 // If an error occurs, an Exception is thrown.
48 // If the dialog is cancelled then null is returned.
49 network::Socket* connect(const char* hostAndPort);
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000050 protected:
51 HWND dialog;
Constantin Kaplinskyac306682006-05-16 08:48:31 +000052 network::Socket* newSocket;
53 CharArray errMsg;
54 Handle readyEvent;
55 int dialogId;
56
57 class Thread;
58 friend class Thread;
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000059 };
60
61 };
62
63};
64
Constantin Kaplinskyac306682006-05-16 08:48:31 +000065#endif