-rw-r--r-- | library/categoryselect.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/library/categoryselect.h b/library/categoryselect.h new file mode 100644 index 0000000..5c6b565 --- a/dev/null +++ b/library/categoryselect.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2001 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 | |||
21 | #ifndef __CATEGORYCOMBO_H__ | ||
22 | #define __CATEGORYCOMBO_H__ | ||
23 | |||
24 | #include <qcombobox.h> | ||
25 | #include <qhbox.h> | ||
26 | #include <qstring.h> | ||
27 | #include <qarray.h> | ||
28 | |||
29 | extern QString categoryFileName(); | ||
30 | |||
31 | class QToolButton; | ||
32 | |||
33 | class CategoryComboPrivate; | ||
34 | class CategoryCombo : public QComboBox | ||
35 | { | ||
36 | Q_OBJECT | ||
37 | |||
38 | public: | ||
39 | CategoryCombo( QWidget *parent, const char* name = 0 ); | ||
40 | ~CategoryCombo(); | ||
41 | |||
42 | int currentCategory() const; | ||
43 | void setCurrentCategory( int id ); | ||
44 | // depreciated. | ||
45 | void initCombo( const QArray<int> &recCats, const QString &appName ); | ||
46 | void initCombo( const QArray<int> &recCats, const QString &appName, | ||
47 | const QString &visibleName /* = appName */ ); | ||
48 | |||
49 | signals: | ||
50 | void sigCatChanged( int newUid ); | ||
51 | |||
52 | private slots: | ||
53 | void slotValueChanged( int ); | ||
54 | |||
55 | private: | ||
56 | void setCurrentText( const QString &str ); | ||
57 | CategoryComboPrivate *d; | ||
58 | }; | ||
59 | |||
60 | #endif | ||
61 | |||
62 | class CategorySelectPrivate; | ||
63 | class CategorySelect : public QHBox | ||
64 | { | ||
65 | Q_OBJECT | ||
66 | public: | ||
67 | // we need two constructors, the first gets around designer limitations | ||
68 | CategorySelect( QWidget *parent = 0, const char *name = 0 ); | ||
69 | |||
70 | CategorySelect( const QArray<int> &vlCats, const QString &appName, | ||
71 | QWidget *parent = 0, const char *name = 0 ); | ||
72 | CategorySelect( const QArray<int> &vlCats, const QString &appName, | ||
73 | const QString &visibleName, QWidget *parent = 0, | ||
74 | const char *name = 0 ); | ||
75 | ~CategorySelect(); | ||
76 | |||
77 | const QArray<int> ¤tCategories() const; | ||
78 | int currentCategory() const; | ||
79 | void setCurrentCategory( int newCatUid ); | ||
80 | // pretty much if you don't set it the constructor, you need to | ||
81 | // call it here ASAP! | ||
82 | // however this call is depreciated... | ||
83 | void setCategories( const QArray<int> &vlCats, const QString &appName ); | ||
84 | // use this one instead (for translating ) | ||
85 | void setCategories( const QArray<int> &vlCats, const QString &appName, | ||
86 | const QString &visibleName ); | ||
87 | |||
88 | // these were added for find dialog. | ||
89 | void setRemoveCategoryEdit( bool remove ); | ||
90 | void setAllCategories( bool add ); | ||
91 | |||
92 | signals: | ||
93 | void signalSelected( int ); | ||
94 | |||
95 | private slots: | ||
96 | void slotDialog(); | ||
97 | void slotNewCat( int id ); | ||
98 | |||
99 | private: | ||
100 | void init(); | ||
101 | QString mStrAppName; | ||
102 | CategoryCombo *cmbCat; | ||
103 | QToolButton *cmdCat; | ||
104 | CategorySelectPrivate *d; | ||
105 | }; | ||