HELLO WORLD...
[fanfix.git] / src / jexer / backend / Backend.java
CommitLineData
df8de03f
KL
1/**
2 * Jexer - Java Text User Interface
3 *
4 * Version: $Id$
5 *
6 * Author: Kevin Lamonte, <a href="mailto:kevin.lamonte@gmail.com">kevin.lamonte@gmail.com</a>
7 *
8 * License: LGPLv3 or later
9 *
10 * Copyright: This module is licensed under the GNU Lesser General
11 * Public License Version 3. Please see the file "COPYING" in this
12 * directory for more information about the GNU Lesser General Public
13 * License Version 3.
14 *
15 * Copyright (C) 2015 Kevin Lamonte
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public License
19 * as published by the Free Software Foundation; either version 3 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this program; if not, see
29 * http://www.gnu.org/licenses/, or write to the Free Software
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
31 * 02110-1301 USA
32 */
33package jexer.backend;
34
b1589621 35import java.util.List;
05dbb28d 36
df8de03f
KL
37import jexer.event.TInputEvent;
38import jexer.io.Screen;
39import jexer.session.SessionInfo;
40
41/**
42 * This abstract class provides a screen, keyboard, and mouse to
43 * TApplication. It also exposes session information as gleaned from lower
44 * levels of the communication stack.
45 */
46public abstract class Backend {
47
48 /**
49 * The session information
50 */
51 public SessionInfo session;
52
53 /**
54 * The screen to draw on
55 */
56 public Screen screen;
57
58 /**
59 * Subclasses must provide an implementation that syncs the logical
60 * screen to the physical device.
61 */
62 abstract public void flushScreen();
63
64 /**
65 * Subclasses must provide an implementation to get keyboard, mouse, and
66 * screen resize events.
67 *
05dbb28d
KL
68 * @param timeout maximum amount of time (in millis) to wait for an
69 * event. 0 means to return immediately, i.e. perform a poll.
df8de03f
KL
70 * @return events received, or an empty list if the timeout was reached
71 */
b1589621 72 abstract public List<TInputEvent> getEvents(int timeout);
df8de03f
KL
73
74 /**
75 * Subclasses must provide an implementation that closes sockets,
76 * restores console, etc.
77 */
78 abstract public void shutdown();
79
80}
81