summaryrefslogtreecommitdiffstats
path: root/konversation/src/ircinput.h
blob: a2d5a9f56a16d90d1e22e7b0df64765d23881777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

/*
  The line input widget with chat enhanced functions
  begin:     Tue Mar 5 2002
  copyright: (C) 2002 by Dario Abatianni
  email:     eisfuchs@tigress.com
*/

#ifndef IRCINPUT_H
#define IRCINPUT_H

#include <tqstringlist.h>

#include <ktextedit.h>


class TDECompletionBox;
class TQMouseEvent;

class IRCInput : public KTextEdit
{
    TQ_OBJECT
  

    public:
        explicit IRCInput(TQWidget* parent);
        ~IRCInput();

        void setCompletionMode(char mode);
        char getCompletionMode();
        void setOldCursorPosition(int pos);
        int getOldCursorPosition();
        TQString lastCompletion() const { return m_lastCompletion; }

        virtual TQSize sizeHint() const;
        TQString text() const;

    signals:
        void nickCompletion();
        void endCompletion();                     // tell channel that completion phase is over
        void history(bool up);
        void textPasted(const TQString& text);
        void submit();
        void envelopeCommand();

    public slots:
        void paste();
        void paste(bool useSelection);
        void showCompletionList(const TQStringList& nicks);
        void setText(const TQString& text);
        void setLastCompletion(const TQString& completion);
        virtual void setOverwriteMode(bool) { }
        virtual void resizeContents( int w, int h );
        virtual void updateAppearance();

    protected slots:
        void getHistory(bool up);
        void insertCompletion(const TQString& nick);
        void disableSpellChecking();
        virtual void slotSpellCheckDone(const TQString& s);

    protected:
        bool eventFilter(TQObject *object,TQEvent *event);
        void addHistory(const TQString& text);
        bool checkPaste(TQString& text);
        void contentsMouseReleaseEvent(TQMouseEvent *);

        virtual void keyPressEvent(TQKeyEvent* e);
        virtual TQPopupMenu *createPopupMenu( const TQPoint& pos );
        virtual void showEvent(TQShowEvent* e);
        virtual void hideEvent(TQHideEvent* e);

        TQStringList historyList;
        unsigned int lineNum;
        unsigned int oldPos;
        char completionMode;
        TDECompletionBox* completionBox;
        TQString m_lastCompletion;
        bool m_useSelection;
        bool m_multiRow;
        int m_lastHeight; //essentially corresponds to qtextbrowser::doc->height()
        int m_qtBoxPadding; //see comment in constructor

        TQTimer* m_disableSpellCheckTimer;
};
#endif