sublime
controller.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SUBLIMECONTROLLER_H
00020 #define SUBLIMECONTROLLER_H
00021
00022 #include <QtCore/QObject>
00023
00024 #include "sublimedefs.h"
00025 #include "sublimeexport.h"
00026
00027 #include "mainwindowoperator.h"
00028
00029
00030 namespace Sublime {
00031
00032 class Area;
00033 class AreaIndex;
00034 class Document;
00035 class MainWindow;
00036
00089 class SUBLIME_EXPORT Controller: public QObject, public MainWindowOperator {
00090 Q_OBJECT
00091 public:
00092 Controller(QObject *parent = 0);
00093 ~Controller();
00094
00096 void addDefaultArea(Area *area);
00097
00099 const QList<Area*> &defaultAreas() const;
00100
00102 Area *defaultArea(const QString &id);
00103
00108 void addMainWindow(MainWindow* mainWindow);
00109
00112 const QList<MainWindow*> &mainWindows() const;
00113
00116 const QList<Area*> &areas(int mainWindow) const;
00117
00120 Area *area(int mainWindow, const QString& id);
00121
00123 void showArea(Area *area, MainWindow *mainWindow);
00124
00126 void showArea(const QString& areaTypeId, MainWindow *mainWindow);
00127
00131 void resetCurrentArea(MainWindow *mainWindow);
00132
00135 const QList<Area*> &allAreas() const;
00136
00138 const QList<Document*> &documents() const;
00139
00140 void setStatusIcon(Document* document, const QIcon& icon);
00141
00142 public Q_SLOTS:
00143
00145 void areaReleased();
00147 void areaReleased(Sublime::Area *area);
00148
00149 protected:
00150 bool eventFilter(QObject *obj, QEvent *ev);
00151 void showAreaInternal(Area* area, MainWindow *mainWindow);
00152
00153 private Q_SLOTS:
00154 void notifyToolViewRemoved(Sublime::View *view, Sublime::Position);
00155 void notifyToolViewAdded(Sublime::View *view, Sublime::Position);
00156 void notifyViewRemoved(Sublime::AreaIndex*, Sublime::View *view);
00157 void notifyViewAdded(Sublime::AreaIndex*, Sublime::View *view);
00158
00159 Q_SIGNALS:
00160 void aboutToRemoveToolView(Sublime::View*);
00161 void toolViewAdded(Sublime::View*);
00162 void aboutToRemoveView(Sublime::View*);
00163 void viewAdded(Sublime::View*);
00164 void toolViewMoved(Sublime::View*);
00165
00166 private:
00167 void init();
00168 Q_PRIVATE_SLOT(d, void removeArea(QObject*))
00169 Q_PRIVATE_SLOT(d, void removeDocument(QObject*))
00170
00171
00173 void addDocument(Document *document);
00174
00175 struct ControllerPrivate *const d;
00176
00177 friend class Area;
00178 friend class Document;
00179
00180 };
00181
00182 }
00183
00184 #endif
00185