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

tdecore

Public Types | Public Member Functions | Protected Member Functions | List of all members
TDECompletionBase Class Referenceabstract

#include <kcompletion.h>

Inherited by KComboBox, and KLineEdit.

Public Types

enum  KeyBindingType { TextCompletion , PrevCompletionMatch , NextCompletionMatch , SubstringCompletion }
 
typedef TQMap< KeyBindingType, TDEShortcut > KeyBindingMap
 

Public Member Functions

 TDECompletionBase ()
 
virtual ~TDECompletionBase ()
 
TDECompletion * completionObject (bool hsig=true)
 
virtual void setCompletionObject (TDECompletion *compObj, bool hsig=true)
 
virtual void setHandleSignals (bool handle)
 
bool isCompletionObjectAutoDeleted () const
 
void setAutoDeleteCompletionObject (bool autoDelete)
 
void setEnableSignals (bool enable)
 
bool handleSignals () const
 
bool emitSignals () const
 
virtual void setCompletionMode (TDEGlobalSettings::Completion mode)
 
TDEGlobalSettings::Completion completionMode () const
 
bool setKeyBinding (KeyBindingType item, const TDEShortcut &key)
 
const TDEShortcut & getKeyBinding (KeyBindingType item) const
 
void useGlobalKeyBindings ()
 
virtual void setCompletedText (const TQString &text)=0
 
virtual void setCompletedItems (const TQStringList &items)=0
 
TDECompletion * compObj () const
 

Protected Member Functions

KeyBindingMap getKeyBindings () const
 
void setDelegate (TDECompletionBase *delegate)
 
TDECompletionBase * delegate () const
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

An abstract base class for adding a completion feature into 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 KLineEdit or KComboBox to see how easily such support can be added using this as a base class.

An abstract class for adding text completion support to widgets.

Author
Dawit Alemayehu adawi.nosp@m.t@kd.nosp@m.e.org

Definition at line 663 of file kcompletion.h.

Member Typedef Documentation

◆ KeyBindingMap

typedef TQMap<KeyBindingType, TDEShortcut> TDECompletionBase::KeyBindingMap

Definition at line 692 of file kcompletion.h.

Member Enumeration Documentation

◆ KeyBindingType

enum TDECompletionBase::KeyBindingType

Constants that represent the items whose short-cut key-binding is programmable.

The default key-bindings for these items are defined in TDEStdAccel.

Enumerator
TextCompletion 

Text completion (by default Ctrl-E).

PrevCompletionMatch 

Switch to previous completion (by default Ctrl-Up).

NextCompletionMatch 

Switch to next completion (by default Ctrl-Down).

SubstringCompletion 

Substring completion (by default Ctrl-T).

Definition at line 671 of file kcompletion.h.

Constructor & Destructor Documentation

◆ TDECompletionBase()

TDECompletionBase::TDECompletionBase ( )

Default constructor.

Definition at line 25 of file kcompletionbase.cpp.

◆ ~TDECompletionBase()

TDECompletionBase::~TDECompletionBase ( )
virtual

Destructor.

Definition at line 41 of file kcompletionbase.cpp.

Member Function Documentation

◆ completionMode()

TDEGlobalSettings::Completion TDECompletionBase::completionMode ( ) const
inline

Returns the current completion mode.

The return values are of type TDEGlobalSettings::Completion. See setCompletionMode() for details.

Returns
the completion mode.

Definition at line 854 of file kcompletion.h.

◆ completionObject()

TDECompletion * TDECompletionBase::completionObject ( bool  hsig = true)

Returns a pointer to the current completion object.

If the completion object does not exist, it is automatically created and by default handles all the completion signals internally unless hsig is set to false. It is also automatically destroyed when the destructor is called. You can change this default behavior using the setAutoDeleteCompletionObject and setHandleSignals member functions.

See also compObj.

Parameters
hsigif true, handles completion signals internally.
Returns
a pointer the completion object.

Definition at line 62 of file kcompletionbase.cpp.

◆ compObj()

TDECompletion * TDECompletionBase::compObj ( ) const
inline

Returns a pointer to the completion object.

This method is only different from completionObject() in that it does not create a new TDECompletion object even if the internal pointer is NULL. Use this method to get the pointer to a completion object when inheriting so that you won't inadvertently create it!!

Returns
the completion object or NULL if one does not exist.

Definition at line 953 of file kcompletion.h.

◆ delegate()

TDECompletionBase * TDECompletionBase::delegate ( ) const
inlineprotected

Returns the delegation object.

Returns
the delegation object, or 0 if there is none
See also
setDelegate()

Definition at line 978 of file kcompletion.h.

◆ emitSignals()

bool TDECompletionBase::emitSignals ( ) const
inline

Returns true if the object emits the signals.

Returns
true if signals are emitted

Definition at line 822 of file kcompletion.h.

◆ getKeyBinding()

const TDEShortcut & TDECompletionBase::getKeyBinding ( KeyBindingType  item) const
inline

Returns the key-binding used for the specified item.

This methods returns the key-binding used to activate the feature feature given by item. If the binding contains modifier key(s), the SUM of the modifier key and the actual key code are returned.

Parameters
itemthe item to check
Returns
the key-binding used for the feature given by item.
See also
setKeyBinding

Definition at line 902 of file kcompletion.h.

◆ getKeyBindings()

