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.

Sharing.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_SHARING
  19. #define WINVNCCONF_SHARING
  20. #include <rfb_win32/Registry.h>
  21. #include <rfb_win32/Dialog.h>
  22. #include <rfb/ServerCore.h>
  23. namespace rfb {
  24. namespace win32 {
  25. class SharingPage : public PropSheetPage {
  26. public:
  27. SharingPage(const RegKey& rk)
  28. : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_SHARING)), regKey(rk) {}
  29. void initDialog() {
  30. setItemChecked(IDC_DISCONNECT_CLIENTS, rfb::Server::disconnectClients);
  31. setItemChecked(IDC_SHARE_NEVER, rfb::Server::neverShared);
  32. setItemChecked(IDC_SHARE_ALWAYS, rfb::Server::alwaysShared);
  33. setItemChecked(IDC_SHARE_CLIENT, !(rfb::Server::neverShared || rfb::Server::alwaysShared));
  34. }
  35. bool onCommand(int /*id*/, int /*cmd*/) {
  36. setChanged((isItemChecked(IDC_DISCONNECT_CLIENTS) != rfb::Server::disconnectClients) ||
  37. (isItemChecked(IDC_SHARE_NEVER) != rfb::Server::neverShared) ||
  38. (isItemChecked(IDC_SHARE_ALWAYS) != rfb::Server::alwaysShared));
  39. return true;
  40. }
  41. bool onOk() {
  42. regKey.setBool(_T("DisconnectClients"), isItemChecked(IDC_DISCONNECT_CLIENTS));
  43. regKey.setBool(_T("AlwaysShared"), isItemChecked(IDC_SHARE_ALWAYS));
  44. regKey.setBool(_T("NeverShared"), isItemChecked(IDC_SHARE_NEVER));
  45. return true;
  46. }
  47. protected:
  48. RegKey regKey;
  49. };
  50. };
  51. };
  52. #endif