.TH "KCompletionBox" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KCompletionBox \- A little utility class for 'completion-widgets', like \fBKLineEdit\fP or \fBKComboBox\fP. A helper widget for 'completion-widgets' (\fBKLineEdit\fP, \fBKComboBox\fP)).  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kcompletionbox.h>\fP
.PP
Inherits \fBKListBox\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "\fBQStringList\fP \fBitems\fP () const "
.br
.RI "\fIReturns a list of all items currently in the box. \fP"
.ti -1c
.RI "void \fBinsertItems\fP (const  \fBQStringList\fP &items, int \fBindex\fP=-1)"
.br
.RI "\fIInserts \fCitems\fP into the box. \fP"
.ti -1c
.RI "void \fBsetItems\fP (const  \fBQStringList\fP &items)"
.br
.RI "\fIClears the box and inserts \fCitems\fP. \fP"
.ti -1c
.RI "virtual void \fBpopup\fP ()"
.br
.RI "\fIAdjusts the size of the box to fit the width of the parent given in the constructor and pops it up at the most appropriate place, relative to the parent. \fP"
.ti -1c
.RI "void \fBsetTabHandling\fP (bool enable)"
.br
.RI "\fIMakes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list. \fP"
.ti -1c
.RI "bool \fBisTabHandling\fP () const "
.br
.ti -1c
.RI "void \fBsetCancelledText\fP (const  \fBQString\fP &)"
.br
.RI "\fISets the text to be emitted if the user chooses not to pick from the available matches. \fP"
.ti -1c
.RI "\fBQString\fP \fBcancelledText\fP () const "
.br
.ti -1c
.RI "void \fBdown\fP ()"
.br
.RI "\fIMoves the selection one line down or select the first item if nothing is selected yet. \fP"
.ti -1c
.RI "void \fBup\fP ()"
.br
.RI "\fIMoves the selection one line up or select the first item if nothing is selected yet. \fP"
.ti -1c
.RI "void \fBpageDown\fP ()"
.br
.RI "\fIMoves the selection one page down. \fP"
.ti -1c
.RI "void \fBpageUp\fP ()"
.br
.RI "\fIMoves the selection one page up. \fP"
.ti -1c
.RI "void \fBhome\fP ()"
.br
.RI "\fIMoves the selection up to the first item. \fP"
.ti -1c
.RI "void \fBend\fP ()"
.br
.RI "\fIMoves the selection down to the last item. \fP"
.ti -1c
.RI "virtual void \fBshow\fP ()"
.br
.RI "\fIRe-implemented for internal reasons. \fP"
.ti -1c
.RI "virtual void \fBhide\fP ()"
.br
.RI "\fIRe-implemented for internal reasons. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBactivated\fP (const  \fBQString\fP &)"
.br
.RI "\fIEmitted when an item was selected, contains the text of the selected item. \fP"
.ti -1c
.RI "void \fBuserCancelled\fP (const  \fBQString\fP &)"
.br
.RI "\fIEmitted whenever the user chooses to ignore the available selections and close the this box. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKCompletionBox\fP (\fBQWidget\fP *parent, const  char *name=0)"
.br
.RI "\fIConstructs a KCompletionBox. \fP"
.ti -1c
.RI "\fB~KCompletionBox\fP ()"
.br
.RI "\fIDestroys the box. \fP"
.ti -1c
.RI "virtual \fBQSize\fP \fBsizeHint\fP () const "
.br
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "virtual void \fBslotActivated\fP (\fBQListBoxItem\fP *)"
.br
.RI "\fICalled when an item was activated. \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual bool \fBeventFilter\fP (\fBQObject\fP *, \fBQEvent\fP *)"
.br
.RI "\fIReimplemented from \fBKListBox\fP to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc. \fP"
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
A little utility class for 'completion-widgets', like \fBKLineEdit\fP or \fBKComboBox\fP. A helper widget for 'completion-widgets' (\fBKLineEdit\fP, \fBKComboBox\fP)). 