KeyBindingMap TDECompletionBase::getKeyBindings ( ) const
inlineprotected

Returns a key-binding map.

This method is the same as getKeyBinding() except it returns the whole keymap containing the key-bindings.

Returns
the key-binding used for the feature given by item.

Definition at line 964 of file kcompletion.h.

◆ handleSignals()

bool TDECompletionBase::handleSignals ( ) const
inline

Returns true if the object handles the signals.

Returns
true if this signals are handled internally.

Definition at line 815 of file kcompletion.h.

◆ isCompletionObjectAutoDeleted()

bool TDECompletionBase::isCompletionObjectAutoDeleted ( ) const
inline

Returns true if the completion object is deleted upon this widget's destruction.

See setCompletionObject() and enableCompletion() for details.

Returns
true if the completion object will be deleted automatically

Definition at line 763 of file kcompletion.h.

◆ setAutoDeleteCompletionObject()

void TDECompletionBase::setAutoDeleteCompletionObject ( bool  autoDelete)
inline

Sets the completion object when this widget's destructor is called.

If the argument is set to true, the completion object is deleted when this widget's destructor is called.

Parameters
autoDeleteif true, delete completion object on destruction.

Definition at line 776 of file kcompletion.h.

◆ setCompletedItems()

virtual void TDECompletionBase::setCompletedItems ( const TQStringList &  items)
pure virtual

A pure virtual function that must be implemented by all inheriting classes.

Parameters
itemsthe list of completed items

◆ setCompletedText()

virtual void TDECompletionBase::setCompletedText ( const TQString &  text)
pure virtual

A pure virtual function that must be implemented by all inheriting classes.

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 TDECompletionBase::setCompletedText. Does nothing in CompletionPopup mode, as all available matches will be shown in the popup.

Parameters
textthe completed text to be set in the widget.

◆ setCompletionMode()

void TDECompletionBase::setCompletionMode ( TDEGlobalSettings::Completion  mode)
virtual

Sets the type of completion to be used.

The completion modes supported are those defined in TDEGlobalSettings(). See below.

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

Reimplemented in KLineEdit.

Definition at line 101 of file kcompletionbase.cpp.

◆ setCompletionObject()

void TDECompletionBase::setCompletionObject ( TDECompletion *  compObj,
bool  hsig = true 
)
virtual

Sets up the completion object to be used.

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.

The object assigned through this method is not deleted when this object's destructor is invoked unless you explicitly call setAutoDeleteCompletionObject after calling this method. Be sure to set the bool argument to false, if you want to handle the completion signals yourself.

Parameters
compObja TDECompletion() or a derived child object.
hsigif true, handles completion signals internally.

Reimplemented in KLineEdit.

Definition at line 75 of file kcompletionbase.cpp.

◆ setDelegate()

void TDECompletionBase::setDelegate ( TDECompletionBase *  delegate)
protected

Sets or removes the delegation object.

If a delegation object is set, all function calls will be forwarded to the delegation object.

Parameters
delegatethe delegation object, or 0 to remove it

Definition at line 49 of file kcompletionbase.cpp.

◆ setEnableSignals()

void TDECompletionBase::setEnableSignals ( bool  enable)
inline

Sets the widget's ability to emit text completion and rotation signals.

Invoking this function with enable set to false will cause the completion & rotation signals not to be emitted. However, unlike setting the completion object to NULL using setCompletionObject, disabling the emition of the signals through this method does not affect the current completion object.

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.

Parameters
enableif false, disables the emition of completion & rotation signals.

Definition at line 803 of file kcompletion.h.

◆ setHandleSignals()

void TDECompletionBase::setHandleSignals ( bool  handle)
virtual

Enables this object to handle completion and rotation events internally.

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.

Parameters
handleif true, handle completion & rotation internally.

Definition at line 93 of file kcompletionbase.cpp.

◆ setKeyBinding()

bool TDECompletionBase::setKeyBinding ( KeyBindingType  item,
const TDEShortcut &  key 
)

Sets the key-binding to be used for manual text completion, text rotation in a history list as well as a completion list.

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 key is negative or the supplied key-binding conflicts with the ones set for one of the other features.

NOTE: To use a modifier key (Shift, Ctrl, Alt) as part of the key-binding simply simply sum 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 "TQt::CtrlButton + TQt::Key_E" as the second argument to this function.

Parameters
itemthe feature whose key-binding needs to be set:
  • TextCompletion the manual completion key-binding.
  • PrevCompletionMatch the previous match key for multiple completion.
  • NextCompletionMatch the next match key for for multiple completion.
  • SubstringCompletion the key for substring completion
keykey-binding used to rotate down in a list.
Returns
true if key-binding can successfully be set.
See also
getKeyBinding

Definition at line 115 of file kcompletionbase.cpp.

◆ useGlobalKeyBindings()

void TDECompletionBase::useGlobalKeyBindings ( )

Sets this object to use global values for key-bindings.

This method changes the values of the key bindings for rotation and completion features to the default values provided in TDEGlobalSettings.

NOTE: By default inheriting widgets should uses the global key-bindings so that there will be no need to call this method.

Definition at line 130 of file kcompletionbase.cpp.

◆ virtual_hook()

void TDECompletionBase::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 889 of file kcompletion.cpp.


The documentation for this class was generated from the following files:
  • kcompletion.h
  • kcompletion.cpp
  • kcompletionbase.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • 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 tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.