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.BorderLayout;
\r
33 import java.awt.Panel;
\r
36 * A scrollable nick list.
\r
38 public class ScrollablePixxNickList extends PixxPanel implements PixxScrollBarListener {
\r
39 private PixxNickList _list;
\r
40 private PixxVerticalScrollBar _scroll;
\r
43 * Create a new ScrollablePixxNickList.
\r
46 * the global irc configuration.
\r
48 * known nick prefixes.
\r
50 public ScrollablePixxNickList(PixxConfiguration config, char[] prefixes) {
\r
52 setLayout(new BorderLayout());
\r
53 Panel p = new Panel();
\r
54 p.setLayout(new BorderLayout());
\r
56 _list = new PixxNickList(config, prefixes);
\r
57 _scroll = new PixxVerticalScrollBar(config, 0, 0, 0.1);
\r
58 _scroll.addPixxScrollBarListener(this);
\r
59 p.add(_list, BorderLayout.CENTER);
\r
60 p.add(_scroll, BorderLayout.EAST);
\r
62 add(p, BorderLayout.CENTER);
\r
63 add(new PixxSeparator(PixxSeparator.BORDER_LEFT), BorderLayout.WEST);
\r
64 add(new PixxSeparator(PixxSeparator.BORDER_RIGHT), BorderLayout.EAST);
\r
65 add(new PixxSeparator(PixxSeparator.BORDER_UP), BorderLayout.NORTH);
\r
66 add(new PixxSeparator(PixxSeparator.BORDER_DOWN), BorderLayout.SOUTH);
\r
70 public void release() {
\r
71 _scroll.removePixxScrollBarListener(this);
\r
83 * the listener to add.
\r
85 public void addPixxNickListListener(PixxNickListListener lis) {
\r
86 _list.addPixxNickListListener(lis);
\r
90 * Remove a listener.
\r
93 * the listener to remove.
\r
95 public void removePixxNickListListener(PixxNickListListener lis) {
\r
96 _list.removePixxNickListListener(lis);
\r
100 * Set all the nicks.
\r
105 public void set(String[] nicks) {
\r
107 _scroll.setMaximum(_list.getNickCount() - 1);
\r
116 public void add(String nick) {
\r
118 _scroll.setMaximum(_list.getNickCount() - 1);
\r
122 * Remove all nicks.
\r
125 public void removeAll() {
\r
127 _scroll.setMaximum(_list.getNickCount() - 1);
\r
131 public void valueChanged(PixxScrollBar pixScrollBar) {
\r
132 _list.setBase(pixScrollBar.getValue());
\r
136 * Clear any off-screen ressources. The next display might be slower.
\r
138 public void dispose() {
\r