00001 /*************************************************************************** 00002 File : AddWidgetTool.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2008 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : Tool for adding enrichements to a plot. 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef ADD_WIDGET_TOOL_H 00030 #define ADD_WIDGET_TOOL_H 00031 00032 #include "PlotToolInterface.h" 00033 #include <QObject> 00034 00035 class QAction; 00036 class QPoint; 00037 class RectangleWidget; 00038 00043 class AddWidgetTool : public QObject, public PlotToolInterface 00044 { 00045 Q_OBJECT 00046 public: 00047 enum WidgetType{ 00048 Text = 0, 00049 TexEquation, 00050 Rectangle, 00051 UserWidget = 1000 00052 }; 00053 00054 AddWidgetTool(WidgetType type, Graph *graph, QAction *d_action, const QObject *status_target = NULL, const char *status_slot = ""); 00055 virtual ~AddWidgetTool(); 00056 00057 virtual int rtti() const {return PlotToolInterface::Rtti_AddWidgetTool;}; 00058 00059 signals: 00064 void statusText(const QString&); 00065 00066 protected: 00067 void addRectangle(const QPoint& point); 00068 void addEquation(const QPoint& point); 00069 void addText(const QPoint& point); 00070 void addWidget(const QPoint& point); 00071 00072 virtual bool eventFilter(QObject *obj, QEvent *event); 00073 QAction *d_action; 00074 WidgetType d_widget_type; 00075 RectangleWidget *d_rect; 00076 }; 00077 00078 #endif // ifndef ADD_WIDGET_TOOL_H