Constantin Kaplinsky | 7f8d774 | 2006-05-11 05:29:14 +0000 | [diff] [blame^] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
Constantin Kaplinsky | 47ed8d3 | 2004-10-08 09:43:57 +0000 | [diff] [blame] | 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 | #ifndef WINVNCCONF_SHARING |
| 19 | #define WINVNCCONF_SHARING |
| 20 | |
| 21 | #include <rfb_win32/Registry.h> |
| 22 | #include <rfb_win32/Dialog.h> |
| 23 | #include <rfb/ServerCore.h> |
| 24 | |
| 25 | namespace rfb { |
| 26 | |
| 27 | namespace win32 { |
| 28 | |
| 29 | class SharingPage : public PropSheetPage { |
| 30 | public: |
| 31 | SharingPage(const RegKey& rk) |
| 32 | : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_SHARING)), regKey(rk) {} |
| 33 | void initDialog() { |
| 34 | setItemChecked(IDC_DISCONNECT_CLIENTS, rfb::Server::disconnectClients); |
| 35 | setItemChecked(IDC_SHARE_NEVER, rfb::Server::neverShared); |
| 36 | setItemChecked(IDC_SHARE_ALWAYS, rfb::Server::alwaysShared); |
| 37 | setItemChecked(IDC_SHARE_CLIENT, !(rfb::Server::neverShared || rfb::Server::alwaysShared)); |
| 38 | } |
| 39 | bool onCommand(int id, int cmd) { |
| 40 | setChanged((isItemChecked(IDC_DISCONNECT_CLIENTS) != rfb::Server::disconnectClients) || |
| 41 | (isItemChecked(IDC_SHARE_NEVER) != rfb::Server::neverShared) || |
| 42 | (isItemChecked(IDC_SHARE_ALWAYS) != rfb::Server::alwaysShared)); |
| 43 | return true; |
| 44 | } |
| 45 | bool onOk() { |
| 46 | regKey.setBool(_T("DisconnectClients"), isItemChecked(IDC_DISCONNECT_CLIENTS)); |
| 47 | regKey.setBool(_T("AlwaysShared"), isItemChecked(IDC_SHARE_ALWAYS)); |
| 48 | regKey.setBool(_T("NeverShared"), isItemChecked(IDC_SHARE_NEVER)); |
| 49 | return true; |
| 50 | } |
| 51 | protected: |
| 52 | RegKey regKey; |
| 53 | }; |
| 54 | |
| 55 | }; |
| 56 | |
| 57 | }; |
| 58 | |
Constantin Kaplinsky | 7f8d774 | 2006-05-11 05:29:14 +0000 | [diff] [blame^] | 59 | #endif |