Commit | Line | Data |
---|---|---|
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 | */ | |
19 | package com.googlecode.lanterna.graphics; | |
20 | ||
21 | /** | |
22 | * A ThemeDefinition contains a collection of ThemeStyle:s, which defines on a lower level which colors and SGRs to | |
23 | * apply if you want to draw according to the theme. The different style names are directly inspired from GTK 2. You can | |
24 | * also fetch character definitions which are stored inside of the theme, for example if you want to draw a border and | |
25 | * make the characters that make up the border customizable. | |
26 | * | |
27 | * @author Martin | |
28 | */ | |
29 | public interface ThemeDefinition { | |
30 | /** | |
31 | * The normal style of the definition, which can be considered the default to be used. | |
32 | * @return ThemeStyle representation for the normal style | |
33 | */ | |
34 | ThemeStyle getNormal(); | |
35 | ||
36 | /** | |
37 | * The pre-light style of this definition, which can be used when a component has input focus but isn't active or | |
38 | * selected, similar to mouse-hoovering in modern GUIs | |
39 | * @return ThemeStyle representation for the pre-light style | |
40 | */ | |
41 | ThemeStyle getPreLight(); | |
42 | ||
43 | /** | |
44 | * The "selected" style of this definition, which can used when a component has been actively selected in some way. | |
45 | * @return ThemeStyle representation for the selected style | |
46 | */ | |
47 | ThemeStyle getSelected(); | |
48 | ||
49 | /** | |
50 | * The "active" style of this definition, which can be used when a component is being directly interacted with | |
51 | * @return ThemeStyle representation for the active style | |
52 | */ | |
53 | ThemeStyle getActive(); | |
54 | ||
55 | /** | |
56 | * The insensitive style of this definition, which can be used when a component has been disabled or in some other | |
57 | * way isn't able to be interacted with. | |
58 | * @return ThemeStyle representation for the insensitive style | |
59 | */ | |
60 | ThemeStyle getInsensitive(); | |
61 | ||
62 | /** | |
63 | * Retrieves a custom ThemeStyle, if one is available by this name. Will return null if no such style could be found | |
64 | * within this ThemeDefinition. You can use this if you need more categories than the ones available above. | |
65 | * @param name Name of the style to look up | |
66 | * @return The ThemeStyle associated with the name, or {@code null} if there was no such style | |
67 | */ | |
68 | ThemeStyle getCustom(String name); | |
69 | ||
70 | /** | |
71 | * Retrieves a character from this theme definition by the specified name. This method cannot return {@code null} so | |
72 | * you need to give a fallback in case the definition didn't have any character by this name. | |
73 | * @param name Name of the character to look up | |
74 | * @param fallback Character to return if there was no character by the name supplied in this definition | |
75 | * @return The character from this definition by the name entered, or {@code fallback} if the definition didn't have | |
76 | * any character defined with this name | |
77 | */ | |
78 | char getCharacter(String name, char fallback); | |
79 | ||
80 | /** | |
81 | * Returns the class name of the ComponentRenderer attached to this definition. If none is declared, it will return | |
82 | * {@code null} instead of going up in the hierarchy, unlike the other methods of this interface. | |
83 | * @return Full name of the renderer class or {@code null} | |
84 | */ | |
85 | String getRenderer(); | |
86 | } |