anatomist 6.0.4
3D neuroimaging data viewer
qwinblock.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34#ifndef ANATOMIST_WINDOW_QWINBLOCK_H
35#define ANATOMIST_WINDOW_QWINBLOCK_H
36
38#include <qmainwindow.h>
39
40
41class QGridLayout;
42class QLabel;
43class QTimer;
44
45
46namespace anatomist
47{
48 class AWindow;
49}
50
51
52class QAWindowBlock : public QMainWindow, public anatomist::Observer
53{
54 Q_OBJECT
55
56public:
60 QAWindowBlock( QWidget* parent = 0, const char* name = 0,
61 Qt::WindowFlags f = Qt::Window,
62 int colsrows = 2, bool inrows = false, bool withmenu = true );
63 virtual ~QAWindowBlock();
64 void addWindowToBlock( QWidget* item, bool withBorders = true );
65 void setColsOrRows( bool inrows, int colsrows );
66 void arrangeInRect( float widthHeightRatio = 1. );
67 bool inRows() const;
68 int columnCount() const;
69 int rowCount() const;
70 float widthHeightRatio() const;
71 virtual void update( const anatomist::Observable*, void* );
74 void reorderViews( const std::list<QWidget *> & wins );
75 void dropRowCol( int x, int y, int & row, int & col,
76 bool switching = false ) const;
77 void dropRowColDirection( int x, int y, int & row, int & col,
78 int & dir, bool switching = false ) const;
79 virtual QSize sizeHint() const;
80 void setDefaultBlockGui( bool );
81
82public slots:
84 void layInRows();
89 void setDefaultBlock( bool );
90
91protected slots:
93
94protected:
95 virtual void dragEnterEvent( QDragEnterEvent* event );
96 virtual void dragMoveEvent( QDragMoveEvent* event );
97 virtual void dragLeaveEvent( QDragLeaveEvent* event );
98 virtual void dropEvent( QDropEvent* );
99 virtual void closeEvent( QCloseEvent * event );
100
101private:
102 struct Private;
103 Private *d;
104};
105
106
107namespace anatomist
108{
109
110 class BlockBorderWidget : public QWidget
111 {
112 public:
113 BlockBorderWidget( int sides );
115 void getRowCol( int & row, int & col, int & dirx, int & diry ) const;
120 QGridLayout* parentGridLayout() const;
121
122 protected:
123 void mousePressEvent( QMouseEvent *event );
124 void mouseReleaseEvent( QMouseEvent *event );
125 void mouseMoveEvent( QMouseEvent *event );
126 void mouseDoubleClickEvent( QMouseEvent *event );
127
128 private:
129 int _sides;
130 bool _pressed;
131 int _last_x;
132 int _last_y;
133 };
134
135
139 class DraggableWrapper : public QWidget
140 {
141 public:
142 DraggableWrapper( QWidget *widget, bool withDragGrip = true );
144
145 protected:
146 virtual void mouseMoveEvent( QMouseEvent *event );
147
148 private:
149 bool _enableDragGrip;
150 QLabel *_dragWidget;
151 QTimer *_timer;
152 };
153
154}
155
156#endif
157
#define slots
void windowsDropped()
void setDefaultBlockGui(bool)
void layInRectangle()
void arrangeInRect(float widthHeightRatio=1.)
void addWindowToBlock(QWidget *item, bool withBorders=true)
virtual void update(const anatomist::Observable *, void *)
This method is called whenever the observed object is changed.
void setColumnsNumber()
void setColsOrRows(bool inrows, int colsrows)
void setDefaultBlock(bool)
void setRectangularRatio()
int columnCount() const
virtual ~QAWindowBlock()
QAWindowBlock(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=Qt::Window, int colsrows=2, bool inrows=false, bool withmenu=true)
colsrows is either the number of columns (if inrows is true), or the number of rows (if inrows is fal...
float widthHeightRatio() const
void setRowsNumber()
void layInRows()
virtual void dropEvent(QDropEvent *)
void layInColumns()
virtual void dragMoveEvent(QDragMoveEvent *event)
void reorderViews(const std::list< QWidget * > &wins)
virtual void closeEvent(QCloseEvent *event)
void dropRowCol(int x, int y, int &row, int &col, bool switching=false) const
virtual void dragEnterEvent(QDragEnterEvent *event)
void dropRowColDirection(int x, int y, int &row, int &col, int &dir, bool switching=false) const
bool inRows() const
int rowCount() const
virtual void unregisterObservable(anatomist::Observable *)
Called when an observable is destroyed, only called by Observable: don't use this function directly.
void cleanupLayout()
virtual QSize sizeHint() const
virtual void dragLeaveEvent(QDragLeaveEvent *event)
Abstract base class Anatomist window.
Definition Window.h:59
QGridLayout * parentGridLayout() const
get the layout where the parent of this (which should be a DraggableWrapper) is: that is,...
void mouseReleaseEvent(QMouseEvent *event)
void getRowCol(int &row, int &col, int &dirx, int &diry) const
void mousePressEvent(QMouseEvent *event)
void mouseDoubleClickEvent(QMouseEvent *event)
void mouseMoveEvent(QMouseEvent *event)
DraggableWrapper(QWidget *widget, bool withDragGrip=true)
virtual void mouseMoveEvent(QMouseEvent *event)
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition Observable.h:68
A class can implement the Observer interface when it wants to be informed of changes in observable ob...
Definition Observer.h:55