1 /* KDevelop Output View
3 * Copyright 2006-2007 Andreas Pakulat <apaku@gmx.de>
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef KDEVIOUTPUTVIEW_H
22 #define KDEVIOUTPUTVIEW_H
24 #include <interfaces/iextension.h>
30 class QAbstractItemModel
;
32 class QAbstractItemDelegate
;
35 @author Andreas Pakulat
46 AllowUserClose
= 0x1 /**< allow the user to close the view */,
47 AlwaysShowView
= 0x2 /**< always show the view */,
48 AutoScroll
= 0x4 /**< automatically scroll the view */
50 Q_DECLARE_FLAGS(Behaviours
, Behaviour
)
54 OneView
= 0 /**< there's only one outputview, newly registered outputs will replace existing ones */,
55 HistoryView
= 1 /**< The toolview will have a history with forward/backward buttons */,
56 MultipleView
= 2 /**< show multiples outputs in a toolview at the same time */
61 BuildView
= 0 /**< the standard outputview for building output */,
62 RunView
= 1 /**< the standard outputview for running apps */,
63 DebugView
= 2 /**< the standard outputview for debugging apps */,
64 TestView
= 4 /**< the standard outputview for verbose test output */
67 virtual ~IOutputView() {}
70 * fetch the identifier for one of the standard toolviews
71 * This will automatically create the toolview if it doesn't exist yet
72 * @param view the standard toolview to get the identifier for
73 * @returns the identifier for the standard toolview
75 virtual int standardToolView( StandardToolView view
) = 0;
78 * Register a new toolview for output with the given title, behaviour and type
79 * If there already exists a toolview with this title and type return the existing id
80 * @param title the Title to be displayed on the toolview
81 * @param type the type of view that should be created
82 * @returns an toolview id that identifies the new view and is used in the other
85 virtual int registerToolView( const QString
& title
, ViewType type
= OneView
, const KIcon
& icon
= KIcon() ) = 0;
88 * Register a new output view in a given toolview. How this new view is created depends
89 * on the type of the toolview.
90 * @param toolviewId the id of the toolview, created by registerToolView
91 * @param title the title to use for the new output in the toolview
92 * @param behaviour the Behaviour of the output
93 * @returns an id to supply to the other methods
95 virtual int registerOutputInToolView( int toolviewId
, const QString
& title
, Behaviours behaviour
= AllowUserClose
) = 0;
100 virtual void raiseOutput( int id
) = 0;
102 virtual void scrollOutputTo( int id
, const QModelIndex
& ) = 0;
110 * Sets the model of the registered output identified by id to model
111 * Does nothing if the id doesn't exist
113 * \param takeOwnership If true, the output view plugin takes ownership of the model,
114 * and deletes it when the view is removed. If false, the ownership
115 * remains with the caller.
118 virtual void setModel( int id
, QAbstractItemModel
* model
, Ownership takeOwnership
= KeepOwnership
) = 0;
121 * Sets the item delegate of the registered output identified by id to @p delegate
122 * Does nothing if the id doesn't exist
124 * \param takeOwnership If true, the output view plugin takes ownership of the model,
125 * and deletes it when the view is removed. If false, the ownership
126 * remains with the caller.
129 virtual void setDelegate( int id
, QAbstractItemDelegate
* model
, Ownership takeOwnership
= KeepOwnership
) = 0;
132 * remove a toolview, don't forget to emit toolViewRemoved when you implement this
134 * @param id identifies the view to remove
136 virtual void removeToolView( int id
) = 0;
139 * remove an output view from a toolview. Don't forget to emit outputRemoved
140 * when you implement this.
141 * @param toolviewId the id of the toolview containing the output
142 * @param id the id of the outputview to remove
144 virtual void removeOutput( int id
) = 0;
148 * emitted after a toolview was removed
150 * @param id identifies the removed toolview
152 void toolViewRemoved( int id
);
155 * emitted after a toolview was removed
157 * @param toolviewId identifies the removed toolview
158 * @param id identifies the removed output
160 void outputRemoved( int toolviewId
, int id
);
163 Q_DECLARE_OPERATORS_FOR_FLAGS(IOutputView::Behaviours
)
166 KDEV_DECLARE_EXTENSION_INTERFACE_NS( KDevelop
, IOutputView
, "org.kdevelop.IOutputView" )
167 Q_DECLARE_INTERFACE( KDevelop::IOutputView
, "org.kdevelop.IOutputView" )