KCompletionBox is a listbox, displayed as a rectangle without any window decoration, usually directly under the lineedit or combobox. It is filled with all possible matches for a completion, so the user can select the one he wants.
.PP
It is used when \fBKGlobalSettings::Completion\fP == CompletionPopup or CompletionPopupAuto.
.PP
\fBAuthor:\fP
.RS 4
Carsten Pfeiffer <pfeiffer@kde.org> 
.RE
.PP

.PP
Definition at line 41 of file kcompletionbox.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KCompletionBox::KCompletionBox (\fBQWidget\fP * parent, const char * name = 0)"
.PP
Constructs a KCompletionBox. The parent widget is used to give the focus back when pressing the up-button on the very first item. Definition at line 41 of file kcompletionbox.cpp.
.PP
References QListBox::clicked(), QListBox::currentChanged(), KListBox::doubleClicked(), KStdAccel::name(), QListBox::setColumnMode(), and slotActivated().
.SS "KCompletionBox::~\fBKCompletionBox\fP ()"
.PP
Destroys the box. Definition at line 71 of file kcompletionbox.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBQStringList\fP KCompletionBox::items () const\fC [slot]\fP"
.PP
Returns a list of all items currently in the box. Definition at line 77 of file kcompletionbox.cpp.
.PP
References QListBox::count(), and QListBox::text().
.SS "void KCompletionBox::insertItems (const \fBQStringList\fP & items, int index = -1)\fC [slot]\fP"
.PP
Inserts \fCitems\fP into the box. Does not clear the items before. \fCindex\fP determines at which position \fCitems\fP will be inserted. (defaults to appending them at the end) Definition at line 366 of file kcompletionbox.cpp.
.PP
References QListBox::insertStringList().
.SS "void KCompletionBox::setItems (const \fBQStringList\fP & items)\fC [slot]\fP"
.PP
Clears the box and inserts \fCitems\fP. Definition at line 375 of file kcompletionbox.cpp.
.PP
References QListBox::firstItem(), QListBox::insertItem(), QListBox::insertStringList(), QListBox::item(), QListBoxItem::next(), and QListBox::triggerUpdate().
.SS "void KCompletionBox::popup ()\fC [virtual, slot]\fP"
.PP
Adjusts the size of the box to fit the width of the parent given in the constructor and pops it up at the most appropriate place, relative to the parent. Depending on the screensize and the position of the parent, this may be a different place, however the default is to pop it up and the lower left corner of the parent.
.PP
Make sure to \fBhide()\fP the box when appropriate. Definition at line 219 of file kcompletionbox.cpp.
.PP
References QListBox::clearSelection(), QListBox::count(), QListBox::ensureCurrentVisible(), QSize::height(), hide(), QListBox::setCurrentItem(), and show().
.SS "void KCompletionBox::setTabHandling (bool enable)\fC [slot]\fP"
.PP
Makes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list. Default off, as it conflicts with the usual behavior of Tab to traverse widgets. It is useful for cases like Konqueror's Location Bar, though.
.PP
\fBSee also:\fP
.RS 4
\fBisTabHandling\fP 
.RE
.PP
Definition at line 331 of file kcompletionbox.cpp.
.SS "bool KCompletionBox::isTabHandling () const\fC [slot]\fP"
.PP
\fBReturns:\fP
.RS 4
true if this widget is handling Tab-key events to traverse the items in the dropdown list, otherwise false.
.RE
.PP
Default is false.
.PP
\fBSee also:\fP
.RS 4
\fBsetTabHandling\fP 
.RE
.PP
Definition at line 336 of file kcompletionbox.cpp.
.SS "void KCompletionBox::setCancelledText (const \fBQString\fP &)\fC [slot]\fP"
.PP
Sets the text to be emitted if the user chooses not to pick from the available matches. If the cancelled text is not set through this function, the \fBuserCancelled\fP signal will not be emitted.
.PP
\fBSee also:\fP
.RS 4
\fBuserCancelled( const QString& )\fP 
.RE
.PP
\fBParameters:\fP
.RS 4
\fItxt\fP the text to be emitted if the user cancels this box 
.RE
.PP
Definition at line 341 of file kcompletionbox.cpp.
.SS "\fBQString\fP KCompletionBox::cancelledText () const\fC [slot]\fP"
.PP
\fBReturns:\fP
.RS 4
the text set via \fBsetCancelledText\fP() or QString::null. 
.RE
.PP
Definition at line 346 of file kcompletionbox.cpp.
.SS "void KCompletionBox::down ()\fC [slot]\fP"
.PP
Moves the selection one line down or select the first item if nothing is selected yet. Definition at line 286 of file kcompletionbox.cpp.
.PP
References QListBox::count(), QListBox::currentItem(), QListBox::currentText(), QListBox::highlighted(), QListBox::setCurrentItem(), and QListBox::setSelected().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::up ()\fC [slot]\fP"
.PP
Moves the selection one line up or select the first item if nothing is selected yet. Definition at line 301 of file kcompletionbox.cpp.
.PP
References QListBox::currentItem(), and QListBox::setCurrentItem().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::pageDown ()\fC [slot]\fP"
.PP
Moves the selection one page down. Definition at line 307 of file kcompletionbox.cpp.
.PP
References QListBox::count(), QListBox::currentItem(), QListBox::numItemsVisible(), and QListBox::setCurrentItem().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::pageUp ()\fC [slot]\fP"
.PP
Moves the selection one page up. Definition at line 314 of file kcompletionbox.cpp.
.PP
References QListBox::currentItem(), QListBox::numItemsVisible(), and QListBox::setCurrentItem().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::home ()\fC [slot]\fP"
.PP
Moves the selection up to the first item. Definition at line 321 of file kcompletionbox.cpp.
.PP
References QListBox::setCurrentItem().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::end ()\fC [slot]\fP"
.PP
Moves the selection down to the last item. Definition at line 326 of file kcompletionbox.cpp.
.PP
References QListBox::count(), and QListBox::setCurrentItem().
.PP
Referenced by eventFilter().
.SS "void KCompletionBox::show ()\fC [virtual, slot]\fP"
.PP
Re-implemented for internal reasons. API is unaffected. Definition at line 237 of file kcompletionbox.cpp.
.PP
References QRect::bottom(), QApplication::desktop(), KIO::move(), QRect::right(), QPoint::x(), and QPoint::y().
.PP
Referenced by popup().
.SS "void KCompletionBox::hide ()\fC [virtual, slot]\fP"
.PP
Re-implemented for internal reasons. API is unaffected. Definition at line 267 of file kcompletionbox.cpp.
.PP
Referenced by eventFilter(), popup(), and slotActivated().
.SS "void KCompletionBox::activated (const \fBQString\fP &)\fC [signal]\fP"
.PP
Emitted when an item was selected, contains the text of the selected item. Referenced by slotActivated().
.SS "void KCompletionBox::userCancelled (const \fBQString\fP &)\fC [signal]\fP"
.PP
Emitted whenever the user chooses to ignore the available selections and close the this box. 
.SS "bool KCompletionBox::eventFilter (\fBQObject\fP *, \fBQEvent\fP *)\fC [protected, virtual]\fP"
.PP
Reimplemented from \fBKListBox\fP to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc. Definition at line 95 of file kcompletionbox.cpp.
.PP
References QKeyEvent::accept(), down(), end(), hide(), home(), QKeyEvent::key(), KIO::move(), pageDown(), pageUp(), QMouseEvent::pos(), QKeyEvent::state(), QEvent::type(), and up().
.SS "void KCompletionBox::slotActivated (\fBQListBoxItem\fP *)\fC [protected, virtual, slot]\fP"
.PP
Called when an item was activated. Emits \fBactivated\fP() with the item. Definition at line 86 of file kcompletionbox.cpp.
.PP
References activated(), hide(), and QListBoxItem::text().
.PP
Referenced by KCompletionBox().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
