org.kde.koala
Class KKeySequence

java.lang.Object
  extended by org.kde.koala.KKeySequence
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KKeySequence
extends java.lang.Object
implements org.kde.qt.QtSupport

A KKeySequence object holds a sequence of up to 4 keys. Ex: Ctrl+X,I

See Also:
KKey, KShortcut

Field Summary
static int MAX_KEYS
           
 
Constructor Summary
  KKeySequence()
          Create a new null key sequence.
protected KKeySequence(java.lang.Class dummy)
           
  KKeySequence(KKey key)
          Create a new key sequence that only contains the given key.
  KKeySequence(KKeySequence keySeq)
          Copies the given key sequence.
  KKeySequence(org.kde.qt.QKeySequence keySeq)
          Copies the given qt key sequence.
  KKeySequence(java.lang.String keySeq)
          Creates a new key sequence that contains the given key sequence.
 
Method Summary
 void clear()
          Clears the key sequence.
 int compare(KKeySequence keySeq)
          Compares this object with the given key sequence.
 int count()
          Returns the number of key strokes of this sequence.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 boolean isNull()
          Returns true if the key sequence is null (after clear() or empty constructor).
 boolean isTriggerOnRelease()
           
 KKey key(int i)
          Return the i'th key of this sequence, or a null key if there are less then i keys.
 int keyCodeQt()
          Returns the qt key code of the first key.
static KKeySequence nil()
          Returns a null key sequence.
 boolean op_equals(KKeySequence seq)
          Compares the keys of both sequences.
 boolean op_lt(KKeySequence seq)
          Compares the keys of both sequences.
 boolean op_not_equals(KKeySequence seq)
          Compares the keys of both sequences.
 org.kde.qt.QKeySequence qt()
          Converts this key sequence to a QKeySequence.
 boolean setKey(int i, KKey key)
          Sets the i'th key of the sequence.
 boolean startsWith(KKeySequence keySeq)
          Returns true if this key sequence begins with the given sequence.
 java.lang.String toString()
          Returns the key sequence as a number of key presses as returned by KKey.toString(), separated by commas.
 java.lang.String toStringInternal()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_KEYS

public static final int MAX_KEYS
See Also:
Constant Field Values
Constructor Detail

KKeySequence

protected KKeySequence(java.lang.Class dummy)

KKeySequence

public KKeySequence()
Create a new null key sequence.

See Also:
isNull(), #null, clear()

KKeySequence

public KKeySequence(org.kde.qt.QKeySequence keySeq)
Copies the given qt key sequence.

Parameters:
keySeq - the qt key sequence to copy

KKeySequence

public KKeySequence(KKey key)
Create a new key sequence that only contains the given key.

Parameters:
key - the key to add

KKeySequence

public KKeySequence(KKeySequence keySeq)
Copies the given key sequence.

Parameters:
keySeq - the key sequence to copy

KKeySequence

public KKeySequence(java.lang.String keySeq)
Creates a new key sequence that contains the given key sequence. The description consists of comma-separated keys as required by KKey.KKey(String).

Parameters:
keySeq - the description of the key
See Also:
KKeyServer#Sym#init, KKey#KKey(const
Method Detail

clear

public void clear()
Clears the key sequence. The key sequence is null after calling this function.

See Also:
isNull()

count

public int count()
Returns the number of key strokes of this sequence.

Returns:
the number of key strokes
See Also:
MAX_KEYS

key

public KKey key(int i)
Return the i'th key of this sequence, or a null key if there are less then i keys.

Parameters:
i - the key to retrieve
Returns:
the i'th key, or KKey.null() if there are less than i keys
See Also:
MAX_KEYS

isTriggerOnRelease

public boolean isTriggerOnRelease()

setKey

public boolean setKey(int i,
                      KKey key)
Sets the i'th key of the sequence. You can not introduce gaps in a sequence, so you must use an i <= count(). Also note that the maximum length of a key sequence is MAX_KEYS.

Parameters:
i - the position of the new key (<= count(), <= MAX_KEYS)
key - the key to set
Returns:
true if successful, false otherwise

isNull

public boolean isNull()
Returns true if the key sequence is null (after clear() or empty constructor).

Returns:
true if the key sequence is null
See Also:
clear(), #null

startsWith

public boolean startsWith(KKeySequence keySeq)
Returns true if this key sequence begins with the given sequence.

Parameters:
keySeq - the key sequence to search
Returns:
true if this key sequence begins with the given sequence

compare

public int compare(KKeySequence keySeq)
Compares this object with the given key sequence. Returns a negative number if the given KKeySequence is larger, 0 if they are equal and a positive number this KKeySequence is larger. Key sequences are compared by comparing the individual keys, starting from the beginning until an unequal key has been found. If a sequence contains more keys, it is considered larger.

Parameters:
keySeq - the key sequence to compare to
Returns:
a negative number if the given KKeySequence is larger, 0 if they are equal and a positive number this KKeySequence is larger
See Also:
KKey#sequence

op_equals

public boolean op_equals(KKeySequence seq)
Compares the keys of both sequences.

See Also:
compare(org.kde.koala.KKeySequence)

op_not_equals

public boolean op_not_equals(KKeySequence seq)
Compares the keys of both sequences.

See Also:
compare(org.kde.koala.KKeySequence)

op_lt

public boolean op_lt(KKeySequence seq)
Compares the keys of both sequences.

See Also:
compare(org.kde.koala.KKeySequence)

qt

public org.kde.qt.QKeySequence qt()
Converts this key sequence to a QKeySequence.

Returns:
the QKeySequence

keyCodeQt

public int keyCodeQt()
Returns the qt key code of the first key.

Returns:
the qt key code of the first key
See Also:
org.kde.qt.Qt#Key, KKey.keyCodeQt()

toString

public java.lang.String toString()
Returns the key sequence as a number of key presses as returned by KKey.toString(), separated by commas.

Overrides:
toString in class java.lang.Object
Returns:
the string represenation of this key sequence
See Also:
KKey.toString()

toStringInternal

public java.lang.String toStringInternal()

nil

public static KKeySequence nil()
Returns a null key sequence.

Returns:
the null key sequence
See Also:
isNull(), clear()

finalize

protected void finalize()
                 throws java.lang.InternalError
Deletes the wrapped C++ instance

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.InternalError

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()


isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?