You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Desktop.h 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* 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. #include <rfb_win32/Registry.h>
  21. #include <rfb_win32/Dialog.h>
  22. #include <rfb_win32/SDisplay.h>
  23. namespace rfb {
  24. namespace win32 {
  25. class DesktopPage : public PropSheetPage {
  26. public:
  27. DesktopPage(const RegKey& rk)
  28. : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DESKTOP)), regKey(rk) {}
  29. void initDialog() {
  30. CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
  31. bool disconnectLock = stricmp(action.buf, "Lock") == 0;
  32. bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
  33. setItemChecked(IDC_DISCONNECT_LOGOFF, disconnectLogoff);
  34. setItemChecked(IDC_DISCONNECT_LOCK, disconnectLock);
  35. setItemChecked(IDC_DISCONNECT_NONE, !disconnectLock && !disconnectLogoff);
  36. setItemChecked(IDC_REMOVE_WALLPAPER, rfb::win32::SDisplay::removeWallpaper);
  37. setItemChecked(IDC_DISABLE_EFFECTS, rfb::win32::SDisplay::disableEffects);
  38. }
  39. bool onCommand(int id, int /*cmd*/) {
  40. switch (id) {
  41. case IDC_DISCONNECT_LOGOFF:
  42. case IDC_DISCONNECT_LOCK:
  43. case IDC_DISCONNECT_NONE:
  44. case IDC_REMOVE_WALLPAPER:
  45. case IDC_DISABLE_EFFECTS:
  46. CharArray action(rfb::win32::SDisplay::disconnectAction.getData());
  47. bool disconnectLock = stricmp(action.buf, "Lock") == 0;
  48. bool disconnectLogoff = stricmp(action.buf, "Logoff") == 0;
  49. setChanged((disconnectLogoff != isItemChecked(IDC_DISCONNECT_LOGOFF)) ||
  50. (disconnectLock != isItemChecked(IDC_DISCONNECT_LOCK)) ||
  51. (isItemChecked(IDC_REMOVE_WALLPAPER) != rfb::win32::SDisplay::removeWallpaper) ||
  52. (isItemChecked(IDC_DISABLE_EFFECTS) != rfb::win32::SDisplay::disableEffects));
  53. break;
  54. }
  55. return false;
  56. }
  57. bool onOk() {
  58. const TCHAR* action = _T("None");
  59. if (isItemChecked(IDC_DISCONNECT_LOGOFF))
  60. action = _T("Logoff");
  61. else if (isItemChecked(IDC_DISCONNECT_LOCK))
  62. action = _T("Lock");
  63. regKey.setString(_T("DisconnectAction"), action);
  64. regKey.setBool(_T("RemoveWallpaper"), isItemChecked(IDC_REMOVE_WALLPAPER));
  65. regKey.setBool(_T("DisableEffects"), isItemChecked(IDC_DISABLE_EFFECTS));
  66. return true;
  67. }
  68. protected:
  69. RegKey regKey;
  70. };
  71. };
  72. };
  73. #endif