1 // SPDX-FileCopyrightText: 2002 Dominique Devriese <devriese@kde.org>
2 
3 // SPDX-License-Identifier: GPL-2.0-or-later
4 
5 #ifndef KIG_OBJECTS_POINT_IMP_H
6 #define KIG_OBJECTS_POINT_IMP_H
7 
8 #include "object_imp.h"
9 #include "../misc/coordinate.h"
10 
11 /**
12  * An ObjectImp representing a point.
13  */
14 class PointImp
15   : public ObjectImp
16 {
17   Coordinate mc;
18 public:
19   typedef ObjectImp Parent;
20   /**
21    * Returns the ObjectImpType representing PointImp's.
22    */
23   static const ObjectImpType* stype();
24 
25   /**
26    * Construct a PointImp with coordinate c.
27    */
28   explicit PointImp( const Coordinate& c );
29   ~PointImp();
30 
31   Rect surroundingRect() const override;
32   Coordinate attachPoint() const override;
33 
34   /**
35    * Get the coordinate of this PointImp.
36    */
coordinate()37   const Coordinate& coordinate() const { return mc; }
38   /**
39    * Set the coordinate of this PointImp.
40    */
41   void setCoordinate( const Coordinate& c );
42 
43   void draw( KigPainter& p ) const override;
44   bool contains( const Coordinate& p, int width, const KigWidget& ) const override;
45   bool inRect( const Rect& r, int width, const KigWidget& ) const override;
46 
47   int numberOfProperties() const override;
48   const QByteArrayList properties() const override;
49   const QByteArrayList propertiesInternalNames() const override;
50   ObjectImp* property( int which, const KigDocument& d ) const override;
51   const char* iconForProperty( int which ) const override;
52   const ObjectImpType* impRequirementForProperty( int which ) const override;
53   bool isPropertyDefinedOnOrThroughThisImp( int which ) const override;
54 
55   ObjectImp* transform( const Transformation& ) const override;
56 
57   PointImp* copy() const override;
58 
59   const ObjectImpType* type() const override;
60   void visit( ObjectImpVisitor* vtor ) const override;
61 
62   void fillInNextEscape( QString& s, const KigDocument& ) const override;
63   bool canFillInNextEscape() const override;
64 
65   bool equals( const ObjectImp& rhs ) const override;
66 };
67 
68 class BogusPointImp
69   : public PointImp
70 {
71 public:
72   explicit BogusPointImp( const Coordinate& c );
73   ~BogusPointImp();
74   static const ObjectImpType* stype();
75   const ObjectImpType* type() const override;
76 };
77 
78 #endif
79