.TH "KCompletionBase" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KCompletionBase \- An abstract base class for adding a completion feature into widgets. An abstract class for adding text completion support to widgets.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kcompletion.h>\fP
.PP
Inherited by \fBKComboBox\fP, and \fBKLineEdit\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "typedef \fBQMap\fP< \fBKeyBindingType\fP, \fBKShortcut\fP > \fBKeyBindingMap\fP"
.br
.ti -1c
.RI "enum \fBKeyBindingType\fP { \fBTextCompletion\fP, \fBPrevCompletionMatch\fP, \fBNextCompletionMatch\fP, \fBSubstringCompletion\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKCompletionBase\fP ()"
.br
.ti -1c
.RI "virtual \fB~KCompletionBase\fP ()"
.br
.ti -1c
.RI "\fBKCompletion\fP * \fBcompletionObject\fP (bool hsig=true)"
.br
.ti -1c
.RI "virtual void \fBsetCompletionObject\fP (\fBKCompletion\fP *compObj, bool hsig=true)"
.br
.ti -1c
.RI "virtual void \fBsetHandleSignals\fP (bool handle)"
.br
.ti -1c
.RI "bool \fBisCompletionObjectAutoDeleted\fP () const "
.br
.ti -1c
.RI "void \fBsetAutoDeleteCompletionObject\fP (bool autoDelete)"
.br
.ti -1c
.RI "void \fBsetEnableSignals\fP (bool enable)"
.br
.ti -1c
.RI "bool \fBhandleSignals\fP () const "
.br
.ti -1c
.RI "bool \fBemitSignals\fP () const "
.br
.ti -1c
.RI "virtual void \fBsetCompletionMode\fP (\fBKGlobalSettings::Completion\fP mode)"
.br
.ti -1c
.RI "\fBKGlobalSettings::Completion\fP \fBcompletionMode\fP () const "
.br
.ti -1c
.RI "bool \fBsetKeyBinding\fP (\fBKeyBindingType\fP item, const \fBKShortcut\fP &key)"
.br
.ti -1c
.RI "const \fBKShortcut\fP & \fBgetKeyBinding\fP (\fBKeyBindingType\fP item) const "
.br
.ti -1c
.RI "void \fBuseGlobalKeyBindings\fP ()"
.br
.ti -1c
.RI "virtual void \fBsetCompletedText\fP (const \fBQString\fP &text)=0"
.br
.ti -1c
.RI "virtual void \fBsetCompletedItems\fP (const \fBQStringList\fP &items)=0"
.br
.ti -1c
.RI "\fBKCompletion\fP * \fBcompObj\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBKeyBindingMap\fP \fBgetKeyBindings\fP () const "
.br
.ti -1c
.RI "void \fBsetDelegate\fP (\fBKCompletionBase\fP *delegate)"
.br
.ti -1c
.RI "\fBKCompletionBase\fP * \fBdelegate\fP () const "
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
An abstract base class for adding a completion feature into widgets. An abstract class for adding text completion support to widgets. 

This is a convenience class that provides the basic functions needed to add text completion support into widgets. All that is required is an implementation for the pure virtual function setCompletedText. Refer to \fBKLineEdit\fP or \fBKComboBox\fP to see how easily such support can be added using this as a base class.
.PP
\fBAuthor:\fP
.RS 4
Dawit Alemayehu <adawit@kde.org> 
.RE
.PP

