Undo.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*******************************************************************************
  2. The content of this file includes portions of the AUDIOKINETIC Wwise Technology
  3. released in source code form as part of the SDK installer package.
  4. Commercial License Usage
  5. Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
  6. may use this file in accordance with the end user license agreement provided
  7. with the software or, alternatively, in accordance with the terms contained in a
  8. written agreement between you and Audiokinetic Inc.
  9. Apache License Usage
  10. Alternatively, this file may be used under the Apache License, Version 2.0 (the
  11. "Apache License"); you may not use this file except in compliance with the
  12. Apache License. You may obtain a copy of the Apache License at
  13. http://www.apache.org/licenses/LICENSE-2.0.
  14. Unless required by applicable law or agreed to in writing, software distributed
  15. under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  16. OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
  17. the specific language governing permissions and limitations under the License.
  18. Copyright (c) 2023 Audiokinetic Inc.
  19. *******************************************************************************/
  20. #ifndef _AK_WWISE_UNDO_H
  21. #define _AK_WWISE_UNDO_H
  22. #include <AK/Wwise/Utilities.h>
  23. #ifdef _DEBUG
  24. #define UNDO_EVENT_DEBUG_INFO
  25. #endif // _DEBUG
  26. namespace AK
  27. {
  28. namespace Wwise
  29. {
  30. class IUndoEvent
  31. : public IPluginBase
  32. {
  33. public:
  34. // Un-execute the action
  35. virtual bool Undo() = 0;
  36. // Re-execute the action
  37. virtual bool Redo() = 0;
  38. // Get the name of the action
  39. virtual bool GetName( CStringW& out_csName ) = 0;
  40. // Check if this undo event is relevant all by itself. For example,
  41. // a selection change is not necessary, but is nice to have around when
  42. // surrounded by other events in a complex undo.
  43. virtual bool IsNecessary() = 0;
  44. // Return the associated object GUID this undo is modifying
  45. virtual GUID GetObjectID() const = 0;
  46. // Get a string representing data for this
  47. // undo event. It will be used to display info in the
  48. // debug window. The object should prepend in_szPrefix
  49. // to the string (for formatting complex undo info)
  50. virtual bool GetDebugString( LPCWSTR in_szPrefix, CStringW& out_csString ) = 0;
  51. };
  52. class IComplexUndo
  53. : public IUndoEvent
  54. {
  55. public:
  56. // Add an event to this complex undo event
  57. virtual bool AddEvent( IUndoEvent* in_pEvent ) = 0;
  58. // Check if this complex undo is empty ( i.e. contains no sub events ).
  59. virtual bool IsEmpty() = 0;
  60. // If this complex undo contains only one sub event, remove it and return it
  61. virtual IUndoEvent* ExtractSingleSubEvent() = 0;
  62. };
  63. class IUndoManager
  64. {
  65. public:
  66. // Add an undo event
  67. virtual bool AddEvent( IUndoEvent* in_pEvent ) = 0;
  68. // Open a complex undo event that will contain all subsequent undo events
  69. virtual bool OpenComplex( IComplexUndo * in_pComplex = NULL ) = 0;
  70. // Close the current complex undo
  71. virtual bool CloseComplex( LPCWSTR in_szName, bool in_bKeepEvenIfContainsSingleEvent = false ) = 0;
  72. // Cancel the current complex undo
  73. virtual bool CancelComplex() = 0;
  74. // Check if we are currently in a state where we can add undo events.
  75. virtual bool CanAddEvent() = 0;
  76. // Check if we are busy (undoing or redoing).
  77. virtual bool IsBusy() = 0;
  78. };
  79. }
  80. }
  81. #endif // _AK_WWISE_UNDO_H