SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
Folder.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : Folder.h
3
Project : SciDAVis
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7
Description : Folder for the project explorer
8
9
***************************************************************************/
10
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
22
* *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
27
* *
28
***************************************************************************/
29
#ifndef FOLDER_H
30
#define FOLDER_H
31
32
#include <qobject.h>
33
#include <q3listview.h>
34
#include <q3iconview.h>
35
//Added by qt3to4:
36
#include <QDragEnterEvent>
37
#include <QMouseEvent>
38
#include <QDragLeaveEvent>
39
#include <QDragMoveEvent>
40
#include <QKeyEvent>
41
#include <QEvent>
42
#include <QDropEvent>
43
#include <Q3PtrList>
44
45
#include "
MyWidget.h
"
46
47
class
FolderListItem
;
48
class
Table
;
49
class
Matrix
;
50
class
MultiLayer
;
51
class
Note
;
52
53
class
QDragEnterEvent;
54
class
QDragMoveEvent;
55
class
QDragLeaveEvent;
56
class
QDropEvent;
57
class
Q3DragObject;
58
60
class
Folder
:
public
QObject
61
{
62
Q_OBJECT
63
64
public
:
65
Folder
(
Folder
*parent,
const
QString &name );
66
67
QList<MyWidget *>
windowsList
(){
return
lstWindows
;};
68
69
void
addWindow
(
MyWidget
*w ) {
70
w->
setFolder
(
this
);
71
lstWindows
.append( w );
72
};
73
void
removeWindow
(
MyWidget
*w ){
74
w->
setFolder
(0);
75
lstWindows
.removeAll(w);
76
if
(w==
d_active_window
)
d_active_window
=0;
77
};
78
79
int
windowCount
(
bool
recursive =
false
)
const
{
80
int
result =
lstWindows
.size();
81
if
(recursive)
82
foreach
(
Folder
*folder,
folders
())
83
result += folder->
windowCount
(
true
);
84
return
result;
85
};
86
88
QStringList
subfolders
();
89
91
QList<Folder*>
folders
()
const
;
92
94
Folder
*
findSubfolder
(
const
QString& s,
bool
caseSensitive =
true
,
bool
partialMatch =
false
);
95
97
MyWidget
*
findWindow
(
const
QString& s,
bool
windowNames,
bool
labels,
98
bool
caseSensitive,
bool
partialMatch);
99
101
106
MyWidget
*
window
(
const
QString &name,
const
char
*cls=
"myWidget"
,
bool
recursive=
false
);
108
Table
*
table
(
const
QString &name,
bool
recursive=
false
) {
return
(
Table
*)
window
(name,
"Table"
, recursive); }
110
Matrix
*
matrix
(
const
QString &name,
bool
recursive=
false
) {
return
(
Matrix
*)
window
(name,
"Matrix"
, recursive); }
112
MultiLayer
*
graph
(
const
QString &name,
bool
recursive=
false
) {
return
(
MultiLayer
*)
window
(name,
"MultiLayer"
, recursive); }
114
Note
*
note
(
const
QString &name,
bool
recursive=
false
) {
return
(
Note
*)
window
(name,
"Note"
, recursive); }
115
117
QString
path
();
118
120
Folder
*
rootFolder
();
121
122
QString
birthDate
(){
return
birthdate
;};
123
void
setBirthDate
(
const
QString& s){
birthdate
= s;};
124
125
QString
modificationDate
(){
return
modifDate
;};
126
void
setModificationDate
(
const
QString& s){
modifDate
= s;};
127
129
FolderListItem
*
folderListItem
(){
return
myFolderListItem
;};
130
void
setFolderListItem
(
FolderListItem
*it){
myFolderListItem
= it;};
131
132
MyWidget
*
activeWindow
(){
return
d_active_window
;};
133
void
setActiveWindow
(
MyWidget
*w){
d_active_window
= w;};
134
135
protected
:
136
QString
birthdate
,
modifDate
;
137
QList<MyWidget *>
lstWindows
;
138
FolderListItem
*
myFolderListItem
;
139
141
MyWidget
*
d_active_window
;
142
};
143
144
/*****************************************************************************
145
*
146
* Class WindowListItem
147
*
148
*****************************************************************************/
150
class
WindowListItem
:
public
Q3ListViewItem
151
{
152
public
:
153
WindowListItem
( Q3ListView *parent,
MyWidget
*w );
154
155
MyWidget
*
window
() {
return
myWindow
; };
156
157
protected
:
158
MyWidget
*
myWindow
;
159
};
160
161
/*****************************************************************************
162
*
163
* Class FolderListItem
164
*
165
*****************************************************************************/
167
class
FolderListItem
:
public
Q3ListViewItem
168
{
169
public
:
170
FolderListItem
( Q3ListView *parent,
Folder
*f );
171
FolderListItem
(
FolderListItem
*parent,
Folder
*f );
172
173
enum
{
RTTI
= 1001};
174
175
void
setActive
(
bool
o );
176
177
virtual
int
rtti
()
const
{
return
(
int
)
RTTI
;};
178
179
Folder
*
folder
() {
return
myFolder
; };
180
182
185
bool
isChildOf
(
FolderListItem
*src);
186
187
protected
:
188
Folder
*
myFolder
;
189
};
190
191
/*****************************************************************************
192
*
193
* Class FolderListView
194
*
195
*****************************************************************************/
197
class
FolderListView
:
public
Q3ListView
198
{
199
Q_OBJECT
200
201
public
:
202
FolderListView
( QWidget *parent = 0,
const
char
*name = 0 );
203
204
public
slots:
205
void
adjustColumns
();
206
207
protected
:
208
void
startDrag
();
209
210
void
contentsDropEvent
( QDropEvent *e );
211
void
contentsMouseMoveEvent
( QMouseEvent *e );
212
void
contentsMousePressEvent
( QMouseEvent *e );
213
void
contentsMouseDoubleClickEvent
( QMouseEvent* e );
214
void
keyPressEvent
( QKeyEvent * e );
215
void
contentsMouseReleaseEvent
( QMouseEvent *){
mousePressed
=
false
;};
216
void
enterEvent
(QEvent *){
mousePressed
=
false
;};
217
218
signals:
219
void
dragItems
(QList<Q3ListViewItem *> items);
220
void
dropItems
(Q3ListViewItem *dest);
221
void
renameItem
(Q3ListViewItem *item);
222
void
addFolderItem
();
223
void
deleteSelection
();
224
225
private
:
226
bool
mousePressed
;
227
QPoint
presspos
;
228
};
229
230
#endif
Generated by
1.8.1