1
/* This file is part of the KDE project
3
Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library 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 GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H
22
#define KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H
24
#include <KTextEditor/Plugin>
25
#include <KTextEditor/MainWindow>
30
#include <KXMLGUIClient>
32
class TabSwitcherPluginView;
33
class TabSwitcherTreeView;
34
class QStandardItemModel;
37
class TabSwitcherPlugin : public KTextEditor::Plugin
41
friend TabSwitcherPluginView;
47
explicit TabSwitcherPlugin(QObject *parent = 0, const QList<QVariant> & = QList<QVariant>());
52
virtual ~TabSwitcherPlugin();
55
* Create a new tab switcher for @p mainWindow.
57
QObject *createView(KTextEditor::MainWindow *mainWindow) Q_DECL_OVERRIDE;
60
QList<TabSwitcherPluginView *> m_views;
63
class TabSwitcherPluginView : public QObject, public KXMLGUIClient
71
TabSwitcherPluginView(TabSwitcherPlugin *plugin, KTextEditor::MainWindow *mainWindow);
76
virtual ~TabSwitcherPluginView();
79
* Setup the shortcut actions.
84
* Initial fill of model with documents from the application.
90
* Adds @p document to the model.
92
void registerDocument(KTextEditor::Document * document);
95
* Removes @p document from the model.
97
void unregisterDocument(KTextEditor::Document * document);
100
* Update the name in the model for @p document.
102
void updateDocumentName(KTextEditor::Document * document);
105
* Raise @p view in a lru fasion.
107
void raiseView(KTextEditor::View * view);
110
* Focus next item in the treeview.
115
* Focus previous item in the treeview.
120
* Activate the document for @p index.
122
void switchToClicked(const QModelIndex& index);
125
* Show the document for @p index.
127
void activateView(const QModelIndex& index);
131
* Move through the list.
133
void walk(const int from, const int to);
136
* Make sure the popup view has a sane size.
138
void updateViewGeometry();
141
TabSwitcherPlugin *m_plugin;
142
KTextEditor::MainWindow *m_mainWindow;
143
QStandardItemModel * m_model;
144
TabSwitcherTreeView * m_treeView;
147
#endif // KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H