• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.14
  • kdeedu
  • kig
  • objects
object_type.h
Go to the documentation of this file.
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_TYPE_H
19 #define KIG_OBJECTS_OBJECT_TYPE_H
20 
21 #include "common.h"
22 #include "../misc/argsparser.h"
23 
24 class ObjectTypeCalcer;
25 
32 class ObjectType
33 {
34  const char* mfulltypename;
35 protected:
36  ObjectType( const char fulltypename[] );
37 public:
38  virtual ~ObjectType();
39 
40  enum {
41  ID_ConstrainedPointType,
42  ID_LocusType,
43  ID_FixedPointType
44  };
45 
46  virtual bool inherits( int type ) const;
47 
48  virtual ObjectImp* calc( const Args& parents, const KigDocument& d ) const = 0;
49 
50  virtual bool canMove( const ObjectTypeCalcer& ourobj ) const;
51  virtual bool isFreelyTranslatable( const ObjectTypeCalcer& ourobj ) const;
52  virtual std::vector<ObjectCalcer*> movableParents( const ObjectTypeCalcer& ourobj ) const;
53  virtual const Coordinate moveReferencePoint( const ObjectTypeCalcer& ourobj ) const;
54  virtual void move( ObjectTypeCalcer& ourobj, const Coordinate& to,
55  const KigDocument& d ) const;
56 
57  const char* fullName() const;
58 
64  virtual const ObjectImpType* impRequirement( const ObjectImp* o, const Args& parents ) const = 0;
65 
72  virtual bool isDefinedOnOrThrough( const ObjectImp* o, const Args& parents ) const = 0;
73 
80  virtual const ObjectImpType* resultId() const = 0;
81 
82  virtual std::vector<ObjectCalcer*> sortArgs( const std::vector<ObjectCalcer*>& args ) const = 0;
83 
84  virtual Args sortArgs( const Args& args ) const = 0;
85 
91  virtual bool isTransform() const;
92 
93  // ObjectType's can define some special actions, that are strictly
94  // specific to the type at hand. E.g. a text label allows to toggle
95  // the display of a frame around the text. Constrained and fixed
96  // points can be redefined etc.
97 
101  virtual QStringList specialActions() const;
105  virtual void executeAction( int i, ObjectHolder& o, ObjectTypeCalcer& t,
106  KigPart& d, KigWidget& w, NormalMode& m ) const;
107 };
108 
113 class ArgsParserObjectType
114  : public ObjectType
115 {
116 protected:
117  const ArgsParser margsparser;
118  ArgsParserObjectType( const char fulltypename[],
119  const struct ArgsParser::spec argsspec[],
120  int n );
121 public:
122  const ObjectImpType* impRequirement( const ObjectImp* o, const Args& parents ) const;
123  bool isDefinedOnOrThrough( const ObjectImp* o, const Args& parents ) const;
124  const ArgsParser& argsParser() const;
125 
126  std::vector<ObjectCalcer*> sortArgs( const std::vector<ObjectCalcer*>& args ) const;
127  Args sortArgs( const Args& args ) const;
128 };
129 
130 #endif
ObjectImpType
Instances of this class represent a certain ObjectImp type.
Definition: object_imp.h:95
ObjectType::specialActions
virtual QStringList specialActions() const
return i18n'd names for the special actions.
Definition: object_type.cc:91
ArgsParserObjectType
This is a convenience subclass of ObjectType that a type should inherit from if its parents can be sp...
Definition: object_type.h:113
ObjectType::inherits
virtual bool inherits(int type) const
Definition: object_type.cc:64
ObjectType::isDefinedOnOrThrough
virtual bool isDefinedOnOrThrough(const ObjectImp *o, const Args &parents) const =0
Supposing that parents would be given as parents to this type's calc function, this function returns ...
ObjectType::sortArgs
virtual std::vector< ObjectCalcer * > sortArgs(const std::vector< ObjectCalcer * > &args) const =0
ObjectTypeCalcer
This is an ObjectCalcer that uses one of the various ObjectType's to calculate its ObjectImp...
Definition: object_calcer.h:183
ObjectType::calc
virtual ObjectImp * calc(const Args &parents, const KigDocument &d) const =0
ObjectType::movableParents
virtual std::vector< ObjectCalcer * > movableParents(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:118
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
ObjectType::ObjectType
ObjectType(const char fulltypename[])
Definition: object_type.cc:40
ArgsParserObjectType::ArgsParserObjectType
ArgsParserObjectType(const char fulltypename[], const struct ArgsParser::spec argsspec[], int n)
Definition: object_type.cc:69
ArgsParserObjectType::margsparser
const ArgsParser margsparser
Definition: object_type.h:117
ObjectType::isTransform
virtual bool isTransform() const
is this object type a transformation type.
Definition: object_type.cc:86
common.h
ObjectHolder
An ObjectHolder represents an object as it is known to the document.
Definition: object_holder.h:40
Args
std::vector< const ObjectImp * > Args
Definition: objects/common.h:47
ObjectType::executeAction
virtual void executeAction(int i, ObjectHolder &o, ObjectTypeCalcer &t, KigPart &d, KigWidget &w, NormalMode &m) const
execute the i 'th action from the specialActions above.
Definition: object_type.cc:96
ObjectType::resultId
virtual const ObjectImpType * resultId() const =0
returns the ObjectImp id of the ObjectImp's produced by this ObjectType.
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
ArgsParserObjectType::argsParser
const ArgsParser & argsParser() const
Definition: object_type.cc:81
QStringList
ArgsParser::spec
Definition: argsparser.h:113
ArgsParser
This class is meant to take care of checking the types of the parents to ObjectCalcer's, and to put them in the correct order.
Definition: argsparser.h:106
ObjectType::canMove
virtual bool canMove(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:46
ObjectType
The ObjectType class is a thing that represents the "behaviour" for a certain type.
Definition: object_type.h:32
ObjectType::ID_LocusType
Definition: object_type.h:42
ObjectType::moveReferencePoint
virtual const Coordinate moveReferencePoint(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:102
ArgsParserObjectType::isDefinedOnOrThrough
bool isDefinedOnOrThrough(const ObjectImp *o, const Args &parents) const
Supposing that parents would be given as parents to this type's calc function, this function returns ...
Definition: object_type.cc:123
ObjectType::ID_ConstrainedPointType
Definition: object_type.h:41
ObjectType::move
virtual void move(ObjectTypeCalcer &ourobj, const Coordinate &to, const KigDocument &d) const
Definition: object_type.cc:56
ObjectType::impRequirement
virtual const ObjectImpType * impRequirement(const ObjectImp *o, const Args &parents) const =0
Supposing that parents would be given as parents to this type's calc function, this function returns ...
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
ObjectType::~ObjectType
virtual ~ObjectType()
Definition: object_type.cc:36
ObjectType::fullName
const char * fullName() const
Definition: object_type.cc:31
ObjectImp
The ObjectImp class represents the behaviour of an object after it is calculated. ...
Definition: object_imp.h:226
KigPart
This is a "Part".
Definition: kig_part.h:68
ArgsParserObjectType::sortArgs
std::vector< ObjectCalcer * > sortArgs(const std::vector< ObjectCalcer * > &args) const
Definition: object_type.cc:108
ArgsParserObjectType::impRequirement
const ObjectImpType * impRequirement(const ObjectImp *o, const Args &parents) const
Supposing that parents would be given as parents to this type's calc function, this function returns ...
Definition: object_type.cc:76
NormalMode
Definition: normal.h:26
ObjectType::ID_FixedPointType
Definition: object_type.h:43
ObjectType::isFreelyTranslatable
virtual bool isFreelyTranslatable(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal