object_imp.h Source File (Kig Python Scripting API)

| # Kig Python Scripting API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members

object_imp.h
1// Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
2
3// This program is free software; you can redistribute it and/or
4// modify it under the terms of the GNU General Public License
5// as published by the Free Software Foundation; either version 2
6// of the License, or (at your option) any later version.
7
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16// 02110-1301, USA.
17
18#ifndef KIG_OBJECTS_OBJECT_IMP_H
19#define KIG_OBJECTS_OBJECT_IMP_H
20
21#include "common.h"
22
23class IntImp;
24class DoubleImp;
25class StringImp;
26class InvalidImp;
27class HierarchyImp;
28class TransformationImp;
29class TestResultImp;
30class CurveImp;
31class LineImp;
32class PointImp;
33class TextImp;
34class AngleImp;
35class VectorImp;
36class LocusImp;
37class CircleImp;
38class ConicImp;
39class CubicImp;
40class SegmentImp;
41class RayImp;
42class ArcImp;
43class PolygonImp;
44
53class ObjectImpVisitor
54{
55public:
56 virtual ~ObjectImpVisitor();
57 void visit( const ObjectImp* imp );
58 virtual void visit( const IntImp* imp );
59 virtual void visit( const DoubleImp* imp );
60 virtual void visit( const StringImp* imp );
61 virtual void visit( const InvalidImp* imp );
62 virtual void visit( const HierarchyImp* imp );
63 virtual void visit( const TransformationImp* imp );
64 virtual void visit( const TestResultImp* imp );
65 virtual void visit( const LineImp* imp );
66 virtual void visit( const PointImp* imp );
67 virtual void visit( const TextImp* imp );
68 virtual void visit( const AngleImp* imp );
69 virtual void visit( const VectorImp* imp );
70 virtual void visit( const LocusImp* imp );
71 virtual void visit( const CircleImp* imp );
72 virtual void visit( const ConicImp* imp );
73 virtual void visit( const CubicImp* imp );
74 virtual void visit( const SegmentImp* imp );
75 virtual void visit( const RayImp* imp );
76 virtual void visit( const ArcImp* imp );
77 virtual void visit( const PolygonImp* imp );
78};
79
80typedef unsigned int uint;
81
88 class ObjectImpType
89{
90 const ObjectImpType* mparent;
91 const char* minternalname;
92 const char* mtranslatedname;
93 const char* mselectstatement;
94 const char* mselectnamestatement;
95 const char* mremoveastatement;
96 const char* maddastatement;
97 const char* mmoveastatement;
98 const char* mattachtothisstatement;
99 const char* mshowastatement;
100 const char* mhideastatement;
101 class StaticPrivate;
102 static StaticPrivate* sd();
103public:
111 static const ObjectImpType* typeFromInternalName( const char* n );
112
133 ObjectImpType(
134 const ObjectImpType* parent, const char* internalname,
135 const char* translatedname,
136 const char* selectstatement,
137 const char* selectnamestatement,
138 const char* removeastatement,
139 const char* addastatement,
140 const char* moveastatement,
141 const char* attachtothisstatement,
142 const char* showastatement,
143 const char* hideastatement );
144 ~ObjectImpType();
145
150 bool inherits( const ObjectImpType* t ) const;
151
157 const char* internalName() const;
161 TQString translatedName() const;
167 const char* selectStatement() const;
168
175 const char* selectNameStatement() const;
176
181 TQString removeAStatement() const;
186 TQString addAStatement() const;
191 TQString moveAStatement() const;
197 TQString attachToThisStatement() const;
198
203 TQString showAStatement() const;
204
209 TQString hideAStatement() const;
210};
211
218 class ObjectImp
219{
220protected:
221 ObjectImp();
222public:
227 static const ObjectImpType* stype();
228
229 virtual ~ObjectImp();
230
245 bool inherits( const ObjectImpType* t ) const;
246
263 virtual Coordinate attachPoint( ) const = 0;
264
268 virtual ObjectImp* transform( const Transformation& t ) const = 0;
269
270 virtual void draw( KigPainter& p ) const = 0;
271 virtual bool contains( const Coordinate& p, int width,
272 const KigWidget& si ) const = 0;
273 virtual bool inRect( const Rect& r, int width,
274 const KigWidget& si ) const = 0;
275 virtual Rect surroundingRect() const = 0;
276
282 bool valid() const;
283
284 virtual const uint numberOfProperties() const;
285 // the names of the properties as perceived by the user.. put
286 // I18N_NOOP's around them here..
287 virtual const QCStringList properties() const;
288 // the names of the properties as known only by kig internally. No
289 // need for I18N_NOOP. Preferably choose some lowercase name with
290 // only letters and dashes, no spaces..
291 virtual const QCStringList propertiesInternalNames() const;
292 virtual ObjectImp* property( uint which, const KigDocument& d ) const;
293 // Sometimes we need to know which type an imp needs to be at least
294 // in order to have the imp with number which. Macro's need it
295 // foremost. This function answers that question..
296 virtual const ObjectImpType* impRequirementForProperty( uint which ) const;
297 // Return whether the property with number which is by construction
298 // always a point on this curve ( if this is a curve ), or always a
299 // curve through this point ( if this is a curve ).
300 virtual bool isPropertyDefinedOnOrThroughThisImp( uint which ) const;
301 // What icon should be shown when talking about this property ?
302 virtual const char* iconForProperty( uint which ) const;
303
319 virtual const ObjectImpType* type() const = 0;
320 virtual void visit( ObjectImpVisitor* vtor ) const = 0;
321
327 virtual ObjectImp* copy() const = 0;
328
329 // s is a string with at least one escape ( "%N" where N is a
330 // number ) somewhere. This function replaces the first escape it
331 // sees with the "value" of this imp ( using the TQString::arg
332 // functions ). This is e.g. used by TextType to turn its variable
333 // args into strings..
334 // if you implement this, then you should return true in
335 // canFillInEscape() ( standard implementation returns false ), and
336 // override fillInNextEscape() ( standard implementation does an
337 // assert( false ) )..
338 virtual bool canFillInNextEscape() const;
339 virtual void fillInNextEscape( TQString& s, const KigDocument& ) const;
340
348 virtual bool equals( const ObjectImp& rhs ) const = 0;
349
358 virtual bool isCache() const;
359};
360#endif
Angle
An Object representing an angle.
Definition other_imp.h:30
Arc
An Object representing an arc.
Definition other_imp.h:165
Circle
An Object representing a circle.
Definition circle_imp.h:29
Conic
An Object representing a conic.
Definition conic_imp.h:40
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components.
Definition coordinate.h:34
Cubic
An Object representing a cubic.
Definition cubic_imp.h:32
Curve
This class represents a curve: something which is composed of points, like a line,...
Definition curve_imp.h:29
DoubleObject
This Object is a BogusObject containing only a double value.
Definition bogus_imp.h:91
IntObject
This Object is a BogusObject containing only an int value.
Definition bogus_imp.h:130
InvalidObject
This Object represents an invalid object.
Definition bogus_imp.h:63
Line
An Object representing a line.
Definition line_imp.h:179
ObjectType
Instances of this class represent a certain Object type.
Definition object_imp.h:89
ObjectType::showAStatement
TQString showAStatement() const
Returns a translated string of the form "Show a xxx".
ObjectType::selectNameStatement
const char * selectNameStatement() const
Returns a translatable string of the form "Select point %1".
ObjectType::internalName
const char * internalName() const
Returns an internal name for this Object type.
ObjectType::typeFromInternalName
static const ObjectType * typeFromInternalName(const char *n)
Returns the type with name n.
ObjectType::translatedName
TQString translatedName() const
The name of this type, translated to the currently used language.
ObjectType::addAStatement
TQString addAStatement() const
Returns a translated string of the form "Add a xxx".
ObjectType::inherits
bool inherits(const ObjectType *t) const
Does the Object type represented by this instance inherit the Object type represented by t ?
ObjectType::hideAStatement
TQString hideAStatement() const
Returns a translated string of the form "Hide a xxx".
ObjectType::selectStatement
const char * selectStatement() const
Returns a translatable string of the form "Select this %1".
ObjectType::moveAStatement
TQString moveAStatement() const
Returns a translated string of the form "Move a xxx".
ObjectType::attachToThisStatement
TQString attachToThisStatement() const
Returns a translated string of the form "Attach to this xxx".
ObjectType::removeAStatement
TQString removeAStatement() const
Returns a translated string of the form "Remove a xxx".
Object::valid
bool valid() const
Returns true if this is a valid Object.
Object::inherits
bool inherits(const ObjectType *t) const
Returns true if this Object inherits the Object type represented by t.
Object::stype
static const ObjectType * stype()
The ObjectType representing the base Object class.
Object::copy
virtual Object * copy() const =0
Returns a copy of this Object.
Object::attachPoint
virtual Coordinate attachPoint() const =0
Returns a reference point where to attach labels; when this returns an invalidCoord then the attachme...
Object::equals
virtual bool equals(const Object &rhs) const =0
Returns true if this Object is equal to rhs.
Object::type
virtual const ObjectType * type() const =0
Returns the lowermost ObjectType that this object is an instantiation of.
Object::transform
virtual Object * transform(const Transformation &t) const =0
Return this Object, transformed by the transformation t.
Point
An Object representing a point.
Definition point_imp.h:29
Ray
An Object representing a ray.
Definition line_imp.h:138
Segment
An Object representing a segment.
Definition line_imp.h:83
StringObject
This Object is a BogusObject containing only a string value.
Definition bogus_imp.h:169
Transformation
Class representing a transformation.
Definition kigtransform.h:38
Vector
An Object representing a vector.
Definition other_imp.h:95
This file is part of the documentation for tdelibs .
Documentation copyright © 1996-2002 the KDE developers.
Generated on by doxygen 1.16.1 written by Dimitri van Heesch, © 1997-2001