~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to lib/interfaces/kdevpartcontroller.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
3
 
   Copyright (C) 2002 Bernd Gehrmann <bernd@kdevelop.org>
4
 
   Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
5
 
   Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
6
 
   Copyright (C) 2003 Harald Fernengel <harry@kdevelop.org>
7
 
   Copyright (C) 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
8
 
   Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
9
 
 
10
 
   This library is free software; you can redistribute it and/or
11
 
   modify it under the terms of the GNU Library General Public
12
 
   License as published by the Free Software Foundation; either
13
 
   version 2 of the License, or (at your option) any later version.
14
 
 
15
 
   This library 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 GNU
18
 
   Library General Public License for more details.
19
 
 
20
 
   You should have received a copy of the GNU Library General Public License
21
 
   along with this library; see the file COPYING.LIB.  If not, write to
22
 
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
 
   Boston, MA 02111-1307, USA.
24
 
*/
25
 
#ifndef KDEV_PARTCONTROLLER_H
26
 
#define KDEV_PARTCONTROLLER_H
27
 
 
28
 
#include <kurl.h>
29
 
#include <kparts/partmanager.h>
30
 
#include <ktrader.h>
31
 
 
32
 
/**
33
 
@file kdevpartcontroller.h
34
 
KDevelop part controller interface.
35
 
*/
36
 
 
37
 
namespace KParts
38
 
{
39
 
    class ReadOnlyPart;
40
 
}
41
 
 
42
 
/**Document state enum.*/
43
 
enum DocumentState
44
 
{
45
 
    Clean,            /**<Document is not touched.*/
46
 
    Modified,         /**<Document is modified inside a shell.*/
47
 
    Dirty,            /**<Document is modified by an external process.*/
48
 
    DirtyAndModified  /**<Document is modified inside a shell and at the same time by an external process.*/
49
 
};
50
 
 
51
 
/**
52
 
Interface to control loaded parts and other documents.
53
 
Part controller works with embedded into the shell parts. Such parts are usually editors,
54
 
GUI designers, etc.
55
 
*/
56
 
class KDevPartController: public KParts::PartManager
57
 
