Commit 7c3208c8 authored by Thomas Zander's avatar Thomas Zander

Add api docs

svn path=/trunk/koffice/; revision=634089
parent d0db0139
......@@ -72,6 +72,10 @@ void KoCanvasResourceProvider::setResource( int key, const KoID & id )
KoColor KoCanvasResourceProvider::koColorResource( int key )
{
if(! d->resources.contains(key)) {
KoColor empty;
return empty;
}
return resource( key ).value<KoColor>();
}
......@@ -138,4 +142,13 @@ bool KoCanvasResourceProvider::doubleResource(int key) const {
return d->resources[key].toDouble();
}
QString KoCanvasResourceProvider::stringResource(int key)
{
if(! d->resources.contains(key)) {
QString empty;
return empty;
}
return qvariant_cast<QString>(resource(key));
}
#include "KoCanvasResourceProvider.moc"
......@@ -80,7 +80,17 @@ public:
* @param value the new value for the key.
*/
void setResource( int key, const QVariant & value );
/**
* Set a resource of type KoColor.
* @param key the integer key, based on KoCanvasResource::EnumCanvasResource
* @param value the new value for the key.
*/
void setResource( int key, const KoColor & color );
/**
* Set a resource of type KoId.
* @param key the integer key, based on KoCanvasResource::EnumCanvasResource
* @param value the new value for the key.
*/
void setResource( int key, const KoID & id );
/**
......@@ -149,6 +159,12 @@ public:
*/
KoID koIDResource(int key);
/**
* Return the resource determined by param key as a QString .
* @param key the indentifying key for the resource.
*/
QString stringResource(int key);
signals:
/**
* This signal is emitted every time a resource is set that is either
......
......@@ -34,6 +34,10 @@ class KoPathPoint;
class KoCreatePathTool : public KoTool
{
public:
/**
* Constructor for the tool that allows you to create new paths by hand.
* @param canvas the canvas this tool will be working for.
*/
explicit KoCreatePathTool( KoCanvasBase * canvas );
virtual ~KoCreatePathTool();
......@@ -48,7 +52,7 @@ public slots:
void activate( bool temporary = false );
void resourceChanged( int key, const QVariant & res );
protected:
private:
/// add path shape to document
void addPathShape();
QRectF handleRect( const QPointF &p );
......
......@@ -134,7 +134,10 @@ protected:
*/
virtual void updatePath( const QSizeF &size ) = 0;
/// the handles that the user can grab and change
QList<QPointF> m_handles;
private:
bool m_modified;
};
......
......@@ -24,6 +24,7 @@
#include <QStringList>
/// Factory for the KoPathTool
class FLAKE_EXPORT KoPathToolFactory : public KoToolFactory {
Q_OBJECT
public:
......
......@@ -106,8 +106,9 @@ public:
* The default implementation is empty.
*
* @param painter used for painting the shape
* @param selected true if the shape is currently selected
* @param converter to convert between internal and view coordinates.
* @param canvas the canvas that requested this paint. This can be used to retrieve canvas specific properties
* like selection and get a reference to the KoCanvasResourceProvider.
*/
virtual void paintDecorations(QPainter &painter, const KoViewConverter &converter, const KoCanvasBase *canvas);
......@@ -541,9 +542,20 @@ protected:
*/
virtual void shapeChanged(ChangeType type) { Q_UNUSED(type); }
/**
* Set the property collision detection.
* Setting this to true will result in calls to shapeChanged() with the CollisionDetected
* parameter whenever either this or another shape is moved/rotated etc and intersects this shape.
* @param detect if true detect collisions.
*/
void setCollisionDetection(bool detect);
/**
* get the property collision detection.
* @returns true if collision detection is on.
*/
bool collisionDetection();
/// return the current matrix that contains the rotation/scale/position of this shape
const QMatrix& matrix() const;
private:
......
......@@ -56,6 +56,7 @@ public:
* @brief Add a shape to the document.
*
* @param shape to add to the document
* @parent parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shape into the document or 0 if the
* insertion was canceled. The command is not yet executed.
......@@ -66,6 +67,7 @@ public:
* @brief Remove a shape from the document.
*
* @param shape to remove from the document
* @parent parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
......@@ -76,6 +78,7 @@ public:
* Remove a shape from the document.
*
* @param shapes the set of shapes to remove from the document
* @parent parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
......
......@@ -164,7 +164,17 @@ public:
*/
virtual void wheelEvent ( KoPointerEvent * event );
/**
* Set the identifier code from the KoToolFactory that created this tool.
* @param id the indentifier code
* @see KoToolFactory::toolId()
*/
void setToolId(const QString &id);
/**
* get the identifier code from the KoToolFactory that created this tool.
* @return the toolId.
* @see KoToolFactory::toolId()
*/
QString toolId() const;
public slots:
......
......@@ -100,6 +100,7 @@ public:
static KoToolManager* instance();
~KoToolManager();
// TODO let creating a toolProxy implicitly register
KoToolProxy *createToolProxy(KoCanvasBase *parentCanvas);
/**
......@@ -148,13 +149,20 @@ public:
*/
QString preferredToolForSelection(const QList<KoShape*> &shapes);
/// Struct for the createToolList return type.
struct Button {
QAbstractButton *button;
QString section;
int priority;
int buttonGroupId;
QString visibilityCode;
QAbstractButton *button;///< a newly created button.
QString section; ///< The section the button wants to be in.
int priority; ///< Higher priority means coming first in the section.
int buttonGroupId; ///< An unique ID for this button as passed by changedTool()
QString visibilityCode; ///< This button should become visible when we emit this string in toolCodesSelected()
};
/**
* Create a list of buttons to represent all the tools.
* @returns a list of Buttons.
* This is a factory method for buttons and meta information on the button to better display the button.
*/
QList<Button> createToolList() const;
public slots:
......
......@@ -70,16 +70,15 @@ namespace {
class KoToolProxy::Private {
public:
Private() : canvas(0), activeTool(0) {}
Private() : activeTool(0) {}
KoCanvasBase *canvas;
KoTool *activeTool;
};
KoToolProxy::KoToolProxy(KoCanvasBase *canvas)
: d(new Private())
{
d->canvas = canvas;
// TODO register myself with the ToolManager
}
KoToolProxy::~KoToolProxy() {
......
......@@ -47,23 +47,34 @@ class KoCanvasBase;
class FLAKE_EXPORT KoToolProxy {
public:
/**
* Constructor
* @param canvas Each canvas has 1 toolProxy. Pass the parent here.
*/
explicit KoToolProxy(KoCanvasBase *canvas);
~KoToolProxy();
/**
* Call this when the tools in the current tool stack need to
* repaint their decorations
*/
/// Forwarded to the current KoTool
void paint( QPainter &painter, KoViewConverter &converter );
/// Forwarded to the current KoTool
void repaintDecorations();
/// Forwarded to the current KoTool
void tabletEvent( QTabletEvent *event, const QPointF &point );
/// Forwarded to the current KoTool
void mousePressEvent( QMouseEvent *event, const QPointF &point );
/// Forwarded to the current KoTool
void mouseDoubleClickEvent( QMouseEvent *event, const QPointF &point );
/// Forwarded to the current KoTool
void mouseMoveEvent( QMouseEvent *event, const QPointF &point );
/// Forwarded to the current KoTool
void mouseReleaseEvent( QMouseEvent *event, const QPointF &point );
/// Forwarded to the current KoTool
void keyPressEvent(QKeyEvent *event);
/// Forwarded to the current KoTool
void keyReleaseEvent(QKeyEvent *event);
/// Forwarded to the current KoTool
void wheelEvent ( QWheelEvent * event, const QPointF &point );
/// Set the new active tool.
void setActiveTool(KoTool *tool);
/**
......
......@@ -31,6 +31,14 @@ class KoParameterShape;
class KoParameterHandleMoveCommand : public QUndoCommand
{
public:
/**
* Constructor.
* @param shape the shape this command works on
* @param handleId the ID under which the parameterShape knows the handle in KoParameterShape::moveHandle()
* @param startPoint The old position
* @param endPoint The new position
* @parent parent the parent command if this is a compound undo command.
*/
KoParameterHandleMoveCommand( KoParameterShape *shape, int handleId, const QPointF &startPoint, const QPointF &endPoint, QUndoCommand *parent = 0 );
virtual ~KoParameterHandleMoveCommand();
......
......@@ -31,7 +31,17 @@ class KoParameterShape;
class KoParameterToPathCommand : public QUndoCommand
{
public:
/**
* Constructor.
* @param shape the shape this command works on
* @parent parent the parent command if this is a compound undo command.
*/
KoParameterToPathCommand( KoParameterShape *shape, QUndoCommand *parent = 0 );
/**
* Constructor.
* @param shapes the list of shapes this command works on
* @parent parent the parent command if this is a compound undo command.
*/
KoParameterToPathCommand( const QList<KoParameterShape*> &shapes, QUndoCommand *parent = 0 );
virtual ~KoParameterToPathCommand();
......
......@@ -46,6 +46,7 @@ public:
* Command to group a set of shapes into a predefined container.
* Convenience constructor since KoShapeGroup does not allow clipping.
* @param container the group to group the shapes under.
* @parent parent the parent command if the resulting command is a compound undo command.
* @param shapes a list of all the shapes that should be grouped.
*/
KoShapeGroupCommand(KoShapeGroup *container, QList<KoShape *> shapes, QUndoCommand *parent = 0);
......
......@@ -30,6 +30,12 @@
class FLAKE_TEST_EXPORT KoSubpathRemoveCommand : public QUndoCommand
{
public:
/**
* Create a new command to remove a subpath.
* @param pathShape the shape to work on.
* @param subpathIndex the index. See KoPathShape::removeSubpath()
* @parent parent the parent command if the resulting command is a compound undo command.
*/
KoSubpathRemoveCommand( KoPathShape *pathShape, int subpathIndex, QUndoCommand *parent = 0 );
~KoSubpathRemoveCommand();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment