blob: 1a687d74945ce3090c4c99184940237e1605c3f2 [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +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#ifndef WINVNCCONF_DESKTOP
19#define WINVNCCONF_DESKTOP
20
21#include <rfb_win32/Registry.h>
22#include <rfb_win32/Dialog.h>
23#include <rfb_win32/SDisplay.h>
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000024
25namespace rfb {
26
27 namespace win32 {
28
29 class DesktopPage : public PropSheetPage {
30 public:
31 DesktopPage(const RegKey& rk)
32 : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {}
33 void initDialog() {
Adam Tkac934f63c2009-10-12 15:54:59 +000034 CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000035 bool disconnectLock = stricmp(action.buf, "Lock") == 0;
36 bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000037 setItemChecked(IDC_DISCONNECT_LOGOFF, disconnectLogoff);
38 setItemChecked(IDC_DISCONNECT_LOCK, disconnectLock);
39 setItemChecked(IDC_DISCONNECT_NONE, !disconnectLock && !disconnectLogoff);
40 setItemChecked(IDC_REMOVE_WALLPAPER, rfb::win32::SDisplay::removeWallpaper);
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000041 setItemChecked(IDC_DISABLE_EFFECTS, rfb::win32::SDisplay::disableEffects);
42 }
43 bool onCommand(int id, int cmd) {
44 switch (id) {
45 case IDC_DISCONNECT_LOGOFF:
46 case IDC_DISCONNECT_LOCK:
47 case IDC_DISCONNECT_NONE:
48 case IDC_REMOVE_WALLPAPER:
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000049 case IDC_DISABLE_EFFECTS:
Adam Tkac934f63c2009-10-12 15:54:59 +000050 CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000051 bool disconnectLock = stricmp(action.buf, "Lock") == 0;
52 bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
53 setChanged((disconnectLogoff != isItemChecked(IDC_DISCONNECT_LOGOFF)) ||
54 (disconnectLock != isItemChecked(IDC_DISCONNECT_LOCK)) ||
55 (isItemChecked(IDC_REMOVE_WALLPAPER) != rfb::win32::SDisplay::removeWallpaper) ||
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000056 (isItemChecked(IDC_DISABLE_EFFECTS) != rfb::win32::SDisplay::disableEffects));
57 break;
58 }
59 return false;
60 }
61 bool onOk() {
62 const TCHAR* action = _T("None");
63 if (isItemChecked(IDC_DISCONNECT_LOGOFF))
64 action = _T("Logoff");
65 else if (isItemChecked(IDC_DISCONNECT_LOCK))
66 action = _T("Lock");
67 regKey.setString(_T("DisconnectAction"), action);
68 regKey.setBool(_T("RemoveWallpaper"), isItemChecked(IDC_REMOVE_WALLPAPER));
Constantin Kaplinsky729598c2006-05-25 05:12:25 +000069 regKey.setBool(_T("DisableEffects"), isItemChecked(IDC_DISABLE_EFFECTS));
70 return true;
71 }
72 protected:
73 RegKey regKey;
74 };
75
76 };
77
78};
79
80#endif