File indexing completed on 2024-12-22 04:17:26

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef CIRCLEITEM_H
0014 #define CIRCLEITEM_H
0015 
0016 #include "viewitem.h"
0017 #include "graphicsfactory.h"
0018 
0019 namespace Kst {
0020 
0021 class CircleItemDialog;
0022 
0023 class CircleItem : public ViewItem
0024 {
0025   Q_OBJECT
0026   public:
0027     explicit CircleItem(View *parent);
0028     virtual ~CircleItem();
0029 
0030     const QString defaultsGroupName() const {return CircleItem::staticDefaultsGroupName();}
0031     static QString staticDefaultsGroupName() { return QString("circle");}
0032 
0033     // for view item dialogs
0034     virtual bool hasStroke() const {return true;}
0035     virtual bool hasBrush() const {return true;}
0036 
0037     virtual void save(QXmlStreamWriter &xml);
0038     virtual void paint(QPainter *painter);
0039     virtual void creationPolygonChanged(View::CreationEvent event);
0040     virtual bool customDimensionsTab() {return true;}
0041     virtual void clearEditDialogPtr() {_circleEditDialog = 0;}
0042   public Q_SLOTS:
0043     virtual void edit();
0044 
0045   private:
0046     CircleItemDialog *_circleEditDialog;
0047 
0048 };
0049 
0050 class CreateCircleCommand : public CreateCommand
0051 {
0052   public:
0053     CreateCircleCommand() : CreateCommand(QObject::tr("Create Circle")) {}
0054     CreateCircleCommand(View *view) : CreateCommand(view, QObject::tr("Create Circle")) {}
0055     virtual ~CreateCircleCommand() {}
0056     virtual void createItem();
0057 };
0058 
0059 class CircleItemFactory : public GraphicsFactory {
0060   public:
0061     CircleItemFactory();
0062     ~CircleItemFactory();
0063     ViewItem* generateGraphics(QXmlStreamReader& stream, ObjectStore *store, View *view, ViewItem *parent = 0);
0064 };
0065 
0066 }
0067 
0068 #endif
0069 
0070 // vim: ts=2 sw=2 et