| 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 | */ |
| 19 | package com.googlecode.lanterna.gui2; |
| 20 | |
| 21 | import com.googlecode.lanterna.TerminalPosition; |
| 22 | import com.googlecode.lanterna.TerminalSize; |
| 23 | |
| 24 | /** |
| 25 | * Interface that defines a class that draws window decorations, i.e. a surrounding layer around the window that usually |
| 26 | * looks like a border to make it easier for a user to visually separate the windows. |
| 27 | * @see DefaultWindowDecorationRenderer |
| 28 | * @author Martin |
| 29 | */ |
| 30 | public interface WindowDecorationRenderer { |
| 31 | /** |
| 32 | * Draws the window decorations for a particular window and returns a new TextGraphics that is locked to the area |
| 33 | * inside of the window decorations where the content of the window should be drawn |
| 34 | * @param textGUI Which TextGUI is calling |
| 35 | * @param graphics Graphics to use for drawing |
| 36 | * @param window Window to draw |
| 37 | * @return A new TextGraphics that is limited to the area inside the decorations just drawn |
| 38 | */ |
| 39 | TextGUIGraphics draw(TextGUI textGUI, TextGUIGraphics graphics, Window window); |
| 40 | |
| 41 | /** |
| 42 | * Retrieves the full size of the window, including all window decorations, given all components inside the window. |
| 43 | * @param window Window to calculate size for |
| 44 | * @param contentAreaSize Size of the content area in the window |
| 45 | * @return Full size of the window, including decorations |
| 46 | */ |
| 47 | TerminalSize getDecoratedSize(Window window, TerminalSize contentAreaSize); |
| 48 | |
| 49 | /** |
| 50 | * Returns how much to step right and down from the top left position of the window decorations to the top left |
| 51 | * position of the actual window |
| 52 | * @param window Window to get the offset for |
| 53 | * @return Position of the top left corner of the window, relative to the top left corner of the window decoration |
| 54 | */ |
| 55 | TerminalPosition getOffset(Window window); |
| 56 | } |