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

tdeui

  • tdeui
kcombobox.h
1/* This file is part of the KDE libraries
2
3 Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
4 Copyright (c) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License (LGPL) as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef _KCOMBOBOX_H
23#define _KCOMBOBOX_H
24
25#include <tqlineedit.h>
26#include <tqcombobox.h>
27#include <tqvbox.h>
28#include <tqlabel.h>
29#include <tqlayout.h>
30#include <tqtoolbutton.h>
31#include <tqheader.h>
32
33#include <kcompletion.h>
34#include <kdialogbase.h>
35#include <tdelistview.h>
36
37class TQListBoxItem;
38class TQPopupMenu;
39class TQLineEdit;
40
41class TDECompletionBox;
42class KURL;
43
151class TDEUI_EXPORT KComboBox : public TQComboBox, public TDECompletionBase
152{
153 TQ_OBJECT
154 TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
155 TQ_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
156 TQ_PROPERTY( bool urlDropsEnabled READ isURLDropsEnabled WRITE setURLDropsEnabled )
157 TQ_PROPERTY( bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey )
158
159public:
160
168 KComboBox( TQWidget *parent=0, const char *name=0 );
169
179 KComboBox( bool rw, TQWidget *parent=0, const char *name=0 );
180
184 virtual ~KComboBox();
185
191 void setEditURL( const KURL& url );
192
198 void insertURL( const KURL& url, int index = -1 );
199
206 void insertURL( const TQPixmap& pixmap, const KURL& url, int index = -1 );
207
213 void changeURL( const KURL& url, int index );
214
220 void changeURL( const TQPixmap& pixmap, const KURL& url, int index );
221
230 int cursorPosition() const { return ( lineEdit() ) ? lineEdit()->cursorPosition() : -1; }
231
242 virtual void setAutoCompletion( bool autocomplete );
243
253 bool autoCompletion() const {
254 return completionMode() == TDEGlobalSettings::CompletionAuto;
255 }
256
272 virtual void setContextMenuEnabled( bool showMenu );
273
277 bool isContextMenuEnabled() const { return m_bEnableMenu; }
278
286 void setURLDropsEnabled( bool enable );
287
291 bool isURLDropsEnabled() const;
292
302 bool contains( const TQString& text ) const;
303
317 void setTrapReturnKey( bool trap );
318
325 bool trapReturnKey() const;
326
330 virtual bool eventFilter( TQObject *, TQEvent * );
331
341 TDECompletionBox * completionBox( bool create = true );
342
349 virtual void setLineEdit( TQLineEdit * );
350
351signals:
357 void returnPressed();
358
368 void returnPressed( const TQString& );
369
378 void completion( const TQString& );
379
383 void substringCompletion( const TQString& );
384
396 void textRotation( TDECompletionBase::KeyBindingType );
397
402 void completionModeChanged( TDEGlobalSettings::Completion );
403
413 void aboutToShowContextMenu( TQPopupMenu * p );
414
415public slots:
416
434 void rotateText( TDECompletionBase::KeyBindingType type );
435
441 virtual void setCompletedText( const TQString& );
442
447 void setCompletedItems( const TQStringList& items );
448
454 void setCurrentItem( const TQString& item, bool insert = false, int index = -1 );
455
460 void setCurrentItem(int index) { TQComboBox::setCurrentItem(index); }
461
462protected slots:
463
467 virtual void itemSelected( TQListBoxItem* ) {}
468
480 virtual void makeCompletion( const TQString& );
481
482protected:
483 /*
484 * This function simply sets the lineedit text and
485 * highlights the text appropriately if the boolean
486 * value is set to true.
487 *
488 * @param
489 * @param
490 */
491 virtual void setCompletedText( const TQString& /* */, bool /*marked*/ );
492
496 virtual void create( WId = 0, bool initializeWindow = true,
497 bool destroyOldWindow = true );
498
499 virtual void wheelEvent( TQWheelEvent *ev );
500
501private slots:
502 void lineEditDeleted();
503
504private:
508 void init();
509 bool m_bEnableMenu; // ### BCI: unused, remove in KDE4
510 bool m_trapReturnKey; // ### BCI: unused, remove in KDE4
511
512protected:
513 virtual void virtual_hook( int id, void* data );
514
515private:
516 class KComboBoxPrivate;
517 KComboBoxPrivate* const d;
518};
519
520
521class KPixmapProvider;
522
540class TDEUI_EXPORT KHistoryCombo : public KComboBox
541{
542 TQ_OBJECT
543 TQ_PROPERTY( TQStringList historyItems READ historyItems WRITE setHistoryItems )
544
545public:
565 KHistoryCombo( TQWidget *parent = 0L, const char *name = 0L );
566
567 // ### merge these two constructors
574 KHistoryCombo( bool useCompletion,
575 TQWidget *parent = 0L, const char *name = 0L );
576
580 ~KHistoryCombo();
581
588 inline void setHistoryItems( TQStringList items ) {
589 setHistoryItems(items, false);
590 }
591
633 void setHistoryItems( TQStringList items, bool setCompletionList );
634
641 TQStringList historyItems() const;
642
650 bool removeFromHistory( const TQString& item );
651
664 void setPixmapProvider( KPixmapProvider *prov );
665
671 KPixmapProvider * pixmapProvider() const { return myPixProvider; }
672
677 void reset() { slotReset(); }
678
682 void setHistoryEditorEnabled( bool enable );
683 bool isHistoryEditorEnabled() const;
684
685public slots:
705 void addToHistory( const TQString& item );
706
710 void clearHistory();
711
712signals:
716 void cleared();
717
718 void removed( const TQString& item );
719
720protected:
724 virtual void keyPressEvent( TQKeyEvent * );
725
729 virtual void wheelEvent( TQWheelEvent *ev );
730
739 void insertItems( const TQStringList& items );
740
744 bool useCompletion() const { return compObj(); }
745
746private slots:
750 void slotReset();
751
756 void slotClear();
757
761 void slotEdit();
762
766 void addContextMenuItems( TQPopupMenu* );
767
768 void slotRemoveFromHistory( const TQString & );
769
770private:
771 void init( bool useCompletion );
772 void rotateUp();
773 void rotateDown();
774
778 int myIterateIndex;
779
783 TQString myText;
784
789 bool myRotated;
790 KPixmapProvider *myPixProvider;
791
792protected:
793 virtual void virtual_hook( int id, void* data );
794private:
795 class KHistoryComboPrivate;
796 KHistoryComboPrivate* const d;
797};
798
799class TDEUI_EXPORT KHistoryComboEditor : public KDialogBase
800{
801 TQ_OBJECT
802
803public:
804 KHistoryComboEditor( const TQStringList& entries, TQWidget *parent = 0L );
805 ~KHistoryComboEditor();
806
807signals:
808 void removeFromHistory( const TQString& );
809
810protected slots:
811 virtual void slotUser1(); // User1 is "Delete Entry" button
812 void slotSelectionChanged( TQListViewItem * item );
813
814protected:
815 virtual void virtual_hook( int id, void* data );
816
817private:
818 TDEListView *m_pListView;
819
820 class KHistoryComboEditorPrivate;
821 KHistoryComboEditorPrivate* const d;
822};
823
824#endif
825
KComboBox
An enhanced combo box.
Definition: kcombobox.h:152
KComboBox::returnPressed
void returnPressed(const TQString &)
Emitted when the user presses the Enter key.
KComboBox::completionModeChanged
void completionModeChanged(TDEGlobalSettings::Completion)
Emitted whenever the completion mode is changed by the user through the context menu.
KComboBox::aboutToShowContextMenu
void aboutToShowContextMenu(TQPopupMenu *p)
Emitted before the context menu is displayed.
KComboBox::autoCompletion
bool autoCompletion() const
Re-implemented from TQComboBox.
Definition: kcombobox.h:253
KComboBox::textRotation
void textRotation(TDECompletionBase::KeyBindingType)
Emitted when the text rotation key-bindings are pressed.
KComboBox::itemSelected
virtual void itemSelected(TQListBoxItem *)
Definition: kcombobox.h:467
KComboBox::isContextMenuEnabled
bool isContextMenuEnabled() const
Returns true when the context menu is enabled.
Definition: kcombobox.h:277
KComboBox::setCurrentItem
void setCurrentItem(int index)
Simply calls QComboBox' implementation.
Definition: kcombobox.h:460
KComboBox::cursorPosition
int cursorPosition() const
Returns the current cursor position.
Definition: kcombobox.h:230
KComboBox::substringCompletion
void substringCompletion(const TQString &)
Emitted when the shortcut for substring completion is pressed.
KComboBox::returnPressed
void returnPressed()
Emitted when the user presses the Enter key.
KComboBox::completion
void completion(const TQString &)
Emitted when the completion key is pressed.
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:192
KHistoryCombo
A combobox for offering a history and completion.
Definition: kcombobox.h:541
KHistoryCombo::useCompletion
bool useCompletion() const
Definition: kcombobox.h:744
KHistoryCombo::cleared
void cleared()
Emitted when the history was cleared by the entry in the popup menu.
KHistoryCombo::setHistoryItems
void setHistoryItems(TQStringList items)
Inserts items into the combobox.
Definition: kcombobox.h:588
KHistoryCombo::pixmapProvider
KPixmapProvider * pixmapProvider() const
Definition: kcombobox.h:671
KHistoryCombo::reset
void reset()
Resets the current position of the up/down history.
Definition: kcombobox.h:677
KPixmapProvider
KURL
TDECompletionBase
TDECompletionBase::compObj
TDECompletion * compObj() const
TDECompletionBase::completionMode
TDEGlobalSettings::Completion completionMode() const
TDECompletionBase::setCompletedItems
virtual void setCompletedItems(const TQStringList &items)=0
TDECompletionBase::setCompletedText
virtual void setCompletedText(const TQString &text)=0
TDECompletionBase::KeyBindingType
KeyBindingType
TDECompletionBox
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition: tdecompletionbox.h:44
TDEGlobalSettings::Completion
Completion
TDEGlobalSettings::CompletionAuto
CompletionAuto
TDEListView
This Widget extends the functionality of TQListView to honor the system wide settings for Single Clic...
Definition: tdelistview.h:85

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.