Diffstat (limited to 'pwmanager/pwmanager/listobjselectwnd.h') (more/less context) (show whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/listobjselectwnd.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/listobjselectwnd.h b/pwmanager/pwmanager/listobjselectwnd.h new file mode 100644 index 0000000..3b5f1eb --- a/dev/null +++ b/pwmanager/pwmanager/listobjselectwnd.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003, 2004 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License version 2 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | /*************************************************************************** | ||
13 | * copyright (C) 2004 by Ulf Schenk | ||
14 | * This file is originaly based on version 1.0.1 of pwmanager | ||
15 | * and was modified to run on embedded devices that run microkde | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #ifndef LISTOBJSELECTWND_H | ||
21 | #define LISTOBJSELECTWND_H | ||
22 | |||
23 | #include <qdialog.h> | ||
24 | #include <qvbox.h> | ||
25 | #include <qhbox.h> | ||
26 | #include <qlabel.h> | ||
27 | #include <qlistbox.h> | ||
28 | #include <qpushbutton.h> | ||
29 | #include <qstringlist.h> | ||
30 | |||
31 | |||
32 | /** Display a list-window for selection of some objects */ | ||
33 | class ListObjSelectWnd : public QDialog | ||
34 | { | ||
35 | Q_OBJECT | ||
36 | public: | ||
37 | ListObjSelectWnd(const QString &caption, const QString &titleText, | ||
38 | QWidget *parent = 0, bool multiSel = false, | ||
39 | const char *name = 0, | ||
40 | bool modal = FALSE, WFlags f = 0); | ||
41 | ~ListObjSelectWnd(); | ||
42 | |||
43 | void setList(const QStringList &_list); | ||
44 | void addObj(const QString &name) | ||
45 | { list->insertItem(name); } | ||
46 | void selectObj(const QString &name) | ||
47 | #ifndef PWM_EMBEDDED | ||
48 | { list->setCurrentItem(list->findItem(name, Qt::ExactMatch)); } | ||
49 | #else | ||
50 | { list->setCurrentItem(list->findItem(name)); } | ||
51 | #endif | ||
52 | QString getSelected() | ||
53 | { return list->currentText(); } | ||
54 | int getSelectedIndex() | ||
55 | #ifndef PWM_EMBEDDED | ||
56 | { return list->index(list->selectedItem()); } | ||
57 | #else | ||
58 | { return list->currentItem(); } | ||
59 | #endif | ||
60 | QStringList getSelectedList(); | ||
61 | void clearObjs() | ||
62 | { list->clear(); } | ||
63 | |||
64 | protected: | ||
65 | QVBox *vbox1; | ||
66 | QHBox *hbox1; | ||
67 | QHBox *hbox2; | ||
68 | QLabel *title; | ||
69 | QListBox *list; | ||
70 | QPushButton *okButton; | ||
71 | QPushButton *cancelButton; | ||
72 | QPushButton *selAllButton; | ||
73 | QPushButton *unselAllButton; | ||
74 | |||
75 | protected: | ||
76 | void resizeEvent(QResizeEvent *); | ||
77 | |||
78 | protected slots: | ||
79 | void okButton_slot(); | ||
80 | void cancelButton_slot(); | ||
81 | void selAllButton_slot(); | ||
82 | void unselAllButton_slot(); | ||
83 | }; | ||
84 | |||
85 | #endif | ||