-rw-r--r-- | library/fileselector.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/library/fileselector.h b/library/fileselector.h new file mode 100644 index 0000000..ef8efea --- a/dev/null +++ b/library/fileselector.h | |||
@@ -0,0 +1,108 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef FILESELECTOR_H | ||
21 | #define FILESELECTOR_H | ||
22 | |||
23 | #include <qhbox.h> | ||
24 | #include <qvbox.h> | ||
25 | #include <qlistview.h> | ||
26 | #include <qtoolbutton.h> | ||
27 | |||
28 | #include "filemanager.h" | ||
29 | #include "applnk.h" | ||
30 | |||
31 | class QPopupMenu; | ||
32 | class QPushButton; | ||
33 | |||
34 | class FileSelectorItem : public QListViewItem | ||
35 | { | ||
36 | public: | ||
37 | FileSelectorItem( QListView *parent, const DocLnk& f ); | ||
38 | ~FileSelectorItem(); | ||
39 | |||
40 | DocLnk file() const { return fl; } | ||
41 | |||
42 | private: | ||
43 | DocLnk fl; | ||
44 | }; | ||
45 | |||
46 | class CategoryMenu; | ||
47 | class FileSelectorViewPrivate; | ||
48 | class FileSelectorView : public QListView | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | public: | ||
53 | FileSelectorView( const QString &mimefilter, QWidget *parent, const char *name ); | ||
54 | ~FileSelectorView(); | ||
55 | void reread(); | ||
56 | int fileCount() { return count; } | ||
57 | |||
58 | void setCategoryFilter(CategoryMenu *); | ||
59 | protected: | ||
60 | void keyPressEvent( QKeyEvent *e ); | ||
61 | |||
62 | protected slots: | ||
63 | void cardMessage( const QCString &, const QByteArray &); | ||
64 | |||
65 | void categoryChanged(); | ||
66 | |||
67 | private: | ||
68 | QString filter; | ||
69 | FileManager *fileManager; | ||
70 | int count; | ||
71 | FileSelectorViewPrivate *d; | ||
72 | }; | ||
73 | |||
74 | class FileSelectorPrivate; | ||
75 | class FileSelector : public QVBox | ||
76 | { | ||
77 | Q_OBJECT | ||
78 | |||
79 | public: | ||
80 | FileSelector( const QString &mimefilter, QWidget *parent, const char *name, bool newVisible = TRUE, bool closeVisible = TRUE ); | ||
81 | ~FileSelector(); | ||
82 | void setNewVisible( bool b ); | ||
83 | void setCloseVisible( bool b ); | ||
84 | void setCategoriesVisible( bool b ); | ||
85 | void reread(); | ||
86 | int fileCount(); | ||
87 | const DocLnk *selected(); | ||
88 | |||
89 | signals: | ||
90 | void fileSelected( const DocLnk & ); | ||
91 | void newSelected( const DocLnk & ); | ||
92 | void closeMe(); | ||
93 | |||
94 | private slots: | ||
95 | void createNew(); | ||
96 | void fileClicked( int, QListViewItem *, const QPoint &, int ); | ||
97 | // pressed to get 'right down' | ||
98 | void filePressed( int, QListViewItem *, const QPoint &, int ); | ||
99 | void fileClicked( QListViewItem *); | ||
100 | |||
101 | private: | ||
102 | FileSelectorView *view; | ||
103 | QString filter; | ||
104 | QToolButton *buttonNew, *buttonClose; | ||
105 | FileSelectorPrivate *d; | ||
106 | }; | ||
107 | |||
108 | #endif | ||