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 );
00070 void removeWindow( MyWidget *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 int depth();
00106
00107 Folder *folderBelow();
00108
00110 Folder* rootFolder();
00111
00113 QString sizeToString();
00114
00115 QString birthDate(){return birthdate;};
00116 void setBirthDate(const QString& s){birthdate = s;};
00117
00118 QString modificationDate(){return modifDate;};
00119 void setModificationDate(const QString& s){modifDate = s;};
00120
00122 FolderListItem * folderListItem(){return myFolderListItem;};
00123 void setFolderListItem(FolderListItem *it){myFolderListItem = it;};
00124
00125 MyWidget *activeWindow(){return d_active_window;};
00126 void setActiveWindow(MyWidget *w){d_active_window = w;};
00127
00128 QString logInfo(){return d_log_info;};
00129 void appendLogInfo(const QString& text){d_log_info += text;};
00130 void clearLogInfo(){d_log_info = QString();};
00131
00132 protected:
00133 QString birthdate, modifDate;
00134 QString d_log_info;
00135 QList<MyWidget *> lstWindows;
00136 FolderListItem *myFolderListItem;
00137
00139 MyWidget *d_active_window;
00140 };
00141
00142
00143
00144
00145
00146
00148 class WindowListItem : public Q3ListViewItem
00149 {
00150 public:
00151 WindowListItem( Q3ListView *parent, MyWidget *w );
00152
00153 MyWidget *window() { return myWindow; };
00154
00155 protected:
00156 MyWidget *myWindow;
00157 };
00158
00159
00160
00161
00162
00163
00165 class FolderListItem : public Q3ListViewItem
00166 {
00167 public:
00168 FolderListItem( Q3ListView *parent, Folder *f );
00169 FolderListItem( FolderListItem *parent, Folder *f );
00170
00171 enum {RTTI = 1001};
00172
00173 void setActive( bool o );
00174 void cancelRename(int){return;};
00175
00176 virtual int rtti() const {return (int)RTTI;};
00177
00178 Folder *folder() { return myFolder; };
00179
00181
00184 bool isChildOf(FolderListItem *src);
00185
00186 protected:
00187 Folder *myFolder;
00188 };
00189
00190
00191
00192
00193
00194
00196 class FolderListView : public Q3ListView
00197 {
00198 Q_OBJECT
00199
00200 public:
00201 FolderListView( QWidget *parent = 0, const char *name = 0 );
00202
00203 public slots:
00204 void adjustColumns();
00205
00206 protected slots:
00207 void expandedItem(Q3ListViewItem *item);
00208
00209 protected:
00210 void startDrag();
00211
00212 void contentsDropEvent( QDropEvent *e );
00213 void contentsMouseMoveEvent( QMouseEvent *e );
00214 void contentsMousePressEvent( QMouseEvent *e );
00215 void contentsMouseDoubleClickEvent( QMouseEvent* e );
00216 void keyPressEvent ( QKeyEvent * e );
00217 void contentsMouseReleaseEvent( QMouseEvent *){mousePressed = false;};
00218 void enterEvent(QEvent *){mousePressed = false;};
00219
00220 signals:
00221 void dragItems(QList<Q3ListViewItem *> items);
00222 void dropItems(Q3ListViewItem *dest);
00223 void renameItem(Q3ListViewItem *item);
00224 void addFolderItem();
00225 void deleteSelection();
00226
00227 private:
00228 bool mousePressed;
00229 QPoint presspos;
00230 };
00231
00232 #endif