File: MainWindowObjects.h

package info (click to toggle)
faustworks 0.5~repack0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,028 kB
  • ctags: 1,141
  • sloc: cpp: 7,460; sh: 166; xml: 71; makefile: 66; ansic: 9
file content (187 lines) | stat: -rwxr-xr-x 5,538 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 * MainWindowObjects.h
 *
 * Created by Christophe Daudin on 12/05/09.
 * Copyright 2009 Grame. All rights reserved.
 *
 * GNU Lesser General Public License Usage
 * Alternatively, this file may be used under the terms of the GNU Lesser
 * General Public License version 2.1 as published by the Free Software
 * Foundation and appearing in the file LICENSE.LGPL included in the
 * packaging of this file.  Please review the following information to
 * ensure the GNU Lesser General Public License version 2.1 requirements
 * will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 *
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */
#ifndef MAINWINDOW_OBJECTS_H
#define MAINWINDOW_OBJECTS_H

#include <QGraphicsView>
#include <QGraphicsItem>
#include <QGraphicsPixmapItem>
#include <QTextEdit>
#include <QDialog>
//#include "ui_ResolutionDialog.h"
#include <QDomElement>
#include <QList>

class QItemResizer;
class GraphicsSceneMainWindow;
class QLanguageItem;
class QLanguageItemFactory;

//------------------------------------------------------------------------------------------------------------------------
class QSideBarGraphicsView : public QGraphicsView 
{
	public :
	
		QSideBarGraphicsView(QGraphicsScene * s , QLanguageItemFactory* factory );
		virtual ~QSideBarGraphicsView() {}
		
		virtual void addItem( QLanguageItem * container ) = 0;
		QLanguageItem * find(const QLanguageItem * other );

		virtual QString domId() = 0;
		virtual QString mimeId() = 0;

		virtual QDomElement save(QDomDocument &d);
		virtual bool load( const QDomElement& root );
		virtual void clear();
		void removeItem( QGraphicsItem * item );

	protected :

		void setupContainer( QLanguageItem * container );

		QList<QLanguageItem*> mAddedItems;
		QLanguageItemFactory* mFactory;
};

//------------------------------------------------------------------------------------------------------------------------
class QHistoryGraphicsView : public QSideBarGraphicsView 
{
	public :
		QHistoryGraphicsView(QGraphicsScene * s , QLanguageItemFactory* factory );
		virtual ~QHistoryGraphicsView() {}

		void addItem( QLanguageItem * container );

		virtual void clear();

		QString domId();
		QString mimeId();

	protected :
		void reorderItems();

		void resizeEvent( QResizeEvent * e );
};


//------------------------------------------------------------------------------------------------------------------------
class QStorageGraphicsView : public QSideBarGraphicsView 
{
	Q_OBJECT

	public :
		QStorageGraphicsView( QGraphicsScene * s , GraphicsSceneMainWindow * mainWindow , QLanguageItemFactory * factory  );
		virtual ~QStorageGraphicsView() {}
		
		void addItem( QLanguageItem * container );
		QString domId();
		QString mimeId();
			
	protected Q_SLOTS:
	
		void sceneChanged(const QList<QRectF> &);
						
	protected :
//		void mousePressEvent( QMouseEvent * event );
		void resizeEvent( QResizeEvent * );
		void dragEnterEvent(QDragEnterEvent* event);
		void dragMoveEvent(QDragMoveEvent* event);
		void dragLeaveEvent(QDragLeaveEvent* event);
		void dropEvent(QDropEvent* event);
		void focusOutEvent( QFocusEvent * event );
		void focusInEvent( QFocusEvent * event );
		void reorderItems();
		QList<QLanguageItem*> filterItems(const QList<QGraphicsItem*>& list);

		GraphicsSceneMainWindow * mMainWindow;
		int mPreferredWidth;
};

//------------------------------------------------------------------------------------------------------------------------
class QBackgroundItem : public QGraphicsItem
{
	public:
		
		QBackgroundItem( GraphicsSceneMainWindow * mainWindow ,  const QSizeF& size );
		virtual ~QBackgroundItem() {}

		void setRect( const QRectF& size );
		QRectF boundingRect() const;
		QRectF pageRectInSceneCoords() const;
		void setPageSize( const QSizeF& size );
		QSizeF pageSize() const;
		
		void setResizeEnabled( bool isEnabled );
		bool isResizeEnabled() const;

	protected:
		void paint ( QPainter * painter, const QStyleOptionGraphicsItem * , QWidget * );
		void updatePageRect();
		
		QRectF mRect;
		QGraphicsRectItem * mPage;
		QItemResizer * mBackgroundItemResizer;
		bool mIsResizeEnabled;
};

//------------------------------------------------------------------------------------------------------------------------
class LanguageTextEdit : public QTextEdit
{
	Q_OBJECT

	public :
		LanguageTextEdit(const QString& initString , GraphicsSceneMainWindow * mainWindow);
		virtual ~LanguageTextEdit() {}

	Q_SIGNALS:
		void enabled( bool isEnabled );
		
	protected :
		void changeEvent ( QEvent * event );
		void wheelEvent( QWheelEvent * e );
		void focusOutEvent( QFocusEvent * event );
		void dragEnterEvent(QDragEnterEvent* event);
		void dragMoveEvent(QDragMoveEvent* event);
		void dropEvent(QDropEvent* event);
		
		GraphicsSceneMainWindow * mMainWindow;
};

//------------------------------------------------------------------------------------------------------------------------
class LanguageGraphicsView : public QGraphicsView 
{
	public:
		LanguageGraphicsView();
		virtual ~LanguageGraphicsView() {}
		void setMainWindow( GraphicsSceneMainWindow * mainWindow );

		QSize sizeHint () const;

	protected:
		void dragEnterEvent(QDragEnterEvent* event);
		void dragLeaveEvent(QDragLeaveEvent* event);
		void dragMoveEvent(QDragMoveEvent* event);
		void dropEvent(QDropEvent* event);
		void mouseMoveEvent(QMouseEvent * event);

		GraphicsSceneMainWindow * mMainWindow;
};

#endif