OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / texteditor / basehoverhandler.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef BASEHOVERHANDLER_H
34 #define BASEHOVERHANDLER_H
35
36 #include "texteditor_global.h"
37 #include "helpitem.h"
38
39 #include <QtCore/QObject>
40 #include <QtCore/QString>
41
42 QT_BEGIN_NAMESPACE
43 class QPoint;
44 QT_END_NAMESPACE
45
46 namespace Core {
47 class IEditor;
48 }
49
50 namespace TextEditor {
51
52 class ITextEditor;
53 class BaseTextEditorWidget;
54
55 class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject
56 {
57     Q_OBJECT
58 public:
59     BaseHoverHandler(QObject *parent = 0);
60     virtual ~BaseHoverHandler();
61
62 private slots:
63     void editorOpened(Core::IEditor *editor);
64
65 public slots:
66     void showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos);
67     void updateContextHelpId(TextEditor::ITextEditor *editor, int pos);
68
69 protected:
70     void setToolTip(const QString &tooltip);
71     void appendToolTip(const QString &extension);
72     const QString &toolTip() const;
73
74     void addF1ToToolTip();
75
76     void setIsDiagnosticTooltip(bool isDiagnosticTooltip);
77     bool isDiagnosticTooltip() const;
78
79     void setLastHelpItemIdentified(const HelpItem &help);
80     const HelpItem &lastHelpItemIdentified() const;
81
82     static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor);
83
84 private:
85     void clear();
86     void process(ITextEditor *editor, int pos);
87
88     virtual bool acceptEditor(Core::IEditor *editor) = 0;
89     virtual void identifyMatch(ITextEditor *editor, int pos) = 0;
90     virtual void decorateToolTip();
91     virtual void operateTooltip(ITextEditor *editor, const QPoint &point);
92
93     bool m_diagnosticTooltip;
94     QString m_toolTip;
95     HelpItem m_lastHelpItemIdentified;
96 };
97
98 } // namespace TextEditor
99
100 #endif // BASEHOVERHANDLER_H