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

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 BOXITEM_H
0014 #define BOXITEM_H
0015 
0016 #include "viewitem.h"
0017 #include "graphicsfactory.h"
0018 
0019 namespace Kst {
0020 
0021 class BoxItem : public ViewItem
0022 {
0023   Q_OBJECT
0024   public:
0025     explicit BoxItem(View *parent);
0026     virtual ~BoxItem();
0027 
0028     const QString defaultsGroupName() const {return BoxItem::staticDefaultsGroupName();}
0029     static QString staticDefaultsGroupName() { return QString("box");}
0030 
0031     // for view item dialogs
0032     virtual bool hasStroke() const {return true;}
0033     virtual bool hasBrush() const {return true;}
0034 
0035     virtual void save(QXmlStreamWriter &xml);
0036     virtual void paint(QPainter *painter);
0037 };
0038 
0039 class CreateBoxCommand : public CreateCommand
0040 {
0041   public:
0042     CreateBoxCommand() : CreateCommand(QObject::tr("Create Box")) {}
0043     CreateBoxCommand(View *view) : CreateCommand(view, QObject::tr("Create Box")) {}
0044     virtual ~CreateBoxCommand() {}
0045     virtual void createItem();
0046 };
0047 
0048 class BoxItemFactory : public GraphicsFactory {
0049   public:
0050     BoxItemFactory();
0051     ~BoxItemFactory();
0052     ViewItem* generateGraphics(QXmlStreamReader& stream, ObjectStore *store, View *view, ViewItem *parent = 0);
0053 };
0054 
0055 }
0056 
0057 #endif
0058 
0059 // vim: ts=2 sw=2 et