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 | // override the tab/esc behavior
|
---|
53 | bool focusNextPrevChild(bool next);
|
---|
54 | void keyPressEvent(QKeyEvent *);
|
---|
55 | };
|
---|
56 |
|
---|
57 |
|
---|
58 | class LineEdit : public ChatEdit
|
---|
59 | {
|
---|
60 | Q_OBJECT
|
---|
61 | public:
|
---|
62 | LineEdit(QWidget *parent, const char *name = 0);
|
---|
63 | ~LineEdit();
|
---|
64 |
|
---|
65 | QSize minimumSizeHint() const;
|
---|
66 | QSize sizeHint() const;
|
---|
67 | bool eventFilter(QObject *watched, QEvent *e);
|
---|
68 |
|
---|
69 | public slots:
|
---|
70 | void recalculateSize();
|
---|
71 | void setUpdatesEnabled( bool enable );
|
---|
72 |
|
---|
73 | private slots:
|
---|
74 | void checkMoved();
|
---|
75 |
|
---|
76 | protected:
|
---|
77 | void resizeEvent( QResizeEvent * );
|
---|
78 | bool allowResize() const;
|
---|
79 | bool movedWindow() const;
|
---|
80 |
|
---|
81 | private:
|
---|
82 | QTimer *moveTimer;
|
---|
83 | mutable QSize lastSize;
|
---|
84 | mutable QRect initialWindowGeometry; // used to return window to its original location
|
---|
85 | mutable QPoint moveTo; // used to differentiate user move message from the ones generated by LineEdit
|
---|
86 | };
|
---|
87 |
|
---|
88 |
|
---|
89 | #endif
|
---|