1 /*****************************************************/
\r
2 /* This java file is a part of the */
\r
4 /* - Plouf's Java IRC Client - */
\r
6 /* Copyright (C) 2002 - 2004 Philippe Detournay */
\r
8 /* All contacts : theplouf@yahoo.com */
\r
10 /* PJIRC is free software; you can redistribute */
\r
11 /* it and/or modify it under the terms of the GNU */
\r
12 /* General Public License as published by the */
\r
13 /* Free Software Foundation; version 2 or later of */
\r
16 /* PJIRC is distributed in the hope that it will */
\r
17 /* be useful, but WITHOUT ANY WARRANTY; without */
\r
18 /* even the implied warranty of MERCHANTABILITY or */
\r
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
\r
20 /* General Public License for more details. */
\r
22 /* You should have received a copy of the GNU */
\r
23 /* General Public License along with PJIRC; if */
\r
24 /* not, write to the Free Software Foundation, */
\r
25 /* Inc., 59 Temple Place, Suite 330, Boston, */
\r
26 /* MA 02111-1307 USA */
\r
28 /*****************************************************/
\r
30 package irc.gui.pixx;
\r
32 import java.awt.Color;
\r
33 import java.awt.Graphics;
\r
34 import java.awt.Panel;
\r
37 * Root panel for all PixxComponents.
\r
39 public class PixxPanel extends Panel {
\r
43 public static final int COLOR_BLACK = PixxColorModel.COLOR_BLACK;
\r
47 public static final int COLOR_WHITE = PixxColorModel.COLOR_WHITE;
\r
51 public static final int COLOR_DARK_GRAY = PixxColorModel.COLOR_DARK_GRAY;
\r
55 public static final int COLOR_GRAY = PixxColorModel.COLOR_GRAY;
\r
59 public static final int COLOR_LIGHT_GRAY = PixxColorModel.COLOR_LIGHT_GRAY;
\r
63 public static final int COLOR_FRONT = PixxColorModel.COLOR_FRONT;
\r
67 public static final int COLOR_BACK = PixxColorModel.COLOR_BACK;
\r
71 public static final int COLOR_SELECTED = PixxColorModel.COLOR_SELECTED;
\r
75 public static final int COLOR_EVENT = PixxColorModel.COLOR_EVENT;
\r
79 public static final int COLOR_CLOSE = PixxColorModel.COLOR_CLOSE;
\r
83 public static final int COLOR_VOICE = PixxColorModel.COLOR_VOICE;
\r
87 public static final int COLOR_OP = PixxColorModel.COLOR_OP;
\r
91 public static final int COLOR_SEMIOP = PixxColorModel.COLOR_SEMIOP;
\r
95 public static final int COLOR_MALE = PixxColorModel.COLOR_MALE;
\r
99 public static final int COLOR_FEMEALE = PixxColorModel.COLOR_FEMEALE;
\r
103 public static final int COLOR_UNDEF = PixxColorModel.COLOR_UNDEF;
\r
106 * Pixx Configuration.
\r
108 protected PixxConfiguration _pixxConfiguration;
\r
111 * Create a new PixxPanel.
\r
114 * global pixx configuration.
\r
116 public PixxPanel(PixxConfiguration config) {
\r
117 _pixxConfiguration = config;
\r
121 * Release this object. No further method call may be performed.
\r
123 public void release() {
\r
124 _pixxConfiguration = null;
\r
128 * Get the formatted text from the formatted text code.
\r
132 * @return formatted string.
\r
134 public String getText(int code) {
\r
135 return _pixxConfiguration.getText(code);
\r
139 * Draw a 3d box at given position.
\r
152 protected void drawSeparator(Graphics g, int x, int y, int w, int h) {
\r
153 g.setColor(new Color(0x868686));
\r
154 g.drawLine(x + 0, y + 0, x + w - 1, y + 0);
\r
155 g.drawLine(x + 0, y + 0, x + 0, y + 1);
\r
156 g.drawLine(x + w - 1, y + 0, x + w - 1, y + 1);
\r
157 g.setColor(Color.black);
\r
158 g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
\r
160 g.setColor(new Color(0x868686));
\r
161 g.drawLine(x + 0, y + 0, x + 0, y + h - 1);
\r
162 g.setColor(Color.black);
\r
163 g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
\r
165 g.setColor(new Color(0xD7D3CB));
\r
166 g.drawLine(x + 0, y + h - 1, x + w - 1, y + h - 1);
\r
168 g.setColor(new Color(0xD7D3CB));
\r
169 g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
\r
173 * Return the i'th color from the color model.
\r
177 * @return i'th color from color model.
\r
179 public Color getColor(int col) {
\r
180 return _pixxConfiguration.getColor(col);
\r
184 * Get the current IRC color model.
\r
186 * @return the irc color model.
\r
188 public PixxColorModel getPixxColorModel() {
\r
189 return _pixxConfiguration.getColorModel();
\r