Stellarium 0.15.2
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 signals:
54  // should be connected to the StelDialog in createDialogContents()
55  void movedTo(QPoint newPosition);
56 protected:
57  bool moving;
58 };
59 
60 class ResizeFrame : public QFrame
61 {
62 Q_OBJECT
63 public:
64  QPoint mousePos;
65 
66  ResizeFrame(QWidget* parent) : QFrame(parent) {}
67 
68  virtual void mousePressEvent(QMouseEvent *event) {
69  mousePos = event->pos();
70  }
71  virtual void mouseMoveEvent(QMouseEvent *event);
72 };
73 
74 
75 #endif // _DIALOG_HPP_
A title bar control used in windows derived from StelDialog.
Definition: Dialog.hpp:42