.PP
Definition at line 663 of file kcompletion.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKCompletionBase::KeyBindingType\fP"
.PP
Constants that represent the items whose short-cut key-binding is programmable. 
.PP
The default key-bindings for these items are defined in \fBKStdAccel\fP. 
.PP
\fBEnumeration values: \fP
.in +1c
.TP
\fB\fITextCompletion \fP\fP
Text completion (by default Ctrl-E). 
.TP
\fB\fIPrevCompletionMatch \fP\fP
Switch to previous completion (by default Ctrl-Up). 
.TP
\fB\fINextCompletionMatch \fP\fP
Switch to next completion (by default Ctrl-Down). 
.TP
\fB\fISubstringCompletion \fP\fP
Substring completion (by default Ctrl-T). 
.PP
Definition at line 671 of file kcompletion.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KCompletionBase::KCompletionBase ()"
.PP
Default constructor. 
.PP
Definition at line 25 of file kcompletionbase.cpp.
.PP
References KGlobalSettings::completionMode(), and useGlobalKeyBindings().
.SS "KCompletionBase::~\fBKCompletionBase\fP ()\fC [virtual]\fP"
.PP
Destructor. 
.PP
Definition at line 41 of file kcompletionbase.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBKCompletion\fP * KCompletionBase::completionObject (bool hsig = \fCtrue\fP)"
.PP
Returns a pointer to the current completion object. 
.PP
If the completion object does not exist, it is automatically created and by default handles all the completion signals internally unless \fChsig\fP is set to false. It is also automatically destroyed when the destructor is called. You can change this default behavior using the \fBsetAutoDeleteCompletionObject\fP and \fBsetHandleSignals\fP member functions.
.PP
See also \fBcompObj\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhsig\fP if true, handles completion signals internally. 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer the completion object. 
.RE
.PP

.PP
Definition at line 62 of file kcompletionbase.cpp.
.PP
References setCompletionObject().
.SS "void KCompletionBase::setCompletionObject (\fBKCompletion\fP * compObj, bool hsig = \fCtrue\fP)\fC [virtual]\fP"
.PP
Sets up the completion object to be used. 
.PP
This method assigns the completion object and sets it up to automatically handle the completion and rotation signals internally. You should use this function if you want to share one completion object among your widgets or need to use a customized completion object.
.PP
The object assigned through this method is not deleted when this object's destructor is invoked unless you explicitly call \fBsetAutoDeleteCompletionObject\fP after calling this method. Be sure to set the bool argument to false, if you want to handle the completion signals yourself.
.PP
\fBParameters:\fP
.RS 4
\fIcompObj\fP a KCompletion() or a derived child object. 
.br
\fIhsig\fP if true, handles completion signals internally. 
.RE
.PP

.PP
Reimplemented in \fBKLineEdit\fP.
.PP
Definition at line 75 of file kcompletionbase.cpp.
.PP
References compObj(), and QGuardedPtr::isNull().
.PP
Referenced by completionObject().
.SS "void KCompletionBase::setHandleSignals (bool handle)\fC [virtual]\fP"
.PP
Enables this object to handle completion and rotation events internally. 
.PP
This function simply assigns a boolean value that indicates whether it should handle rotation and completion events or not. Note that this does not stop the object from emitting signals when these events occur.
.PP
\fBParameters:\fP
.RS 4
\fIhandle\fP if true, handle completion & rotation internally. 
.RE
.PP

.PP
Definition at line 93 of file kcompletionbase.cpp.
.SS "bool KCompletionBase::isCompletionObjectAutoDeleted () const\fC [inline]\fP"
.PP
Returns true if the completion object is deleted upon this widget's destruction. 
.PP
See \fBsetCompletionObject()\fP and enableCompletion() for details.
.PP
\fBReturns:\fP
.RS 4
true if the completion object will be deleted automatically 
.RE
.PP

.PP
Definition at line 763 of file kcompletion.h.
.SS "void KCompletionBase::setAutoDeleteCompletionObject (bool autoDelete)\fC [inline]\fP"
.PP
Sets the completion object when this widget's destructor is called. 
.PP
If the argument is set to true, the completion object is deleted when this widget's destructor is called.
.PP
\fBParameters:\fP
.RS 4
\fIautoDelete\fP if true, delete completion object on destruction. 
.RE
.PP

.PP
Definition at line 776 of file kcompletion.h.
.SS "void KCompletionBase::setEnableSignals (bool enable)\fC [inline]\fP"
.PP
Sets the widget's ability to emit text completion and rotation signals. 
.PP
Invoking this function with \fCenable\fP set to \fCfalse\fP will cause the completion & rotation signals not to be emitted. However, unlike setting the completion object to \fCNULL\fP using setCompletionObject, disabling the emition of the signals through this method does not affect the current completion object.
.PP
There is no need to invoke this function by default. When a completion object is created through completionObject or setCompletionObject, these signals are set to emit automatically. Also note that disabling this signals will not necessarily interfere with the objects ability to handle these events internally. See setHandleSignals.
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if false, disables the emition of completion & rotation signals. 
.RE
.PP

