kmail

simplestringlisteditor.h
1/*
2 simplestringlisteditor.h
3
4 This file is part of KMail, the KDE mail client.
5 Copyright (c) 2001 Marc Mutz <mutz@kde.org>
6
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
10
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the TQt library by Trolltech AS, Norway (or with modified versions
23 of TQt that use the same license as TQt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 TQt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
29 your version.
30*/
31
32#ifndef _SIMPLESTRINGLISTEDITOR_H_
33#define _SIMPLESTRINGLISTEDITOR_H_
34
35#include <tqwidget.h>
36#include <tqstringlist.h>
37#include <tqstring.h>
38
39class TQListBox;
40class TQPushButton;
41
42//
43//
44// SimpleStringListEditor (a listbox with "add..." and "remove" buttons)
45//
46//
47
48class SimpleStringListEditor : public TQWidget {
49 TQ_OBJECT
50
51public:
52 enum ButtonCode {
53 None = 0x00, Add = 0x01,
54 Remove = 0x02, Modify = 0x04,
55 Up = 0x08, Down = 0x10,
56 All = Add|Remove|Modify|Up|Down,
57 Unsorted = Add|Remove|Modify
58 };
59
61 SimpleStringListEditor( TQWidget * parent=0, const char * name=0,
62 ButtonCode buttons=Unsorted,
63 const TQString & addLabel=TQString(),
64 const TQString & removeLabel=TQString(),
65 const TQString & modifyLabel=TQString(),
66 const TQString & addDialogLabel=TQString() );
67
69 void setStringList( const TQStringList & strings );
71 void appendStringList( const TQStringList & strings );
73 TQStringList stringList() const;
74
76 void setButtonText( ButtonCode button, const TQString & text );
77
78signals:
82 void aboutToAdd(TQString&);
83 void changed(void);
84
85protected slots:
86 void slotAdd();
87 void slotRemove();
88 void slotModify();
89 void slotUp();
90 void slotDown();
91
92 void slotSelectionChanged();
93
94protected:
95 bool containsString( const TQString & str );
96 TQListBox *mListBox;
97 TQPushButton *mAddButton;
98 TQPushButton *mRemoveButton;
99 TQPushButton *mModifyButton;
100 TQPushButton *mUpButton;
101 TQPushButton *mDownButton;
102 const TQString mAddDialogLabel;
103};
104
105
106
107
108#endif // _SIMPLESTRINGLISTEDITOR_H_