|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KCompletionBase
public class KCompletionBase
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 function setCompletedText. Refer to KLineEdit or KComboBox to see how easily such support can be added using this as a base class.
Field Summary | |
---|---|
static int |
NextCompletionMatch
|
static int |
PrevCompletionMatch
|
static int |
SubstringCompletion
|
static int |
TextCompletion
Constants that represent the items whose short-cut key-binding is programmable. |
Constructor Summary | |
---|---|
protected |
KCompletionBase(java.lang.Class dummy)
|
Method Summary | |
---|---|
int |
completionMode()
Returns the current completion mode. |
KCompletion |
completionObject()
|
KCompletion |
completionObject(boolean hsig)
Returns a pointer to the current completion object. |
KCompletion |
compObj()
Returns a pointer to the completion object. |
boolean |
emitSignals()
Returns true if the object emits the signals. |
KShortcut |
getKeyBinding(int item)
Returns the key-binding used for the specified item. |
boolean |
handleSignals()
Returns true if the object handles the signals. |
boolean |
isCompletionObjectAutoDeleted()
Returns true if the completion object is deleted upon this widget's destruction. |
void |
setAutoDeleteCompletionObject(boolean autoDelete)
Sets the completion object when this widget's destructor is called. |
void |
setCompletedItems(java.lang.String[] items)
A pure function that must be implemented by all inheriting classes. |
void |
setCompletedText(java.lang.String text)
A pure function that must be implemented by all inheriting classes. |
void |
setCompletionMode(int mode)
Sets the type of completion to be used. |
void |
setCompletionObject(KCompletion compObj)
|
void |
setCompletionObject(KCompletion compObj,
boolean hsig)
Sets up the completion object to be used. |
void |
setEnableSignals(boolean enable)
Sets the widget's ability to emit text completion and rotation signals. |
void |
setHandleSignals(boolean handle)
Enables this object to handle completion and rotation events internally. |
boolean |
setKeyBinding(int item,
KShortcut key)
Sets the key-binding to be used for manual text completion, text rotation in a history list as well as a completion list. |
void |
useGlobalKeyBindings()
Sets this object to use global values for key-bindings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TextCompletion
public static final int PrevCompletionMatch
public static final int NextCompletionMatch
public static final int SubstringCompletion
Constructor Detail |
---|
protected KCompletionBase(java.lang.Class dummy)
Method Detail |
---|
public KCompletion completionObject(boolean hsig)
hsig
is set to false. It is also automatically destroyed when the destructor
is called. You can change this default behavior using the
setAutoDeleteCompletionObject(boolean)
and setHandleSignals(boolean)
member
functions.
See also compObj()
.
completionObject
in interface KCompletionBaseInterface
hsig
- if true, handles completion signals internally.
public KCompletion completionObject()
completionObject
in interface KCompletionBaseInterface
public void setCompletionObject(KCompletion compObj, boolean hsig)
setAutoDeleteCompletionObject(boolean)
after calling this method. Be sure to set the boolean argument to false, if
you want to handle the completion signals yourself.
setCompletionObject
in interface KCompletionBaseInterface
compObj
- a KCompletion() or a derived child object.hsig
- if true, handles completion signals internally.public void setCompletionObject(KCompletion compObj)
setCompletionObject
in interface KCompletionBaseInterface
public void setHandleSignals(boolean handle)
setHandleSignals
in interface KCompletionBaseInterface
handle
- if true, handle completion & rotation internally.public boolean isCompletionObjectAutoDeleted()
isCompletionObjectAutoDeleted
in interface KCompletionBaseInterface
public void setAutoDeleteCompletionObject(boolean autoDelete)
setAutoDeleteCompletionObject
in interface KCompletionBaseInterface
autoDelete
- if true, delete completion object on destruction.public void setEnableSignals(boolean enable)
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.
setEnableSignals
in interface KCompletionBaseInterface
enable
- if false, disables the emition of completion & rotation signals.public boolean handleSignals()
handleSignals
in interface KCompletionBaseInterface
public boolean emitSignals()
emitSignals
in interface KCompletionBaseInterface
public void setCompletionMode(int mode)
setCompletionMode
in interface KCompletionBaseInterface
mode
- Completion type:
public int completionMode()
completionMode
in interface KCompletionBaseInterface
public boolean setKeyBinding(int item, KShortcut key)
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
"Qt.CtrlButton + Qt.Key_E" as the second argument to this
function.
setKeyBinding
in interface KCompletionBaseInterface
item
- the feature whose key-binding needs to be set:
key
- key-binding used to rotate down in a list.
getKeyBinding(int)
public KShortcut getKeyBinding(int item)
item.
If the binding
contains modifier key(s), the SUM of the modifier key
and the actual key code are returned.
getKeyBinding
in interface KCompletionBaseInterface
item
- the item to check
item.
setKeyBinding(int, org.kde.koala.KShortcut)
public void useGlobalKeyBindings()
useGlobalKeyBindings
in interface KCompletionBaseInterface
public void setCompletedText(java.lang.String text)
setCompletedText
in interface KCompletionBaseInterface
text
- the completed text to be set in the widget.public void setCompletedItems(java.lang.String[] items)
setCompletedItems
in interface KCompletionBaseInterface
items
- the list of completed itemspublic KCompletion compObj()
NULL.
Use this method to get the
pointer to a completion object when inheriting so that you
won't inadvertently create it!!
compObj
in interface KCompletionBaseInterface
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |