X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTCheckBox.java;fp=src%2Fjexer%2FTCheckBox.java;h=84c2e41adf7a13d086e704b6490a13a0eccd5359;hb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;hp=188db7e622d51094aa728f1d716d950654036d35;hpb=d625990deaa2c24624adc9fbd3fcab58891f5aef;p=fanfix.git diff --git a/src/jexer/TCheckBox.java b/src/jexer/TCheckBox.java index 188db7e..84c2e41 100644 --- a/src/jexer/TCheckBox.java +++ b/src/jexer/TCheckBox.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2017 Kevin Lamonte + * Copyright (C) 2019 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -53,6 +53,11 @@ public class TCheckBox extends TWidget { */ private String label; + /** + * If true, use the window's background color. + */ + private boolean useWindowBackground = false; + // ------------------------------------------------------------------------ // Constructors ----------------------------------------------------------- // ------------------------------------------------------------------------ @@ -144,15 +149,19 @@ public class TCheckBox extends TWidget { } else { checkboxColor = getTheme().getColor("tcheckbox.inactive"); } + if (useWindowBackground) { + CellAttributes background = getWindow().getBackground(); + checkboxColor.setBackColor(background.getBackColor()); + } - getScreen().putCharXY(0, 0, '[', checkboxColor); + putCharXY(0, 0, '[', checkboxColor); if (checked) { - getScreen().putCharXY(1, 0, GraphicsChars.CHECK, checkboxColor); + putCharXY(1, 0, GraphicsChars.CHECK, checkboxColor); } else { - getScreen().putCharXY(1, 0, ' ', checkboxColor); + putCharXY(1, 0, ' ', checkboxColor); } - getScreen().putCharXY(2, 0, ']', checkboxColor); - getScreen().putStringXY(4, 0, label, checkboxColor); + putCharXY(2, 0, ']', checkboxColor); + putStringXY(4, 0, label, checkboxColor); } // ------------------------------------------------------------------------