1
/***************************************************************************
2
plugin_katetabbarextension.h
5
copyright : (C) 2004-2005 by Dominik Haumann
7
***************************************************************************/
9
/***************************************************************************
10
This program is free software; you can redistribute it and/or
11
modify it under the terms of the GNU General Public License
12
as published by the Free Software Foundation; either version 2
13
of the License, or (at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
***************************************************************************/
25
#ifndef PLUGIN_KATETABBAREXTENSION_H
26
#define PLUGIN_KATETABBAREXTENSION_H
28
#include <kate/application.h>
29
#include <kate/documentmanager.h>
30
#include <kate/mainwindow.h>
31
#include <kate/plugin.h>
32
#include <kate/pluginconfigpageinterface.h>
34
#include <ktexteditor/document.h>
35
#include <ktexteditor/view.h>
36
#include <ktexteditor/modificationinterface.h>
38
#include <klibloader.h>
42
#include <qpushbutton.h>
51
class KateTabBarExtension;
52
class KateTabBarExtensionConfigPage;
55
class PluginView : public Kate::PluginView
58
friend class KatePluginTabBarExtension;
61
PluginView( Kate::MainWindow* mainwindow );
62
virtual ~PluginView();
64
void updateLocation();
66
void readSessionConfig (KConfigBase* config, const QString& groupPrefix);
67
void writeSessionConfig (KConfigBase* config, const QString& groupPrefix);
70
void currentTabChanged( int button_id );
71
void closeTabRequest( int button_id );
72
void slotDocumentCreated( KTextEditor::Document* document );
73
void slotDocumentDeleted( KTextEditor::Document* document );
74
void slotViewChanged();
75
void slotDocumentChanged( KTextEditor::Document* );
76
void slotModifiedOnDisc( KTextEditor::Document* document, bool modified,
77
KTextEditor::ModificationInterface::ModifiedOnDiskReason reason );
78
void slotNameChanged( KTextEditor::Document* document );
82
QMap<int, KTextEditor::Document*> id2doc;
83
QMap<KTextEditor::Document*, int> doc2id;
86
class KatePluginTabBarExtension : public Kate::Plugin, public Kate::PluginConfigPageInterface
89
Q_INTERFACES(Kate::PluginConfigPageInterface)
91
explicit KatePluginTabBarExtension( QObject* parent = 0, const QStringList& = QStringList() );
92
virtual ~KatePluginTabBarExtension();
94
Kate::PluginView *createView (Kate::MainWindow *mainWindow);
96
void readSessionConfig (KConfigBase* config, const QString& groupPrefix);
97
void writeSessionConfig (KConfigBase* config, const QString& groupPrefix);
99
// Kate::PluginConfigPageInterface
100
uint configPages () const { return 0; } // if changed to 1, the config pages appears
101
Kate::PluginConfigPage *configPage (uint , QWidget *w, const char *name=0);
102
QString configPageName(uint) const { return i18n("Tab Bar Extension"); }
103
QString configPageFullName(uint) const { return i18n("Configure Tab Bar Extension"); }
104
KIcon configPageIcon(uint) const { return KIcon(); }
107
void applyConfig( KateTabBarExtensionConfigPage* );
110
void tabbarSettingsChanged( KTinyTabBar* tabbar );
111
void tabbarHighlightMarksChanged( KTinyTabBar* tabbar );
114
void initConfigPage( KateTabBarExtensionConfigPage* );
117
QList<PluginView*> m_views;
123
* The tabbar's config page
125
class KateTabBarExtensionConfigPage : public Kate::PluginConfigPage
129
friend class KatePluginTabBarExtension;
132
explicit KateTabBarExtensionConfigPage (QObject* parent = 0L, QWidget *parentWidget = 0L);
133
~KateTabBarExtensionConfigPage ();
136
* Reimplemented from Kate::PluginConfigPage
137
* just emits configPageApplyRequest( this ).
139
virtual void apply();
141
virtual void reset () { ; }
142
virtual void defaults () { ; }
146
* Ask the plugin to set initial values
148
void configPageApplyRequest( KateTabBarExtensionConfigPage* );
151
* Ask the plugin to apply changes
153
void configPageInitRequest( KateTabBarExtensionConfigPage* );
156
QCheckBox* pSortAlpha;
159
#endif // PLUGIN_KATETABBAREXTENSION_H