Stellarium 0.12.1
Dialog.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2008 Guillaume Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 
21 #ifndef _DIALOG_HPP_
22 #define _DIALOG_HPP_
23 
24 #include <QWidget>
25 #include <QFrame>
26 #include <QMouseEvent>
27 
42 class BarFrame : public QFrame
43 {
44 Q_OBJECT
45 public:
46  QPoint mousePos;
47 
48  BarFrame(QWidget* parent) : QFrame(parent), moving(false) {}
49 
50  virtual void mousePressEvent(QMouseEvent *event);
51  virtual void mouseReleaseEvent(QMouseEvent *event);
52  virtual void mouseMoveEvent(QMouseEvent *event);
53 protected:
54  bool moving;
55 };
56 
57 class ResizeFrame : public QFrame
58 {
59 Q_OBJECT
60 public:
61  QPoint mousePos;
62 
63  ResizeFrame(QWidget* parent) : QFrame(parent) {}
64 
65  virtual void mousePressEvent(QMouseEvent *event) {
66  mousePos = event->pos();
67  }
68  virtual void mouseMoveEvent(QMouseEvent *event);
69 };
70 
71 
72 #endif // _DIALOG_HPP_