X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fevent%2FTKeypressEvent.java;h=79b28f29381655022f879ef0eccd0f472d50307d;hb=505be508ae7d3fb48122be548b310a238cfb91eb;hp=62c6be29f4ce8a5ea612b8b337c3ae0cab82c464;hpb=a2018e9964f6c58742cd1e6dd0a0c63e244a89d6;p=fanfix.git diff --git a/src/jexer/event/TKeypressEvent.java b/src/jexer/event/TKeypressEvent.java index 62c6be2..79b28f2 100644 --- a/src/jexer/event/TKeypressEvent.java +++ b/src/jexer/event/TKeypressEvent.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2017 Kevin Lamonte + * Copyright (C) 2019 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -33,21 +33,20 @@ import jexer.TKeypress; /** * This class encapsulates a keyboard input event. */ -public final class TKeypressEvent extends TInputEvent { +public class TKeypressEvent extends TInputEvent { + + // ------------------------------------------------------------------------ + // Variables -------------------------------------------------------------- + // ------------------------------------------------------------------------ /** * Keystroke received. */ private TKeypress key; - /** - * Get keystroke. - * - * @return keystroke - */ - public TKeypress getKey() { - return key; - } + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ /** * Public contructor. @@ -68,7 +67,7 @@ public final class TKeypressEvent extends TInputEvent { * @param ctrl if true, CTRL was pressed with this keystroke * @param shift if true, SHIFT was pressed with this keystroke */ - public TKeypressEvent(final boolean isKey, final int fnKey, final char ch, + public TKeypressEvent(final boolean isKey, final int fnKey, final int ch, final boolean alt, final boolean ctrl, final boolean shift) { this.key = new TKeypress(isKey, fnKey, ch, alt, ctrl, shift); @@ -89,6 +88,10 @@ public final class TKeypressEvent extends TInputEvent { alt, ctrl, shift); } + // ------------------------------------------------------------------------ + // TInputEvent ------------------------------------------------------------ + // ------------------------------------------------------------------------ + /** * Comparison check. All fields must match to return true. * @@ -137,4 +140,28 @@ public final class TKeypressEvent extends TInputEvent { public String toString() { return String.format("Keypress: %s", key.toString()); } + + // ------------------------------------------------------------------------ + // TKeypressEvent --------------------------------------------------------- + // ------------------------------------------------------------------------ + + /** + * Get keystroke. + * + * @return keystroke + */ + public TKeypress getKey() { + return key; + } + + /** + * Create a duplicate instance. + * + * @return duplicate intance + */ + public TKeypressEvent dup() { + TKeypressEvent keypress = new TKeypressEvent(key.dup()); + return keypress; + } + }