{
58
 
    Q_OBJECT
59
 
 
60
 
public:
61
 
    /**Constructor.
62
 
    @param parent The parent object.*/
63
 
    KDevPartController(QWidget *parent);
64
 
    
65
 
    /**Call this before a call to @ref editDocument to set the encoding of the
66
 
    document to be opened.
67
 
    @param encoding The encoding to open as.*/
68
 
    virtual void setEncoding(const QString &encoding) = 0;
69
 
    
70
 
    /**Opens a new or existing document.
71
 
    @param url The URL of the document to open.
72
 
    @param lineNum The line number to place the cursor at, if applicable.
73
 
    @param col The column number to place the cursor at, if applicable.*/
74
 
    virtual void editDocument(const KURL &url, int lineNum=-1, int col=-1) = 0;
75
 
    
76
 
    /**Opens a new or existing document by splitting the view with the current,
77
 
    if applicable. Offers split views of source code and header files for instance.
78
 
    @param url The URL of the document to open.
79
 
    @param lineNum The line number to place the cursor at, if applicable.
80
 
    @param col The column number to place the cursor at, if applicable.*/
81
 
    virtual void splitCurrentDocument(const KURL &url, int lineNum=-1, int col=-1) = 0;
82
 
    
83
 
    /**Scrolls the viewport of the already opened document to the specified line
84
 
    and column if applicable, but does not give focus to the document.
85
 
    @param url The URL of the already opened document.
86
 
    @param lineNum The line number to place the cursor at, if applicable.
87
 
    @param col The column number to place the cursor at, if applicable.*/
88
 
    virtual void scrollToLineColumn(const KURL &url, int lineNum=-1, int col=-1, bool storeHistory = false ) = 0;
89
 
    
90
 
    /**Shows a HTML document in the documentation viewer.
91
 
    @param url The URL of the document to view.
92
 
    @param newWin If true, the new window will be created instead of using current.*/
93
 
    virtual void showDocument(const KURL &url, bool newWin = false) = 0;
94
 
    
95
 
    /**Embeds a part into the main area of the mainwindow.
96
 
    @param part The part to embed.
97
 
    @param name The name of the part.
98
 
    @param shortDescription Currently not used.*/
99
 
    virtual void showPart(KParts::Part* part, const QString& name, const QString& shortDescription ) = 0;
100
 
    
101
 
    /**Finds the embedded part corresponding to a given URL.
102
 
    @param url The URL of the document.
103
 
    @return The corresponding part, 0 if not found.*/
104
 
    virtual KParts::ReadOnlyPart *partForURL(const KURL & url) = 0;
105
 
        
106
 
    /**Finds the embedded part corresponding to a given main widget
107
 
    @param widget The parts main widget.
108
 
    @return The corresponding part, 0 if not found.*/
109
 
    virtual KParts::Part *partForWidget(const QWidget *widget) = 0;
110
 
    
111
 
    /**@return The list of open documents*/
112
 
    virtual KURL::List openURLs() = 0;
113
 
    
114
 
    /**Saves all open files.
115
 
     @return false if it was cancelled by the user, true otherwise */
116
 
    virtual bool saveAllFiles() = 0;
117
 
    
118
 
    /**Saves a list of files.
119
 
    @param list The list of URLs to save.
120
 
    @return false if it was cancelled by the user, true otherwise */
121
 
    virtual bool saveFiles(const KURL::List &list) = 0;
122
 
    
123
 
    /**Reloads all open files.*/
124
 
    virtual void revertAllFiles() = 0;
125
 
    
126
 
    /**Reloads a list of files.
127
 
    * @param list The list of URLs to reload.*/
128
 
    virtual void revertFiles(const KURL::List &list) = 0;
129
 
    
130
 
    /**Closes all open files.*/
131
 
    virtual bool closeAllFiles() = 0;
132
 
    
133
 
    /**Closes a list of files.
134
 
    @param list The list of URLs for the files to close.*/
135
 
    virtual bool closeFiles(const KURL::List &list) = 0;
136
 
    
137
 
    /**Closes this part (closes the window/tab for this part).
138
 
    @param part The part to close.
139
 
    @return true if the part was sucessfuly closed.*/
140
 
    virtual bool closePart(KParts::Part *part) = 0;  
141
 
    
142
 
    /**Activate this part.
143
 
    @param part The part to activate.*/
144
 
    virtual void activatePart( KParts::Part * part ) = 0;
145
 
    
146
 
    /**Checks the state of a document.
147
 
    @param url The URL to check. 
148
 
    @return The DocumentState enum corresponding to the document state.*/
149
 
    virtual DocumentState documentState( KURL const & url ) = 0;
150
 
    
151
 
signals:
152
 
    
153
 
    /**Emitted when a document has been saved.*/
154
 
    void savedFile(const KURL &);
155
 
    
156
 
    /**Emitted when a document has been loaded.*/
157
 
    void loadedFile(const KURL &);
158
 
    
159
 
    /**Emitted when a document has been closed.*/
160
 
    void closedFile(const KURL &);
161
 
    
162
 
    /**Emitted when a file has been modified outside of KDevelop.*/
163
 
    void fileDirty(const KURL &);
164
 
    
165
 
    /**This is typically emitted when an editorpart does "save as"
166
 
    which will change the part's URL.*/
167
 
    void partURLChanged(KParts::ReadOnlyPart *);
168
 
    
169
 
    /**This is emitted when the document changes, 
170
 
    either internally or on disc.*/
171
 
    void documentChangedState(const KURL &, DocumentState);
172
 
 
173
 
};
174
 
 
175
 
#endif