• 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 
28 class KLineEdit;
29 class KComboBox;
30 class TQPushButton;
31 
32 class KEditListBoxPrivate;
44 class TDEUI_EXPORT KEditListBox : public TQGroupBox
45 {
46  Q_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 
53 public:
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 
206  void added( const TQString & text );
207 
213  void removed( const TQString & text );
214 
215  protected slots:
216  //the names should be self-explaining
217  void moveItemUp();
218  void moveItemDown();
219  void addItem();
220  void removeItem();
221  void enableMoveButtons(int index);
222  void typedSomething(const TQString& text);
223 
224  private:
225  TQListBox *m_listBox;
226  TQPushButton *servUpButton, *servDownButton;
227  TQPushButton *servNewButton, *servRemoveButton;
228  KLineEdit *m_lineEdit;
229 
230  //this is called in both ctors, to avoid code duplication
231  void init( bool checkAtEntering, int buttons,
232  TQWidget *representationWidget = 0L );
233 
234  protected:
235  virtual void virtual_hook( int id, void* data );
236  private:
237  //our lovely private d-pointer
238  KEditListBoxPrivate* const d;
239 
245  // ### KDE4: add virtual destructor
246  public:
247  class CustomEditor
248  {
249  public:
250  TDEUI_EXPORT CustomEditor()
251  : m_representationWidget( 0L ),
252  m_lineEdit( 0L ) {}
253  TDEUI_EXPORT CustomEditor( TQWidget *repWidget, KLineEdit *edit )
254  : m_representationWidget( repWidget ),
255  m_lineEdit( edit ) {}
256  TDEUI_EXPORT CustomEditor( KComboBox *combo );
257 
258  TDEUI_EXPORT void setRepresentationWidget( TQWidget *repWidget ) {
259  m_representationWidget = repWidget;
260  }
261  TDEUI_EXPORT void setLineEdit( KLineEdit *edit ) {
262  m_lineEdit = edit;
263  }
264 
265  TDEUI_EXPORT virtual TQWidget *representationWidget() const {
266  return m_representationWidget;
267  }
268  TDEUI_EXPORT virtual KLineEdit *lineEdit() const {
269  return m_lineEdit;
270  }
271 
272  protected:
273  TQWidget *m_representationWidget;
274  KLineEdit *m_lineEdit;
275  };
276 };
277 
278 #endif
279 
KEditListBox::upButton
TQPushButton * upButton() const
Return a pointer to the Up button.
Definition: keditlistbox.h:127
KEditListBox::listBox
TQListBox * listBox() const
Return a pointer to the embedded TQListBox.
Definition: keditlistbox.h:111
KEditListBox::insertItem
void insertItem(const TQString &text, int index=-1)
See TQListBox::insertItem()
Definition: keditlistbox.h:156
KEditListBox::addButton
TQPushButton * addButton() const
Return a pointer to the Add button.
Definition: keditlistbox.h:119
KEditListBox::CustomEditor
Custom editor class.
Definition: keditlistbox.h:247
KEditListBox::currentText
TQString currentText() const
See TQListBox::currentText()
Definition: keditlistbox.h:172
KEditListBox::count
int count() const
See TQListBox::count()
Definition: keditlistbox.h:136
KEditListBox::downButton
TQPushButton * downButton() const
Return a pointer to the Down button.
Definition: keditlistbox.h:131
KEditListBox::Button
Button
Enumeration of the buttons, the listbox offers.
Definition: keditlistbox.h:62
KEditListBox::removeButton
TQPushButton * removeButton() const
Return a pointer to the Remove button.
Definition: keditlistbox.h:123
KEditListBox
An editable listbox.
Definition: keditlistbox.h:44
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:145
KEditListBox::text
TQString text(int index) const
See TQListBox::text()
Definition: keditlistbox.h:164
KComboBox
An enhanced combo box.
Definition: kcombobox.h:151
KEditListBox::lineEdit
KLineEdit * lineEdit() const
Return a pointer to the embedded TQLineEdit.
Definition: keditlistbox.h:115

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.