.PP
Definition at line 803 of file kcompletion.h.
.SS "bool KCompletionBase::handleSignals () const\fC [inline]\fP"
.PP
Returns true if the object handles the signals. 
.PP
\fBReturns:\fP
.RS 4
true if this signals are handled internally. 
.RE
.PP

.PP
Definition at line 815 of file kcompletion.h.
.SS "bool KCompletionBase::emitSignals () const\fC [inline]\fP"
.PP
Returns true if the object emits the signals. 
.PP
\fBReturns:\fP
.RS 4
true if signals are emitted 
.RE
.PP

.PP
Definition at line 822 of file kcompletion.h.
.SS "void KCompletionBase::setCompletionMode (\fBKGlobalSettings::Completion\fP mode)\fC [virtual]\fP"
.PP
Sets the type of completion to be used. 
.PP
The completion modes supported are those defined in KGlobalSettings(). See below.
.PP
\fBParameters:\fP
.RS 4
\fImode\fP Completion type: 
.PD 0

.IP "\(bu" 2
CompletionNone: Disables completion feature. 
.IP "\(bu" 2
CompletionAuto: Attempts to find a match & fills-in the remaining text. 
.IP "\(bu" 2
CompletionMan: Acts the same as the above except the action has to be manually triggered through pre-defined completion key. 
.IP "\(bu" 2
CompletionShell: Mimics the completion feature found in typical *nix shell environments. 
.IP "\(bu" 2
CompletionPopup: Shows all available completions at once, in a listbox popping up. 
.PP
.RE
.PP

.PP
Reimplemented in \fBKLineEdit\fP.
.PP
Definition at line 101 of file kcompletionbase.cpp.
.SS "\fBKGlobalSettings::Completion\fP KCompletionBase::completionMode () const\fC [inline]\fP"
.PP
Returns the current completion mode. 
.PP
The return values are of type \fBKGlobalSettings::Completion\fP. See \fBsetCompletionMode()\fP for details.
.PP
\fBReturns:\fP
.RS 4
the completion mode. 
.RE
.PP

.PP
Definition at line 854 of file kcompletion.h.
.SS "bool KCompletionBase::setKeyBinding (\fBKeyBindingType\fP item, const \fBKShortcut\fP & key)"
.PP
Sets the key-binding to be used for manual text completion, text rotation in a history list as well as a completion list. 
.PP
When the keys set by this function are pressed, a signal defined by the inheriting widget will be activated. If the default value or 0 is specified by the second parameter, then the key-binding as defined in the global setting should be used. This method returns false value for \fCkey\fP is negative or the supplied key-binding conflicts with the ones set for one of the other features.
.PP
NOTE: To use a modifier key (Shift, Ctrl, Alt) as part of the key-binding simply simply \fCsum\fP up the values of the modifier and the actual key. For example, to use CTRL+E as a key binding for one of the items, you would simply supply \fC'Qt::CtrlButton + Qt::Key_E'\fP as the second argument to this function.
.PP
\fBParameters:\fP
.RS 4
\fIitem\fP the feature whose key-binding needs to be set: 
.PD 0

.IP "\(bu" 2
TextCompletion the manual completion key-binding. 
.IP "\(bu" 2
PrevCompletionMatch the previous match key for multiple completion. 
.IP "\(bu" 2
NextCompletionMatch the next match key for for multiple completion. 
.IP "\(bu" 2
SubstringCompletion the key for substring completion 
.PP
.br
\fIkey\fP key-binding used to rotate down in a list. 
.RE
.PP
\fBReturns:\fP
.RS 4
true if key-binding can successfully be set. 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBgetKeyBinding\fP 
.RE
.PP

.PP
Definition at line 115 of file kcompletionbase.cpp.
.PP
References QMap::begin(), QMap::end(), and QMap::replace().
.SS "const \fBKShortcut\fP& KCompletionBase::getKeyBinding (\fBKeyBindingType\fP item) const\fC [inline]\fP"
.PP
Returns the key-binding used for the specified item. 
.PP
This methods returns the key-binding used to activate the feature feature given by \fCitem\fP. If the binding contains modifier key(s), the SUM of the modifier key and the actual key code are returned.
.PP
\fBParameters:\fP
.RS 4
\fIitem\fP the item to check 
.RE
.PP
\fBReturns:\fP
.RS 4
the key-binding used for the feature given by \fCitem\fP. 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsetKeyBinding\fP 
.RE
.PP

