UserOptions.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. // Description : These are helper classes for containing the data from the
  9. // generic overwrite dialog.
  10. #ifndef CRYINCLUDE_EDITOR_DIALOGS_GENERIC_USEROPTIONS_H
  11. #define CRYINCLUDE_EDITOR_DIALOGS_GENERIC_USEROPTIONS_H
  12. #pragma once
  13. // Small helper class.
  14. // Hint: have one for files and other for directories.
  15. // Hint: used a CUserOptionsReferenceCountHelper to automatically control the reference counts
  16. // of any CUserOptions variable: usefull for recursion when you don't want to use
  17. // only static variables. See example in FileUtill.cpp, function CopyTree.
  18. class CUserOptions
  19. {
  20. //////////////////////////////////////////////////////////////////////////
  21. // Types & typedefs
  22. public:
  23. enum EOption
  24. {
  25. ENotSet,
  26. EYes = 6,
  27. ENo = 7,
  28. ECancel = 2,
  29. };
  30. class CUserOptionsReferenceCountHelper
  31. {
  32. public:
  33. CUserOptionsReferenceCountHelper(CUserOptions& roUserOptions);
  34. virtual ~CUserOptionsReferenceCountHelper();
  35. protected:
  36. CUserOptions& m_roReferencedUserOptionsObject;
  37. };
  38. protected:
  39. private:
  40. //////////////////////////////////////////////////////////////////////////
  41. //////////////////////////////////////////////////////////////////////////
  42. // Methods
  43. public:
  44. CUserOptions();
  45. bool IsOptionValid();
  46. int GetOption();
  47. bool IsOptionToAll();
  48. void SetOption(int nNewOption, bool boToAll);
  49. int DecRef();
  50. int IncRef();
  51. protected:
  52. private:
  53. //////////////////////////////////////////////////////////////////////////
  54. //////////////////////////////////////////////////////////////////////////
  55. // Data
  56. public:
  57. protected:
  58. int m_nCurrentOption;
  59. bool m_boToAll;
  60. int m_nNumberOfReferences;
  61. private:
  62. //////////////////////////////////////////////////////////////////////////
  63. };
  64. #endif // CRYINCLUDE_EDITOR_DIALOGS_GENERIC_USEROPTIONS_H