Change build scripts
[jvcard.git] / src / com / googlecode / lanterna / gui2 / WindowBasedTextGUI.java
CommitLineData
a3b510ab
NR
1/*
2 * This file is part of lanterna (http://code.google.com/p/lanterna/).
3 *
4 * lanterna is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright (C) 2010-2015 Martin
18 */
19package com.googlecode.lanterna.gui2;
20
21import com.googlecode.lanterna.screen.Screen;
22import com.googlecode.lanterna.screen.VirtualScreen;
23
24import java.util.Collection;
25
26/**
27 * Extension of the TextGUI interface, this is intended as the base interface for any TextGUI that intends to make use
28 * of the Window class.
29 * @author Martin
30 */
31public interface WindowBasedTextGUI extends TextGUI {
32 /**
33 * Returns the window manager that is currently controlling this TextGUI. The window manager is in charge of placing
34 * the windows on the surface and also deciding how they behave and move around.
35 * @return Window manager that is currently controlling the windows in the terminal
36 */
37 WindowManager getWindowManager();
38
39 /**
40 * Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately
41 * visible. By adding a window to the GUI, it will be associated with this GUI and can receive focus and events from
42 * it. This method call will return immediately, if you want the call to block until the window is closed, please
43 * use {@code addWindowAndWait(..)}.
44 *
45 * Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will
46 * render windows in a predictable order from bottom to top. You can modify the stack by using
47 * {@code moveToTop(..)} to move a Window from its current position in the stack to the top.
48 *
49 * @param window Window to add to the GUI
50 * @return The WindowBasedTextGUI Itself
51 */
52 WindowBasedTextGUI addWindow(Window window);
53
54 /**
55 * Adds a window to the TextGUI system, depending on the window manager this window may or may not be immediately
56 * visible. By adding a window to the GUI, it will be associated with this GUI and can receive focus and events from
57 * it. This method block until the added window is removed or closed, if you want the call to return immediately,
58 * please use {@code addWindow(..)}. This method call is useful for modal dialogs that requires a certain user input
59 * before the application can continue.
60 *
61 * Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will
62 * render windows in a predictable order from bottom to top. You can modify the stack by using
63 * {@code moveToTop(..)} to move a Window from its current position in the stack to the top.
64 *
65 * @param window Window to add to the GUI
66 * @return The WindowBasedTextGUI Itself
67 */
68 WindowBasedTextGUI addWindowAndWait(Window window);
69
70 /**
71 * Removes a window from the TextGUI. This is effectively the same as closing the window. The window will be
72 * unassociated from this TextGUI and will no longer receive any events for it. Any threads waiting on the window
73 * to close will be resumed.
74 *
75 * @param window Window to close
76 * @return The WindowBasedTextGUI itself
77 */
78 WindowBasedTextGUI removeWindow(Window window);
79
80 /**
81 * Returns a list of all windows currently in the TextGUI. The list is unmodifiable and just a snapshot of what the
82 * state was when the method was invoked. If windows are added/removed after the method call, the list will not
83 * reflect this.
84 * @return Unmodifiable list of all windows in the TextGUI at the time of the call
85 */
86 Collection<Window> getWindows();
87
88 /**
89 * Selects a particular window to be considered 'active' and receive all input events
90 * @param activeWindow Window to become active and receive input events
91 * @return The WindowBasedTextGUI itself
92 */
93 WindowBasedTextGUI setActiveWindow(Window activeWindow);
94
95 /**
96 * Returns the window which the TextGUI considers the active one at the time of the method call. The active window
97 * is generally the one which relieves all keyboard input.
98 * @return Active window in the TextGUI or {@code null}
99 */
100 Window getActiveWindow();
101
102
103 /**
104 * Returns the container for the background, which works as a single large component that takes up the whole
105 * terminal area and is always behind all windows.
106 * @return The {@code BasePane} used by this {@code WindowBasedTextGUI}
107 */
108 BasePane getBackgroundPane();
109
110 /**
111 * Returns the {@link Screen} for this {@link WindowBasedTextGUI}
112 * @return the {@link Screen} used by this {@link WindowBasedTextGUI}
113 */
114 Screen getScreen();
115
116 /**
117 * Returns the {@link WindowPostRenderer} for this {@link WindowBasedTextGUI}
118 * @return the {@link WindowPostRenderer} for this {@link WindowBasedTextGUI}
119 */
120 WindowPostRenderer getWindowPostRenderer();
121
122 /**
123 * Windows are internally stored as a stack and newer windows are added at the top of the stack. The GUI system will
124 * render windows in a predictable order from bottom to top. This method allows you to move a Window from its
125 * current position in the stack to the top, meaning it will be rendered last. This mean it will overlap all other
126 * windows and because of this visually appear on top.
127 * @param window Window in the stack to move to the top position
128 * @return The WindowBasedTextGUI Itself
129 */
130 WindowBasedTextGUI moveToTop(Window window);
131
132 /**
133 * Takes the previously active window and makes it active, or if in reverse mode, takes the window at the bottom of
134 * the stack, moves it to the front and makes it active.
135 * @param reverse Direction to cycle through the windows
136 * @return The WindowBasedTextGUI Itself
137 */
138 WindowBasedTextGUI cycleActiveWindow(boolean reverse);
139
140 /**
141 * Waits for the specified window to be closed
142 * @param abstractWindow Window to wait for
143 */
144 void waitForWindowToClose(Window abstractWindow);
145}