GUIEditWindowManager.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: GUIEditWindowManager.h ///////////////////////////////////////////////////////////////////
  24. // Created: Colin Day, July 2001
  25. // Desc: Window manager for the GUI edit tool, we want this up
  26. // fast and to look like what we use in the game so we're going
  27. // to use the WW3D window manager, and just override the
  28. // drawing functions to draw lines and images to the
  29. // display. We will also be adding our own functionality
  30. // here for editing and interacting with the GUI windows.
  31. ///////////////////////////////////////////////////////////////////////////////////////////////////
  32. #pragma once
  33. #ifndef __GUIEDITWINDOWMANAGER_H_
  34. #define __GUIEDITWINDOWMANAGER_H_
  35. #include <stdlib.h>
  36. #include "W3DDevice/GameClient/W3DGameWindowManager.h"
  37. //-------------------------------------------------------------------------------------------------
  38. /** GUI edit interface for window manager */
  39. //-------------------------------------------------------------------------------------------------
  40. class GUIEditWindowManager : public W3DGameWindowManager
  41. {
  42. public:
  43. GUIEditWindowManager( void );
  44. virtual ~GUIEditWindowManager( void );
  45. virtual void init( void ); ///< initialize system
  46. virtual Int winDestroy( GameWindow *window ); ///< destroy this window
  47. /// create a new window by setting up parameters and callbacks
  48. virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status,
  49. Int x, Int y, Int width, Int height,
  50. GameWinSystemFunc system,
  51. WinInstanceData *instData = NULL );
  52. // **************************************************************************
  53. // GUIEdit specific methods *************************************************
  54. // **************************************************************************
  55. /** unlink the window to move and place it ahead of the target window
  56. in the master chain or the child chain */
  57. void moveAheadOf( GameWindow *windowToMove, GameWindow *aheadOf );
  58. /// make target a child of the parent
  59. void makeChildOf( GameWindow *target, GameWindow *parent );
  60. void validateClipboardNames( GameWindow *root ); ///< ensure unique names
  61. void incrementName( GameWindow *window ); ///< make a new unique name
  62. void resetClipboard( void ); ///< reset the clipboard to empty
  63. Bool isClipboardEmpty( void ); ///< is the clipboard empty
  64. void duplicateSelected( GameWindow *root ); ///< dupe the selected windows into the clipboard
  65. void copySelectedToClipboard( void ); ///< copy selected windows to clipboard
  66. void cutSelectedToClipboard( void ); ///< cut selected windows to clipboard
  67. void pasteClipboard( void ); ///< paste the contents of the clipboard
  68. GameWindow *getClipboardList( void ); ///< get the clipboard list
  69. GameWindow *getClipboardDupeList( void ); ///< get clipboard dupe list
  70. protected:
  71. /** validate window is part of the clipboard at the top level */
  72. Bool isWindowInClipboard( GameWindow *window, GameWindow **list );
  73. void linkToClipboard( GameWindow *window, GameWindow **list ); ///< add window to clipboard
  74. void unlinkFromClipboard( GameWindow *window, GameWindow **list ); ///< remove window from clipboard
  75. /** remove selected children from the select list that have a parent
  76. also in the select list */
  77. void removeSupervisedChildSelections( void );
  78. /** selected windows that are children will cut loose their parents
  79. and become adults (their parent will be NULL, otherwise the screen) */
  80. // void orphanSelectedChildren( void );
  81. /// dupe a window and its children
  82. GameWindow *duplicateWindow( GameWindow *source, GameWindow *parent );
  83. void createClipboardDuplicate( void ); ///< duplicate the clipboard on the dup list
  84. GameWindow *m_clipboard; ///< list of windows in the clipboard
  85. GameWindow *m_clipboardDup; ///< list duplicate of the clipboard used for pasting
  86. Int m_copySpacing; ///< keeps multiple pastes from being on top of each other
  87. Int m_numCopiesPasted; ///< keeps multiple pastes from being on top of each other
  88. };
  89. // INLINE /////////////////////////////////////////////////////////////////////////////////////////
  90. inline GameWindow *GUIEditWindowManager::getClipboardList( void ) { return m_clipboard; }
  91. inline GameWindow *GUIEditWindowManager::getClipboardDupeList( void ) { return m_clipboardDup; }
  92. // EXTERN /////////////////////////////////////////////////////////////////////////////////////////
  93. extern GUIEditWindowManager *TheGUIEditWindowManager; ///< editor use only
  94. #endif // __GUIEDITWINDOWMANAGER_H_