kexi

kexinamewidget.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KEXINAMEWIDGET_H
21#define KEXINAMEWIDGET_H
22
23#include <tqlabel.h>
24#include <tqlayout.h>
25#include <klineedit.h>
26
27namespace KexiUtils {
28class Validator;
29class MultiValidator;
30}
31
32class KEXIMAIN_EXPORT KexiNameWidget : public TQWidget
33{
34 TQ_OBJECT
35
36
37 public:
38 KexiNameWidget(const TQString& message,
39 TQWidget * parent = 0, const char * name = 0, WFlags fl = 0);
40
41 KexiNameWidget(const TQString& message,
42 const TQString& nameLabel, const TQString& nameText,
43 const TQString& captionLabel, const TQString& captionText,
44 TQWidget * parent = 0, const char * name = 0, WFlags fl = 0);
45
46 virtual ~KexiNameWidget();
47
48 TQLabel* captionLabel() const { return lbl_caption; }
49 TQLabel* nameLabel() const { return lbl_name; }
50 KLineEdit* captionLineEdit() const { return le_caption; }
51 KLineEdit* nameLineEdit() const { return le_name; }
52
53 TQString messageText() const { return lbl_message->text(); }
54
55 void setMessageText(const TQString& msg);
56
58 TQString captionText() const;
59
60 void setCaptionText(const TQString& capt);
62
63 TQString nameText() const;
64
65 void setNameText(const TQString& name);
66
70 void setWarningForName( const TQString& txt ) { m_nameWarning = txt; }
71
75 void setWarningForCaption( const TQString& txt ) { m_captionWarning = txt; }
76
78 bool empty() const;
79
80 KexiUtils::Validator *nameValidator() const;
81
85 void addNameSubvalidator( KexiUtils::Validator* validator, bool owned = true );
86
88 bool isNameRequired() const;
89
90 void setNameRequired( bool set );
91
93 bool isCaptionRequired() const { return m_caption_required; }
94
95 void setCaptionRequired(bool set) { m_caption_required = set; }
96
97 public slots:
99 virtual void clear();
100
104 bool checkValidity();
105
106 signals:
108 void returnPressed();
109
111 void textChanged();
112
114 void messageChanged();
115
116 protected slots:
117 void slotNameTxtChanged(const TQString&);
118 void slotCaptionTxtChanged(const TQString&);
119// bool eventFilter( TQObject *obj, TQEvent *ev );
120
121 protected:
122 void init(
123 const TQString& message,
124 const TQString& nameLabel, const TQString& nameText,
125 const TQString& captionLabel, const TQString& captionText);
126
127 TQLabel* lbl_message;
128 TQLabel* lbl_caption;
129 TQLabel* lbl_name;
130 KLineEdit* le_caption;
131 KLineEdit* le_name;
132 TQGridLayout* lyr;
133 KexiUtils::MultiValidator *m_validator;
134 TQString m_nameWarning, m_captionWarning;
135
136 bool m_le_name_txtchanged_disable : 1;
137 bool m_le_name_autofill : 1;
138 bool m_caption_required : 1;
139
140 friend class KexiNameDialog;
141};
142
143#endif
A validator groupping multiple TQValidators.
Definition validator.h:121
A validator extending TQValidator with offline-checking for value's validity.
Definition validator.h:46
General Utils.
Definition identifier.h:27