<HTML> <HEAD> <TITLE>class KCompletionBase</TITLE> <META NAME="Generator" CONTENT="KDOC "> </HEAD> <BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff"> <TABLE WIDTH="100%" BORDER="0"> <TR> <TD> <TABLE BORDER="0"> <TR><TD valign="top" align="left" cellspacing="10"> <h1>class KCompletionBase</h1> </TD> <TD valign="top" align="right" colspan="1">An abstract class for adding text completion support to widgets. <small><A HREF="#longdesc">More...</A></small></TD></TR> </TABLE> <HR> <TABLE BORDER="0"> <TR><TH colspan="2">Contains pure virtuals</TH></TR><TR><TH>Definition</TH><TD><code>#include <<A HREF="kcompletion_h.html">kcompletion.h</A>></code></TD></TR> <TR><TH><A HREF="full-list-KCompletionBase.html">List of all Methods</A></TH></TR> </TABLE> </TD> <TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR> <TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR> <TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR> <TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR> <TR><TD><small><A HREF="index.html">Index</A></small></TD></TR> </TABLE></TD></TR></TABLE> <h4>Public Types</h4><ul><LI>enum <A HREF="#ref1">KeyBindingType</A> { TextCompletion, PrevCompletionMatch, NextCompletionMatch } </LI> <LI>typedef QMap<KeyBindingType, int> <A HREF="#ref2">KeyBindingMap</A> </LI> </ul><h4>Public Methods</h4><ul><LI> <b><A HREF="#ref3">KCompletionBase</A></b> () </LI> <LI>virtual <b><A HREF="#ref4">~KCompletionBase</A></b> () </LI> <LI><A HREF="KCompletion.html">KCompletion</A>* <b><A HREF="#ref5">completionObject</A></b> ( bool hsig = true ) </LI> <LI><A HREF="KCompletion.html">KCompletion</A>* <b><A HREF="#ref6">completionObject</A></b> ( bool create, bool hsig ) </LI> <LI>virtual void <b><A HREF="#ref7">setCompletionObject</A></b> ( <A HREF="KCompletion.html">KCompletion</A>* , bool hsig = true ) </LI> <LI>virtual void <b><A HREF="#ref8">setHandleSignals</A></b> ( bool ) </LI> <LI>bool <b><A HREF="#ref9">isCompletionObjectAutoDeleted</A></b> () const </LI> <LI>void <b><A HREF="#ref10">setAutoDeleteCompletionObject</A></b> ( bool autoDelete ) </LI> <LI>void <b><A HREF="#ref11">setEnableSignals</A></b> ( bool enable ) </LI> <LI>bool <b><A HREF="#ref12">handleSignals</A></b> () const </LI> <LI>bool <b><A HREF="#ref13">emitSignals</A></b> () const </LI> <LI>virtual void <b><A HREF="#ref14">setCompletionMode</A></b> ( <A HREF="KGlobalSettings.html#Completion">KGlobalSettings::Completion</A> mode ) </LI> <LI><A HREF="KGlobalSettings.html#Completion">KGlobalSettings::Completion</A> <b><A HREF="#ref15">completionMode</A></b> () const </LI> <LI>bool <b><A HREF="#ref16">setKeyBinding</A></b> ( KeyBindingType , int key = 0 ) </LI> <LI>int <b><A HREF="#ref17">getKeyBinding</A></b> ( KeyBindingType item ) const </LI> <LI>void <b><A HREF="#ref18">useGlobalKeyBindings</A></b> () </LI> <LI>virtual void <b><i><A HREF="#ref19">setCompletedText</A></i></b> ( const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A>& ) </LI> </ul><h4>Protected Methods</h4><ul><LI><A HREF="KCompletion.html">KCompletion</A>* <b><A HREF="#ref20">compObj</A></b> () </LI> <LI>KeyBindingMap <b><A HREF="#ref21">getKeyBindings</A></b> () const </LI> </ul><HR><H2><A NAME="longdesc">Detailed Description</A></H2><p> An abstract base class for adding a completion feature into widgets. </p> <p> This is a convienence 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 setCompletionText. Refer to KLineEdit or KComboBox to see how easily such support can be added using this as a base class. </p> <p></p> <A NAME="KeyBindingType"></A><A NAME="ref1"></A><table width="100%"><tr bgcolor="#eeeeee"><td>enum <strong>KeyBindingType</strong> { TextCompletion, PrevCompletionMatch, NextCompletionMatch } </td><td align="right"><h3><strong>KeyBindingType</strong></h3></td></tr></table><p></p><p> Constants that represent the items whose short-cut key-binding is programmable. The default key-bindings for these items are defined in <A HREF="KStdAccel.html">KStdAccel</A>(). </p> <A NAME="KeyBindingMap"></A><A NAME="ref2"></A><table width="100%"><tr bgcolor="#eeeeee"><td>typedef <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qmap.html">QMap</A><KeyBindingType, int> <strong>KeyBindingMap</strong></td><td align="right"><h3><strong>KeyBindingMap</strong></h3></td></tr></table><p></p><A NAME="KCompletionBase"></A><A NAME="ref3"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>KCompletionBase</strong> () <br></td><td align="right"><h3><strong>KCompletionBase</strong></h3></td></tr></table><p></p><p> Default constructor. </p> <A NAME="~KCompletionBase"></A><A NAME="ref4"></A><table width="100%"><tr bgcolor="#eeeeee"><td> <strong>~KCompletionBase</strong> () <br></td><td align="right"><h3><strong>~KCompletionBase</strong></h3></td></tr></table><p> <small>[virtual]</small></p><p> Destructor. </p> <A NAME="completionObject"></A><A NAME="ref5"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="KCompletion.html">KCompletion</A>* <strong>completionObject</strong> ( bool hsig = true ) <br></td><td align="right"><h3><strong>completionObject</strong></h3></td></tr></table><p></p><p> Returns a pointer to the current completion object. </p> <p> If the object does not exist, it is automatically created. Note that the completion object created here is used by default to handle the signals internally. It is also deleted when this object's destructor is invoked. If you do not want these default settings, use <A HREF="KCompletionBase.html#setAutoDeleteCompletionObject">setAutoDeleteCompletionObject</A> and <A HREF="KCompletionBase.html#setHandleSignals">setHandleSignals</A> to change the behavior. Alternatively, you can set the boolean parameter to false to disable the automatic handling of the signals by this object. Note that the boolean argument will be ignored if there already exists a completion object since no new object needs to be created. You need to use either <A HREF="KCompletionBase.html#setHandleSignals">setHandleSignals</A> or <A HREF="KCompletionBase.html#setCompletionObject">setCompletionObject</A> for such cases depending on your requirement. </p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>hsig</i></TD><TD align="left" valign="top">if true, handles signals internally. </TD></TR> </TABLE></P> <p><b>Returns</b>: a pointer the completion object. </p> <A NAME="completionObject"></A><A NAME="ref6"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="KCompletion.html">KCompletion</A>* <strong>completionObject</strong> ( bool create, bool hsig ) <br></td><td align="right"><h3><strong>completionObject</strong></h3></td></tr></table><p></p><p> Overloaded method to specify whether a completion-object should be created or not. If <code>create</code> is set to false and there is no completion-object yet, 0L will be returned. </p> <A NAME="setCompletionObject"></A><A NAME="ref7"></A><table width="100%"><tr bgcolor="#eeeeee"><td> void <strong>setCompletionObject</strong> ( <A HREF="KCompletion.html">KCompletion</A>* , bool hsig = true ) <br></td><td align="right"><h3><strong>setCompletionObject</strong></h3></td></tr></table><p> <small>[virtual]</small></p><p> Sets up the completion object to be used. </p> <p> 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 you widgets or need to use a customized completion object. </p> <p> The object assigned through this method is not deleted when this object's destructor is invoked unless you explicitly call <A HREF="KCompletionBase.html#setAutoDeleteCompletionObject">setAutoDeleteCompletionObject</A> after calling this method. Also if you do not want the signals to be handled by an internal implementation, be sure to set the bool argument to false. </p> <p> This method is also called when a completion-object is created automatically, when completionObject() is called the first time. </p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>compObj</i></TD><TD align="left" valign="top">a <A HREF="KCompletion.html">KCompletion</A>() or a derived child object. </TD></TR> <TR><TD align="left" valign="top"><i>hsig</i></TD><TD align="left" valign="top">if true, handles signals internally. </TD></TR> </TABLE></P> <A NAME="setHandleSignals"></A><A NAME="ref8"></A><table width="100%"><tr bgcolor="#eeeeee"><td> void <strong>setHandleSignals</strong> ( bool ) <br></td><td align="right"><h3><strong>setHandleSignals</strong></h3></td></tr></table><p> <small>[virtual]</small></p><p> Enables this object to handle completion and rotation events internally. </p> <p> 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. </p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>handle</i></TD><TD align="left" valign="top">if true, handle completion & rotation internally. </TD></TR> </TABLE></P> <A NAME="isCompletionObjectAutoDeleted"></A><A NAME="ref9"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool <strong>isCompletionObjectAutoDeleted</strong> () <br></td><td align="right"><h3><strong>isCompletionObjectAutoDeleted</strong></h3></td></tr></table><p> <small>[const]</small></p><p> Returns true if the completion object is deleted upon this widget's destruction. </p> <p> See <A HREF="KCompletionBase.html#setCompletionObject">setCompletionObject</A>() and enableCompletion() for details. </p> <p></p> <p><b>Returns</b>: true if the completion object </p> <A NAME="setAutoDeleteCompletionObject"></A><A NAME="ref10"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>setAutoDeleteCompletionObject</strong> ( bool autoDelete ) <br></td><td align="right"><h3><strong>setAutoDeleteCompletionObject</strong></h3></td></tr></table><p></p><p> Sets the completion object when this widget's destructor is called. </p> <p> If the argument is set to true, the completion object is deleted when this widget's destructor is called. </p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>autoDelete</i></TD><TD align="left" valign="top">if true, delete completion object on destruction. </TD></TR> </TABLE></P> <A NAME="setEnableSignals"></A><A NAME="ref11"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>setEnableSignals</strong> ( bool enable ) <br></td><td align="right"><h3><strong>setEnableSignals</strong></h3></td></tr></table><p></p><p> Sets the widget's ability to emit text completion and rotation signals. </p> <p> Invoking this function with <code>enable</code> set to <code>false</code> will cause the completion & rotation signals not to be emitted. However, unlike setting the completion object to <code>NULL</code> using <A HREF="KCompletionBase.html#setCompletionObject">setCompletionObject</A>, disabling the emition of the signals through this method does not affect the current completion object. </p> <p> There is no need to invoke this function by default. When a completion object is created through <A HREF="KCompletionBase.html#completionObject">completionObject</A> or <A HREF="KCompletionBase.html#setCompletionObject">setCompletionObject</A>, 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 <A HREF="KCompletionBase.html#setHandleSignals">setHandleSignals</A>. </p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>enable</i></TD><TD align="left" valign="top">if false, disables the emittion of completion & rotation signals. </TD></TR> </TABLE></P> <A NAME="handleSignals"></A><A NAME="ref12"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool <strong>handleSignals</strong> () <br></td><td align="right"><h3><strong>handleSignals</strong></h3></td></tr></table><p> <small>[const]</small></p><p> Returns true if the object handles the signals </p> <p></p> <p><b>Returns</b>: true if this signals are handled internally. </p> <A NAME="emitSignals"></A><A NAME="ref13"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool <strong>emitSignals</strong> () <br></td><td align="right"><h3><strong>emitSignals</strong></h3></td></tr></table><p> <small>[const]</small></p><p> Returns true if the object emits the signals </p> <p></p> <p><b>Returns</b>: true if signals are emitted </p> <A NAME="setCompletionMode"></A><A NAME="ref14"></A><table width="100%"><tr bgcolor="#eeeeee"><td> void <strong>setCompletionMode</strong> ( <A HREF="KGlobalSettings.html#Completion">KGlobalSettings::Completion</A> mode ) <br></td><td align="right"><h3><strong>setCompletionMode</strong></h3></td></tr></table><p> <small>[virtual]</small></p><p> Sets the type of completion to be used. </p> <p> The completion modes supported are those defined in <A HREF="KGlobalSettings.html">KGlobalSettings</A>(). See below. </p> <p></p> <ul> <li>CompletionNone: Disables completion feature. </li> <li>CompletionAuto: Attempts to find a match & fills-in the remaining text. </li> <li>CompletionMan: Acts the same as the above except the action has to be manually triggered through pre-defined completion key. </li> <li>CompletionShell: Mimics the completion feature found in typcial *nix shell enviornments. </li> <li>CompletionPopup: Shows all available completions at once, in a listbox popping up. </li> </ul> <p> </p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>mode</i></TD><TD align="left" valign="top">Completion type: </TD></TR> </TABLE></P> <A NAME="completionMode"></A><A NAME="ref15"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="KGlobalSettings.html#Completion">KGlobalSettings::Completion</A> <strong>completionMode</strong> () <br></td><td align="right"><h3><strong>completionMode</strong></h3></td></tr></table><p> <small>[const]</small></p><p> Retrieves the current completion mode. </p> <p> The return values are of type <A HREF="KGlobalSettings.html#Completion">KGlobalSettings::Completion</A>. See <A HREF="KCompletionBase.html#setCompletionMode">setCompletionMode</A>() for details. </p> <p></p> <p><b>Returns</b>: the completion mode. </p> <A NAME="setKeyBinding"></A><A NAME="ref16"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool <strong>setKeyBinding</strong> ( KeyBindingType , int key = 0 ) <br></td><td align="right"><h3><strong>setKeyBinding</strong></h3></td></tr></table><p></p><p> Sets the key-binding to be used for manual text completion, text rotation in a history list as well as a completion list. </p> <p></p> <p> When the keys set by this function are pressed, a signal defined by the inherting 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 <code>key</code> is negative or the supplied key-binding conflicts with the ones set for one of the other features. </p> <p> NOTE: To use a modifier key (Shift, Ctrl, Alt) as part of the key-binding simply simply <code>sum</code> 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 @p "Qt::CtrlButton + Qt::Key_E" as the second argument to this function. </p> <p></p> <p></p> <ul> <li>TextCompletion the manual completion key-binding. </li> <li>PrevCompletionMatch the previous match key for mutiple completion. </li> <li>NextCompletionMatch the next match key for for multiple completion. </li> </ul> <p> </p> <p></p> <p></p> <p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5"> <TR><TD align="left" valign="top"><i>item</i></TD><TD align="left" valign="top">the feature whose key-binding needs to be set: </TD></TR> <TR><TD align="left" valign="top"><i>key</i></TD><TD align="left" valign="top">key-binding used to rotate down in a list. </TD></TR> </TABLE></P> <p><b>Returns</b>: true if key-binding can successfully be set. </p> <A NAME="getKeyBinding"></A><A NAME="ref17"></A><table width="100%"><tr bgcolor="#eeeeee"><td>int <strong>getKeyBinding</strong> ( KeyBindingType item ) <br></td><td align="right"><h3><strong>getKeyBinding</strong></h3></td></tr></table><p> <small>[const]</small></p><p> Returns the key-binding used for the specified item. </p> <p> This methods returns the key-binding used to activate the feature feature given by <code>item</code>. If the binding contains modifier key(s), the SUM of the modifier key and the actual key code are returned. </p> <p></p> <p><b>Returns</b>: the key-binding used for the feature given by <code>item</code>. </p> <A NAME="useGlobalKeyBindings"></A><A NAME="ref18"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void <strong>useGlobalKeyBindings</strong> () <br></td><td align="right"><h3><strong>useGlobalKeyBindings</strong></h3></td></tr></table><p></p><p> Sets this object to use global values for key-bindings. </p> <p> This method changes the values of the key bindings for rotation and completion features to the default values provided in KGlobalSettings. </p> <p> NOTE: By default inheriting widgets should uses the global key-bindings so that there will be no need to call this method. </p> <A NAME="setCompletedText"></A><A NAME="ref19"></A><table width="100%"><tr bgcolor="#eeeeee"><td> void <i><strong>setCompletedText</strong></i> ( const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A>& ) <br></td><td align="right"><h3><i><strong>setCompletedText</strong></i></h3></td></tr></table><p> <small>[pure virtual]</small></p><A NAME="compObj"></A><A NAME="ref20"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="KCompletion.html">KCompletion</A>* <strong>compObj</strong> () <br></td><td align="right"><h3><strong>compObj</strong></h3></td></tr></table><p> <small>[protected]</small></p><p> Returns an instance of the completion object. </p> <p> This method is only different from <A HREF="KCompletionBase.html#completionObject">completionObject</A>() in that it does not create a new KCompletion object evenif the internal pointer is <code>NULL</code>. Use this method to get the pointer to a completion object when inheriting so that you won't inadvertantly create it!! </p> <p></p> <p><b>Returns</b>: the completion object or NULL if one does not exist. </p> <A NAME="getKeyBindings"></A><A NAME="ref21"></A><table width="100%"><tr bgcolor="#eeeeee"><td>KeyBindingMap <strong>getKeyBindings</strong> () <br></td><td align="right"><h3><strong>getKeyBindings</strong></h3></td></tr></table><p> <small>[protected const]</small></p><p> Returns a key-binding maps </p> <p> This method is the same as <A HREF="KCompletionBase.html#getKeyBinding">getKeyBinding</A>() except it returns the whole keymap containing the key-bindings. </p> <p></p> <p><b>Returns</b>: the key-binding used for the feature given by <code>item</code>. </p> <HR><UL><LI><i>Author</i>: Dawit Alemayehu <adawit@kde.org> </LI><LI><i>Generated</i>: qateam on updates.mandrakesoft.com on Mon Dec 30 16:08:56 2002, using kdoc 2.0a53.</LI></UL></BODY></HTML>