Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ircmisc.h

Go to the documentation of this file.
00001 /*
00002     OpieIRC - An embedded IRC client
00003     Copyright (C) 2002 Wenzel Jakob
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 */
00020 
00021 #ifndef __IRCMISC_H
00022 #define __IRCMISC_H
00023 
00024 #include <qtabwidget.h>
00025 #include <qlineedit.h>
00026 #include <qtabbar.h>
00027 #include <qlabel.h>
00028 #include <qcolor.h>
00029 #include <qarray.h>
00030 
00031 namespace Opie {
00032 namespace Core {
00033 class OKeyConfigManager;
00034 }
00035 }
00036 
00037 
00038 /* Custom colored QTabWidget */
00039 
00040 class QExtTab : public QTab {
00041 public:
00042     QColor color;
00043 };
00044 
00045 class IRCTabWidget : public QTabWidget {
00046     Q_OBJECT
00047 public:
00048     IRCTabWidget(QWidget *parent = 0, const char *name = 0);
00049     void setTabColor(int index, QColor color);
00050 };
00051 
00052 class IRCTabBar : public QTabBar {
00053     Q_OBJECT
00054 public:
00055     IRCTabBar(QWidget *parent = 0, const char *name = 0);
00056     void setTabColor(int index, QColor color);
00057 protected:
00058     void paintLabel(QPainter*, const QRect&, QTab*, bool) const;
00059     int insertTab(QTab *, int index = -1);
00060 protected:
00061     QArray<QColor> m_colors;
00062 };
00063 
00064 /* A QLineEdit with history functionality and tab completion */
00065 
00066 class IRCHistoryLineEdit : public QLineEdit {
00067     Q_OBJECT
00068 public:
00069     enum KeyMode {
00070         KeyNextTab,
00071         KeyPrevTab,
00072         KeyCloseTab
00073     };
00074 
00075     static Opie::Core::OKeyConfigManager* keyConfigInstance();
00076 
00077     IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
00078     virtual bool eventFilter(QObject *object, QEvent *event);
00079 public slots:
00080     void setEditFocus();
00081 signals:
00082     void nextTab();
00083     void prevTab();
00084     void closeTab();
00085 
00086 
00087 protected:
00088     void keyPressEvent(QKeyEvent *);
00089 protected:
00090     QStringList m_history;
00091     int         m_index;
00092 };
00093 
00094 #endif /* __IRCMISC_H */

Generated on Sat Nov 5 16:17:41 2005 for OPIE by  doxygen 1.4.2