20130313
[gdash.git] / src / cave / object / caveobjectcopypaste.hpp
blob3877e53fb4847ebd57f3afd914ce8162f8a8418a
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #ifndef _GD_CAVEOBJECTCOPYPASTE
17 #define _GD_CAVEOBJECTCOPYPASTE
19 #include "config.h"
21 #include "cave/object/caveobject.hpp"
23 /// Copy and paste cave object.
24 /// Copies the rectangle of p1,p2 to the destination.
25 /// This is not really a CaveRectangular, so it does not derive from that. Position p1,p2 here are
26 /// NOT the position of the object, but the source area.
27 class CaveCopyPaste : public CaveObject {
28 private:
29 Coordinate p1, p2; ///< Source area of copy. Order of p1 and p2 (lower left, upper right etc) is not important.
30 Coordinate dest; ///< Upper left coordinates of destination.
31 GdBool mirror; ///< Mirror the copy horizontally.
32 GdBool flip; ///< Mirror the copy vertically.
34 public:
35 CaveCopyPaste(Coordinate _p1, Coordinate _p2, Coordinate _dest);
36 CaveCopyPaste(): CaveObject(GD_COPY_PASTE) {}
37 virtual void draw(CaveRendered &cave) const;
38 virtual CaveCopyPaste *clone() const { return new CaveCopyPaste(*this); };
39 void set_mirror_flip(bool _mirror, bool _flip);
40 virtual std::string get_bdcff() const;
41 virtual CaveCopyPaste* clone_from_bdcff(const std::string &name, std::istream &is) const;
43 private:
44 static PropertyDescription const descriptor[];
46 public:
47 virtual PropertyDescription const* get_description_array() const;
49 virtual void create_drag(Coordinate current, Coordinate displacement);
50 virtual void move(Coordinate current, Coordinate displacement);
51 virtual void move(Coordinate displacement);
52 virtual std::string get_coordinates_text() const;
53 virtual GdElementEnum get_characteristic_element() const { return O_NONE; }
54 virtual std::string get_description_markup() const;
58 #endif