.PP
Definition at line 902 of file kcompletion.h.
.SS "void KCompletionBase::useGlobalKeyBindings ()"
.PP
Sets this object to use global values for key-bindings. 
.PP
This method changes the values of the key bindings for rotation and completion features to the default values provided in \fBKGlobalSettings\fP.
.PP
NOTE: By default inheriting widgets should uses the global key-bindings so that there will be no need to call this method. 
.PP
Definition at line 130 of file kcompletionbase.cpp.
.PP
References QMap::clear(), QMap::insert(), NextCompletionMatch, PrevCompletionMatch, SubstringCompletion, and TextCompletion.
.PP
Referenced by KCompletionBase().
.SS "virtual void KCompletionBase::setCompletedText (const \fBQString\fP & text)\fC [pure virtual]\fP"
.PP
A pure virtual function that must be implemented by all inheriting classes. 
.PP
This function is intended to allow external completion implementations to set completed text appropriately. It is mostly relevant when the completion mode is set to CompletionAuto and CompletionManual modes. See \fBKCompletionBase::setCompletedText\fP. Does nothing in CompletionPopup mode, as all available matches will be shown in the popup.
.PP
\fBParameters:\fP
.RS 4
\fItext\fP the completed text to be set in the widget. 
.RE
.PP

.PP
Implemented in \fBKComboBox\fP, and \fBKLineEdit\fP.
.SS "virtual void KCompletionBase::setCompletedItems (const \fBQStringList\fP & items)\fC [pure virtual]\fP"
.PP
A pure virtual function that must be implemented by all inheriting classes. 
.PP
\fBParameters:\fP
.RS 4
\fIitems\fP the list of completed items 
.RE
.PP

.PP
Implemented in \fBKComboBox\fP, and \fBKLineEdit\fP.
.SS "\fBKCompletion\fP* KCompletionBase::compObj () const\fC [inline]\fP"
.PP
Returns a pointer to the completion object. 
.PP
This method is only different from \fBcompletionObject()\fP in that it does not create a new \fBKCompletion\fP object even if the internal pointer is \fCNULL\fP. Use this method to get the pointer to a completion object when inheriting so that you won't inadvertently create it!!
.PP
\fBReturns:\fP
.RS 4
the completion object or NULL if one does not exist. 
.RE
.PP

.PP
Definition at line 953 of file kcompletion.h.
.PP
Referenced by setCompletionObject().
.SS "\fBKeyBindingMap\fP KCompletionBase::getKeyBindings () const\fC [inline, protected]\fP"
.PP
Returns a key-binding map. 
.PP
This method is the same as \fBgetKeyBinding()\fP except it returns the whole keymap containing the key-bindings.
.PP
\fBReturns:\fP
.RS 4
the key-binding used for the feature given by \fCitem\fP. 
.RE
.PP

.PP
Definition at line 964 of file kcompletion.h.
.SS "void KCompletionBase::setDelegate (\fBKCompletionBase\fP * delegate)\fC [protected]\fP"
.PP
Sets or removes the delegation object. 
.PP
If a delegation object is set, all function calls will be forwarded to the delegation object. 
.PP
\fBParameters:\fP
.RS 4
\fIdelegate\fP the delegation object, or 0 to remove it 
.RE
.PP

.PP
Definition at line 49 of file kcompletionbase.cpp.
.PP
References delegate(), m_bAutoDelCompObj, m_bEmitSignals, m_bHandleSignals, m_iCompletionMode, and m_keyMap.
.SS "\fBKCompletionBase\fP* KCompletionBase::delegate () const\fC [inline, protected]\fP"
.PP
Returns the delegation object. 
.PP
\fBReturns:\fP
.RS 4
the delegation object, or 0 if there is none 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsetDelegate()\fP 
.RE
.PP

.PP
Definition at line 978 of file kcompletion.h.
.PP
Referenced by setDelegate().

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