01: /*=============================================================================
02: * Copyright Texas Instruments, Inc., 2002. All Rights Reserved.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * 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 General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package ti.swing.console;
20:
21: import java.awt.Color;
22:
23: /**
24: * An attribute to flip the bg and fg color.
25: *
26: * @author Rob Clark
27: * @version 0.0
28: */
29: public class InverseAttribute implements Attribute {
30: public static final Attribute INVERSE = new InverseAttribute();
31:
32: /**
33: * Get a region to apply this region.
34: *
35: * @param offset the offset to beginning of region
36: * @param length the length of the region
37: * @return a region
38: */
39: public Region getRegion(int offset, int length) {
40: return new Region(offset, length) {
41:
42: public void enter(ConsoleGraphics g) {
43: g.toggleInverse();
44: }
45:
46: public void leave(ConsoleGraphics g) {
47: g.toggleInverse();
48: }
49: };
50: }
51: }
52:
53: /*
54: * Local Variables:
55: * tab-width: 2
56: * indent-tabs-mode: nil
57: * mode: java
58: * c-indentation-style: java
59: * c-basic-offset: 2
60: * eval: (c-set-offset 'substatement-open '0)
61: * eval: (c-set-offset 'case-label '+)
62: * eval: (c-set-offset 'inclass '+)
63: * eval: (c-set-offset 'inline-open '0)
64: * End:
65: */
|