[2] | 1 | /*
|
---|
| 2 | * msgmle.h - subclass of PsiTextView to handle various hotkeys
|
---|
| 3 | * Copyright (C) 2001-2003 Justin Karneges, Michail Pishchagin
|
---|
| 4 | *
|
---|
| 5 | * This program is free software; you can redistribute it and/or
|
---|
| 6 | * modify it under the terms of the GNU General Public License
|
---|
| 7 | * as published by the Free Software Foundation; either version 2
|
---|
| 8 | * of the License, or (at your option) any later version.
|
---|
| 9 | *
|
---|
| 10 | * This program is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
| 14 | *
|
---|
| 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this library; if not, write to the Free Software
|
---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 18 | *
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | #ifndef MSGMLE_H
|
---|
| 22 | #define MSGMLE_H
|
---|
| 23 |
|
---|
| 24 | #include"psitextview.h"
|
---|
| 25 |
|
---|
| 26 | class QTimer;
|
---|
| 27 |
|
---|
| 28 | class ChatView : public PsiTextView
|
---|
| 29 | {
|
---|
| 30 | Q_OBJECT
|
---|
| 31 | public:
|
---|
| 32 | ChatView(QWidget *parent, const char *name = 0);
|
---|
| 33 | ~ChatView();
|
---|
| 34 |
|
---|
| 35 | protected:
|
---|
| 36 | // override the tab/esc behavior
|
---|
| 37 | bool focusNextPrevChild(bool next);
|
---|
| 38 | void keyPressEvent(QKeyEvent *);
|
---|
| 39 | void resizeEvent(QResizeEvent *);
|
---|
| 40 |
|
---|
| 41 | protected slots:
|
---|
| 42 | void autoCopy(bool copyAvailable);
|
---|
| 43 | };
|
---|
| 44 |
|
---|
| 45 | class ChatEdit : public PsiTextView
|
---|
| 46 | {
|
---|
| 47 | public:
|
---|
| 48 | ChatEdit(QWidget *parent, const char *name = 0);
|
---|
| 49 | ~ChatEdit();
|
---|
| 50 |
|
---|
| 51 | protected:
|
---|
| 52 | void keyPressEvent(QKeyEvent *);
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | class LineEdit : public ChatEdit
|
---|
| 57 | {
|
---|
| 58 | Q_OBJECT
|
---|
| 59 | public:
|
---|
| 60 | LineEdit(QWidget *parent, const char *name = 0);
|
---|
| 61 | ~LineEdit();
|
---|
| 62 |
|
---|
| 63 | QSize minimumSizeHint() const;
|
---|
| 64 | QSize sizeHint() const;
|
---|
| 65 | bool eventFilter(QObject *watched, QEvent *e);
|
---|
| 66 |
|
---|
| 67 | public slots:
|
---|
| 68 | void recalculateSize();
|
---|
| 69 | void setUpdatesEnabled( bool enable );
|
---|
| 70 |
|
---|
| 71 | private slots:
|
---|
| 72 | void checkMoved();
|
---|
| 73 |
|
---|
| 74 | protected:
|
---|
| 75 | void resizeEvent( QResizeEvent * );
|
---|
| 76 | bool allowResize() const;
|
---|
| 77 | bool movedWindow() const;
|
---|
| 78 |
|
---|
| 79 | private:
|
---|
| 80 | QTimer *moveTimer;
|
---|
| 81 | mutable QSize lastSize;
|
---|
| 82 | mutable QRect initialWindowGeometry; // used to return window to its original location
|
---|
| 83 | mutable QPoint moveTo; // used to differentiate user move message from the ones generated by LineEdit
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | #endif
|
---|