00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FOLDER_H
00030 #define FOLDER_H
00031
00032 #include <qobject.h>
00033 #include <q3listview.h>
00034 #include <q3iconview.h>
00035
00036 #include <QDragEnterEvent>
00037 #include <QMouseEvent>
00038 #include <QDragLeaveEvent>
00039 #include <QDragMoveEvent>
00040 #include <QKeyEvent>
00041 #include <QEvent>
00042 #include <QDropEvent>
00043 #include <Q3PtrList>
00044
00045 #include "MyWidget.h"
00046
00047 class FolderListItem;
00048 class Table;
00049 class Matrix;
00050 class MultiLayer;
00051 class Note;
00052
00053 class QDragEnterEvent;
00054 class QDragMoveEvent;
00055 class QDragLeaveEvent;
00056 class QDropEvent;
00057 class Q3DragObject;
00058
00060 class Folder : public QObject
00061 {
00062 Q_OBJECT
00063
00064 public:
00065 Folder( Folder *parent, const QString &name );
00066
00067 QList<MyWidget *> windowsList(){return lstWindows;};
00068
00069 void addWindow( MyWidget *w ){ lstWindows.append( w );};
00070 void removeWindow( MyWidget *w ){ lstWindows.takeAt( lstWindows.indexOf(w) );};
00071
00073 QStringList subfolders();
00074
00076 QList<Folder*> folders();
00077
00079 Folder* findSubfolder(const QString& s, bool caseSensitive = true, bool partialMatch = false);
00080
00082 MyWidget* findWindow(const QString& s, bool windowNames, bool labels,
00083 bool caseSensitive, bool partialMatch);
00084
00086
00091 MyWidget *window(const QString &name, const char *cls="myWidget", bool recursive=false);
00093 Table *table(const QString &name, bool recursive=false) { return (Table*) window(name, "Table", recursive); }
00095 Matrix *matrix(const QString &name, bool recursive=false) { return (Matrix*) window(name, "Matrix", recursive); }
00097 MultiLayer *graph(const QString &name, bool recursive=false) { return (MultiLayer*) window(name, "MultiLayer", recursive); }
00099 Note *note(const QString &name, bool recursive=false) { return (Note*) window(name, "Note", recursive); }
00100
00102 QString path();
00103
00105 QString sizeToString();
00106
00107 QString birthDate(){return birthdate;};
00108 void setBirthDate(const QString& s){birthdate = s;};
00109
00110 QString modificationDate(){return modifDate;};
00111 void setModificationDate(const QString& s){modifDate = s;};
00112
00114 FolderListItem * folderListItem(){return myFolderListItem;};
00115 void setFolderListItem(FolderListItem *it){myFolderListItem = it;};
00116
00117 MyWidget *activeWindow(){return d_active_window;};
00118 void setActiveWindow(MyWidget *w){d_active_window = w;};
00119
00120 protected:
00121 QString birthdate, modifDate;
00122 QList<MyWidget *> lstWindows;
00123 FolderListItem *myFolderListItem;
00124
00126 MyWidget *d_active_window;
00127 };
00128
00129
00130
00131
00132
00133
00135 class WindowListItem : public Q3ListViewItem
00136 {
00137 public:
00138 WindowListItem( Q3ListView *parent, MyWidget *w );
00139
00140 MyWidget *window() { return myWindow; };
00141 void cancelRename(int){return;};
00142
00143 protected:
00144 MyWidget *myWindow;
00145 };
00146
00147
00148
00149
00150
00151
00153 class FolderListItem : public Q3ListViewItem
00154 {
00155 public:
00156 FolderListItem( Q3ListView *parent, Folder *f );
00157 FolderListItem( FolderListItem *parent, Folder *f );
00158
00159 enum {RTTI = 1001};
00160
00161 void setActive( bool o );
00162 void cancelRename(int){return;};
00163
00164 virtual int rtti() const {return (int)RTTI;};
00165
00166 Folder *folder() { return myFolder; };
00167
00169
00172 bool isChildOf(FolderListItem *src);
00173
00174 protected:
00175 Folder *myFolder;
00176 };
00177
00178
00179
00180
00181
00182
00184 class FolderListView : public Q3ListView
00185 {
00186 Q_OBJECT
00187
00188 public:
00189 FolderListView( QWidget *parent = 0, const char *name = 0 );
00190
00191 public slots:
00192 void adjustColumns();
00193
00194 protected:
00195 void startDrag();
00196
00197 void contentsDropEvent( QDropEvent *e );
00198 void contentsMouseMoveEvent( QMouseEvent *e );
00199 void contentsMousePressEvent( QMouseEvent *e );
00200 void contentsMouseDoubleClickEvent( QMouseEvent* e );
00201 void keyPressEvent ( QKeyEvent * e );
00202 void contentsMouseReleaseEvent( QMouseEvent *){mousePressed = false;};
00203 void enterEvent(QEvent *){mousePressed = false;};
00204
00205 signals:
00206 void dragItems(QList<Q3ListViewItem *> items);
00207 void dropItems(Q3ListViewItem *dest);
00208 void renameItem(Q3ListViewItem *item);
00209 void addFolderItem();
00210 void deleteSelection();
00211
00212 private:
00213 bool mousePressed;
00214 QPoint presspos;
00215 };
00216
00217 #endif