LinkBrush.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef LINKBRUSH_H
  2. #define LINKBRUSH_H
  3. /*************************************************************************************************\
  4. LinkBrush.h : Interface for the LinkBrush component.
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. \*************************************************************************************************/
  9. #ifndef BRUSH_H
  10. #include "Brush.h"
  11. #endif
  12. #ifndef ACTION_H
  13. #include "Action.h"
  14. #endif
  15. #ifndef BUILDINGLINK_H
  16. #include "BuildingLink.h"
  17. #endif
  18. #include "mclib.h"
  19. class EditorObject;
  20. //*************************************************************************************************
  21. /**************************************************************************************************
  22. CLASS DESCRIPTION
  23. LinkBrush:
  24. **************************************************************************************************/
  25. class LinkBrush: public Brush
  26. {
  27. public:
  28. LinkBrush( bool bLink );
  29. virtual ~LinkBrush();
  30. virtual bool beginPaint();
  31. virtual Action* endPaint();
  32. virtual bool paint( Stuff::Vector3D& worldPos, int screenX, int screenY );
  33. virtual bool canPaint( Stuff::Vector3D& worldPos, int screenX, int screenY, int flags );
  34. virtual bool canPaintSelection( ){ return false; }
  35. virtual void render( int screenX, int screenY );
  36. const EditorObject* parent;
  37. Stuff::Vector3D parentPos;
  38. bool bLink;
  39. bool unPaint( Stuff::Vector3D& worldPos, int screenX, int screenY );
  40. bool canUnPaint( Stuff::Vector3D& worldPos, int screenX, int screenY, int flags );
  41. struct LinkInfo
  42. {
  43. enum TYPE
  44. {
  45. ADD = 0,
  46. REMOVE,
  47. EDIT
  48. };
  49. LinkInfo( BuildingLink* m_pOriginal, TYPE type = EDIT );
  50. BuildingLink m_LinkCopy; // copy of link
  51. int type;
  52. };
  53. class LinkAction : public Action
  54. {
  55. public:
  56. LinkAction();
  57. ~LinkAction( ){}
  58. virtual bool redo();
  59. virtual bool undo();
  60. EList< LinkInfo, const LinkInfo& > changedLinks;
  61. AddToListOnce( const LinkAction::LinkInfo& info );
  62. };
  63. LinkAction* pAction;
  64. };
  65. //*************************************************************************************************
  66. #endif // end of file ( LinkBrush.h )