X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FEmptySpace.java;fp=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FEmptySpace.java;h=0000000000000000000000000000000000000000;hp=3a239a73e76ebddb1e0b7227d4f57ded89a75842;hb=f06c81000632cfb5f525ca458f719338f55f9f66;hpb=a73a906356c971b080c36368e71a15d87e8b8d31 diff --git a/src/com/googlecode/lanterna/gui2/EmptySpace.java b/src/com/googlecode/lanterna/gui2/EmptySpace.java deleted file mode 100644 index 3a239a7..0000000 --- a/src/com/googlecode/lanterna/gui2/EmptySpace.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is part of lanterna (http://code.google.com/p/lanterna/). - * - * lanterna is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Copyright (C) 2010-2015 Martin - */ -package com.googlecode.lanterna.gui2; - -import com.googlecode.lanterna.TerminalSize; -import com.googlecode.lanterna.TextColor; - -/** - * Simple component which draws a solid color over its area. The size this component will request is specified through - * it's constructor. - * - * @author Martin - */ -public class EmptySpace extends AbstractComponent { - private final TerminalSize size; - private TextColor color; - - /** - * Creates an EmptySpace with size 1x1 and a default color chosen from the theme - */ - public EmptySpace() { - this(null, TerminalSize.ONE); - } - - /** - * Creates an EmptySpace with a specified color and preferred size of 1x1 - * @param color Color to use (null will make it use the theme) - */ - public EmptySpace(TextColor color) { - this(color, TerminalSize.ONE); - } - - /** - * Creates an EmptySpace with a specified preferred size (color will be chosen from the theme) - * @param size Preferred size - */ - public EmptySpace(TerminalSize size) { - this(null, size); - } - - /** - * Creates an EmptySpace with a specified color (null will make it use a color from the theme) and preferred size - * @param color Color to use (null will make it use the theme) - * @param size Preferred size - */ - public EmptySpace(TextColor color, TerminalSize size) { - this.color = color; - this.size = size; - } - - /** - * Changes the color this component will use when drawn - * @param color New color to draw the component with, if {@code null} then the component will use the theme's - * default color - */ - public void setColor(TextColor color) { - this.color = color; - } - - /** - * Returns the color this component is drawn with, or {@code null} if this component uses whatever the default color - * the theme is set to use - * @return Color used when drawing or {@code null} if it's using the theme - */ - public TextColor getColor() { - return color; - } - - @Override - protected ComponentRenderer createDefaultRenderer() { - return new ComponentRenderer() { - - @Override - public TerminalSize getPreferredSize(EmptySpace component) { - return size; - } - - @Override - public void drawComponent(TextGUIGraphics graphics, EmptySpace component) { - graphics.applyThemeStyle(graphics.getThemeDefinition(EmptySpace.class).getNormal()); - if(color != null) { - graphics.setBackgroundColor(color); - } - graphics.fill(' '); - } - }; - } -}