KTutorial  0.5.1
StepWidget.h
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00003  *   Copyright (C) 2009 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00004  *   Copyright (C) 2010 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00005  *   Copyright (C) 2012 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; If not, see <http://www.gnu.org/licenses/>.  *
00019  ***************************************************************************/
00020 
00021 #ifndef KTUTORIAL_VIEW_STEPWIDGET_H
00022 #define KTUTORIAL_VIEW_STEPWIDGET_H
00023 
00024 #include <QFrame>
00025 #include <QList>
00026 
00027 class QCloseEvent;
00028 class QHBoxLayout;
00029 class QKeyEvent;
00030 class QMouseEvent;
00031 class QPaintEvent;
00032 
00033 namespace ktutorial {
00034 class Option;
00035 class Step;
00036 }
00037 
00038 namespace Ui {
00039 class StepWidget;
00040 }
00041 
00042 namespace ktutorial {
00043 namespace view {
00044 
00060 class StepWidget: public QFrame {
00061 Q_OBJECT
00062 public:
00063 
00070     explicit StepWidget(const QString& tutorialName, QWidget* parent = 0);
00071 
00075     virtual ~StepWidget();
00076 
00085     void setMainApplicationWindow(QWidget* mainApplicationWindow);
00086 
00087 public slots:
00088 
00097     void setStep(Step* step);
00098 
00099 signals:
00100 
00104     void finished();
00105 
00106 protected:
00107 
00120     virtual void closeEvent(QCloseEvent* event);
00121 
00129     virtual void keyPressEvent(QKeyEvent* event);
00130 
00137     virtual void mouseMoveEvent(QMouseEvent* event);
00138 
00146     virtual void mousePressEvent(QMouseEvent* event);
00147 
00154     virtual void mouseReleaseEvent(QMouseEvent* event);
00155 
00174     virtual void paintEvent(QPaintEvent* event);
00175 
00176 private:
00177 
00181     bool mDragging;
00182 
00186     QPoint mDragOffset;
00187 
00191     Ui::StepWidget* ui;
00192 
00196     QHBoxLayout* mOptionsLayout;
00197 
00206     void setOptions(const QList<Option*>& options);
00207 
00208 };
00209 
00210 }
00211 }
00212 
00213 #endif