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

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2011 Joshua Netterfield                               *
0004  *                   joshua.netterfield@gmail.com                          *
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 #include <QByteArray>
0014 #include <QString>
0015 #include <QSizeF>
0016 #include <QList>
0017 #include "scriptinterface.h"
0018 #include "viewitem.h"
0019 #include "boxitem.h"
0020 #include "circleitem.h"
0021 #include "lineitem.h"
0022 #include "ellipseitem.h"
0023 #include "labelitem.h"
0024 #include "pictureitem.h"
0025 #include "svgitem.h"
0026 #include "legenditem.h"
0027 #include "plotitem.h"
0028 
0029 #ifndef VIEWITEMSCRIPTINTERFACE_H
0030 #define VIEWITEMSCRIPTINTERFACE_H
0031 
0032 typedef QList<QByteArray> QByteArrayList;
0033 
0034 namespace Kst {
0035 
0036 class ViewItem;
0037 
0038 struct LayoutTabSI {
0039     ViewItem* vi;
0040     QString doCommand(QString x);
0041 };
0042 
0043 struct FillTabSI {
0044     ViewItem* item;
0045     QString doCommand(QString x);
0046 };
0047 
0048 struct StrokeTabSI {
0049     ViewItem* item;
0050     QString doCommand(QString x);
0051 };
0052 
0053 struct DimensionTabSI {
0054     ViewItem* item;
0055     QString doCommand(QString x);
0056 };
0057 
0058 class ViewItemSI : public ScriptInterface
0059 {
0060     Q_OBJECT
0061 public:
0062     explicit ViewItemSI(ViewItem* it);
0063     QString doCommand(QString);
0064     bool isValid();
0065     QByteArray endEditUpdate() {if (dim->item) dim->item->update();return ("Finished editing "+dim->item->Name()).toLatin1();}
0066 
0067     static ScriptInterface* newBox();
0068     static ScriptInterface* newButton();
0069     static ScriptInterface* newLineEdit();
0070     static ScriptInterface* newCircle();
0071     static ScriptInterface* newEllipse();
0072     static ScriptInterface* newLine();
0073     static ScriptInterface* newPicture(QByteArray file);
0074     static ScriptInterface* newSvgItem(QByteArray path);
0075   private:
0076     LayoutTabSI* layout;
0077     DimensionTabSI* dim;
0078     FillTabSI* fill;
0079     StrokeTabSI* stroke;
0080 };
0081 
0082 }
0083 
0084 #endif // VIEWITEMSCRIPTINTERFACE_H