layer.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Flexlay - A Generic 2D Game Editor
  2. // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_FLEXLAY_LAYER_HPP
  17. #define HEADER_FLEXLAY_LAYER_HPP
  18. #include <memory>
  19. #include "meta_data.hpp"
  20. class CL_Rect;
  21. class LayerImpl;
  22. class CL_Pointf;
  23. class CL_GraphicContext;
  24. class GraphicContextState;
  25. /** Each \a EditorMap consists out of one or more \a Layer,
  26. The \a Layer is an abstract base class from which the
  27. data holding layers derive. The basic functionality of a layer
  28. consists only of data holding and visualization. (FIXME: move
  29. visuals off into another class) */
  30. class Layer
  31. {
  32. private:
  33. public:
  34. Layer();
  35. Layer(std::shared_ptr<LayerImpl> i);
  36. ~Layer();
  37. MetaData get_metadata() const;
  38. /** Attaches a piece of MetaData to the layer, metadata is some user
  39. supplied piece of data that is associated with a layer (ie. the
  40. name of the layer or similar properties which aren't handled by
  41. the layer itself) */
  42. void set_metadata(MetaData data_);
  43. void draw(const GraphicContextState& state, CL_GraphicContext* gc);
  44. bool has_bounding_rect() const;
  45. CL_Rect get_bounding_rect();
  46. /** Moves the layer to the given position */
  47. void set_pos(const CL_Pointf& pos);
  48. /** Returns the current position of the layer */
  49. CL_Pointf get_pos() const;
  50. bool is_null() const;
  51. public:
  52. std::shared_ptr<LayerImpl> impl;
  53. };
  54. #endif
  55. /* EOF */