blob: f685dc346e6d3beafae1e0e505e4c86dc8f950d0 [file] [log] [blame]
Constantin Kaplinskyb30ae7f2006-05-25 05:04:46 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
3 * 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#ifndef __QUERYCONNECTDIALOG_H__
20#define __QUERYCONNECTDIALOG_H__
21
22#include <rfb/Timer.h>
23#include "TXLabel.h"
24#include "TXButton.h"
25#include "TXDialog.h"
26
27class QueryResultCallback {
28 public:
29 virtual ~QueryResultCallback() {}
30 virtual void queryApproved() = 0;
31 virtual void queryRejected() = 0;
32 virtual void queryTimedOut() { queryRejected(); };
33};
34
35class QueryConnectDialog : public TXDialog, public TXEventHandler,
36 public TXButtonCallback,
37 public rfb::Timer::Callback
38{
39 public:
40 QueryConnectDialog(Display* dpy, const char* address_,
41 const char* user_, int timeout_,
42 QueryResultCallback* cb);
43 void handleEvent(TXWindow*, XEvent* ) { }
44 void deleteWindow(TXWindow*);
45 void buttonActivate(TXButton* b);
46 bool handleTimeout(rfb::Timer* t);
47 private:
48 void refreshTimeout();
49 TXLabel addressLbl, address, userLbl, user, timeoutLbl, timeout;
50 TXButton accept, reject;
51 QueryResultCallback* callback;
52 int timeUntilReject;
53 rfb::Timer timer;
54};
55
56#endif