• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
keditlistbox.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
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 KEDITLISTBOX_H
21#define KEDITLISTBOX_H
22
23#include <tqgroupbox.h>
24#include <tqlistbox.h>
25
26#include <tdelibs_export.h>
27
28class KLineEdit;
29class KComboBox;
30class TQPushButton;
31
32class KEditListBoxPrivate;
44class TDEUI_EXPORT KEditListBox : public TQGroupBox
45{
46 TQ_OBJECT
47
48
49 TQ_SETS( Button )
50 TQ_PROPERTY( Button buttons READ buttonsProp WRITE setButtonsProp )
51 TQ_PROPERTY( TQStringList items READ items WRITE setItems )
52
53public:
54 class CustomEditor;
55
56 public:
57
62 enum Button { Add = 1, Remove = 2, UpDown = 4 };
63 enum { All = Add|Remove|UpDown }; // separated so that it doesn't appear in Qt designer
64
77 KEditListBox(TQWidget *parent = 0, const char *name = 0,
78 bool checkAtEntering=false, int buttons = All );
85 KEditListBox(const TQString& title, TQWidget *parent = 0,
86 const char *name = 0, bool checkAtEntering=false,
87 int buttons = All );
88
101 KEditListBox( const TQString& title,
102 const CustomEditor &customEditor,
103 TQWidget *parent = 0, const char *name = 0,
104 bool checkAtEntering = false, int buttons = All );
105
106 virtual ~KEditListBox();
107
111 TQListBox* listBox() const { return m_listBox; }
115 KLineEdit* lineEdit() const { return m_lineEdit; }
119 TQPushButton* addButton() const { return servNewButton; }
123 TQPushButton* removeButton() const { return servRemoveButton; }
127 TQPushButton* upButton() const { return servUpButton; }
131 TQPushButton* downButton() const { return servDownButton; }
132
136 int count() const { return int(m_listBox->count()); }
140 void insertStringList(const TQStringList& list, int index=-1);
144 void insertStrList(const TQStrList* list, int index=-1);
148 void insertStrList(const TQStrList& list, int index=-1);
152 void insertStrList(const char ** list, int numStrings=-1, int index=-1);
156 void insertItem(const TQString& text, int index=-1) {m_listBox->insertItem(text,index);}
160 void clear();
164 TQString text(int index) const { return m_listBox->text(index); }
168 int currentItem() const;
172 TQString currentText() const { return m_listBox->currentText(); }
173
177 TQStringList items() const;
178
184 void setItems(const TQStringList& items);
185
189 int buttons() const;
190 inline Button buttonsProp() const { return (Button)buttons(); }
191
195 void setButtons( uint buttons );
196 inline void setButtonsProp( Button buttons ) { setButtons((uint)buttons); }
197
198 signals:
199 void changed();
200
207 void added( const TQString & text );
208
216 void added( int item, const TQString & text );
217
224 void removed( const TQString & text );
225
233 void removed( int item, const TQString & text );
234
242 void renamed( const TQString &from, const TQString &to );
243
252 void renamed( int item, const TQString &from, const TQString &to );
253
254 protected slots:
255 //the names should be self-explaining
256 void moveItemUp();
257 void moveItemDown();
258 void addItem();
259 void removeItem();
260 void enableMoveButtons(int index);
261 void typedSomething(const TQString& text);
262
263 private:
264 TQListBox *m_listBox;
265 TQPushButton *servUpButton, *servDownButton;
266 TQPushButton *servNewButton, *servRemoveButton;
267 KLineEdit *m_lineEdit;
268
269 //this is called in both ctors, to avoid code duplication
270 void init( bool checkAtEntering, int buttons,
271 TQWidget *representationWidget = 0L );
272
273 protected:
274 virtual void virtual_hook( int id, void* data );
275 private:
276 //our lovely private d-pointer
277 KEditListBoxPrivate* const d;
278
284 // ### KDE4: add virtual destructor
285 public:
286 class CustomEditor
287 {
288 public:
289 TDEUI_EXPORT CustomEditor()
290 : m_representationWidget( 0L ),
291 m_lineEdit( 0L ) {}
292 TDEUI_EXPORT CustomEditor( TQWidget *repWidget, KLineEdit *edit )
293 : m_representationWidget( repWidget ),
294 m_lineEdit( edit ) {}
295 TDEUI_EXPORT CustomEditor( KComboBox *combo );
296
297 TDEUI_EXPORT void setRepresentationWidget( TQWidget *repWidget ) {
298 m_representationWidget = repWidget;
299 }
300 TDEUI_EXPORT void setLineEdit( KLineEdit *edit ) {
301 m_lineEdit = edit;
302 }
303
304 TDEUI_EXPORT virtual TQWidget *representationWidget() const {
305 return m_representationWidget;
306 }
307 TDEUI_EXPORT virtual KLineEdit *lineEdit() const {
308 return m_lineEdit;
309 }
310
311 protected:
312 TQWidget *m_representationWidget;
313 KLineEdit *m_lineEdit;
314 };
315};
316
317#endif
318
KComboBox
An enhanced combo box.
Definition: kcombobox.h:152
KEditListBox::CustomEditor
Custom editor class.
Definition: keditlistbox.h:287
KEditListBox
An editable listbox.
Definition: keditlistbox.h:45
KEditListBox::insertItem
void insertItem(const TQString &text, int index=-1)
See TQListBox::insertItem()
Definition: keditlistbox.h:156
KEditListBox::removeButton
TQPushButton * removeButton() const
Return a pointer to the Remove button.
Definition: keditlistbox.h:123
KEditListBox::removed
void removed(int item, const TQString &text)
This signal is emitted when the user removes a string from the list.
KEditListBox::listBox
TQListBox * listBox() const
Return a pointer to the embedded TQListBox.
Definition: keditlistbox.h:111
KEditListBox::count
int count() const
See TQListBox::count()
Definition: keditlistbox.h:136
KEditListBox::lineEdit
KLineEdit * lineEdit() const
Return a pointer to the embedded TQLineEdit.
Definition: keditlistbox.h:115
KEditListBox::currentText
TQString currentText() const
See TQListBox::currentText()
Definition: keditlistbox.h:172
KEditListBox::renamed
void renamed(int item, const TQString &from, const TQString &to)
This signal is emitted when the user renames a list item.
KEditListBox::renamed
void renamed(const TQString &from, const TQString &to)
This signal is emitted when the user renames a list item.
KEditListBox::Button
Button
Enumeration of the buttons, the listbox offers.
Definition: keditlistbox.h:62
KEditListBox::removed
void removed(const TQString &text)
This signal is emitted when the user removes a string from the list.
KEditListBox::added
void added(const TQString &text)
This signal is emitted when the user adds a new string to the list.
KEditListBox::addButton
TQPushButton * addButton() const
Return a pointer to the Add button.
Definition: keditlistbox.h:119
KEditListBox::text
TQString text(int index) const
See TQListBox::text()
Definition: keditlistbox.h:164
KEditListBox::upButton
TQPushButton * upButton() const
Return a pointer to the Up button.
Definition: keditlistbox.h:127
KEditListBox::downButton
TQPushButton * downButton() const
Return a pointer to the Down button.
Definition: keditlistbox.h:131
KEditListBox::added
void added(int item, const TQString &text)
This signal is emitted when the user adds a new string to the list.
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.