baf3bb9fc45bb23c97415558aa63580a6a5f2991
[nikiroo-utils.git] / src / jexer / menu / TMenuSeparator.java
1 /*
2 * Jexer - Java Text User Interface
3 *
4 * License: LGPLv3 or later
5 *
6 * This module is licensed under the GNU Lesser General Public License
7 * Version 3. Please see the file "COPYING" in this directory for more
8 * information about the GNU Lesser General Public License Version 3.
9 *
10 * Copyright (C) 2015 Kevin Lamonte
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this program; if not, see
24 * http://www.gnu.org/licenses/, or write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * 02110-1301 USA
27 *
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
29 * @version 1
30 */
31 package jexer.menu;
32
33 import jexer.bits.CellAttributes;
34 import jexer.bits.GraphicsChars;
35
36 /**
37 * TMenuSeparator is a special case menu item.
38 */
39 public final class TMenuSeparator extends TMenuItem {
40
41 /**
42 * Package private constructor.
43 *
44 * @param parent parent widget
45 * @param x column relative to parent
46 * @param y row relative to parent
47 */
48 TMenuSeparator(final TMenu parent, final int x, final int y) {
49 super(parent, TMenu.MID_UNUSED, x, y, "");
50 setEnabled(false);
51 setActive(false);
52 setWidth(parent.getWidth() - 2);
53 }
54
55 /**
56 * Draw a menu separator.
57 */
58 @Override
59 public void draw() {
60 CellAttributes background = getTheme().getColor("tmenu");
61
62 getScreen().putCharXY(0, 0, GraphicsChars.CP437[0xC3], background);
63 getScreen().putCharXY(getWidth() - 1, 0, GraphicsChars.CP437[0xB4],
64 background);
65 getScreen().hLineXY(1, 0, getWidth() - 2, GraphicsChars.SINGLE_BAR,
66 background);
67 }
68
69 }