Fix no newlines warnings. Patch by Peter Oberndorfer
[kdevelopdvcssupport.git] / sublime / mainwindow_p.h
blob7c67a0ce318b1735ef7e22f6219caa176e83bbbf
1 /***************************************************************************
2 * Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU Library General Public License as *
6 * published by the Free Software Foundation; either version 2 of the *
7 * License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Library General Public *
15 * License along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
19 #ifndef SUBLIMEMAINWINDOW_P_H
20 #define SUBLIMEMAINWINDOW_P_H
22 #include <QMap>
23 #include <QObject>
24 #include <QSet>
26 #include "area.h"
27 #include "sublimedefs.h"
29 #include "mainwindow.h"
30 #include "ideallayout.h"
32 class QMenu;
33 class QAction;
34 class QSplitter;
35 class QDockWidget;
36 class QComboBox;
38 namespace Sublime {
40 class View;
41 class Container;
42 class Controller;
43 class AreaIndex;
44 class IdealMainWidget;
46 class MainWindowPrivate: public QObject {
47 Q_OBJECT
48 public:
49 MainWindowPrivate(MainWindow *w, Controller* controller);
51 /**Use this to create tool views for an area.*/
52 class IdealToolViewCreator {
53 public:
54 IdealToolViewCreator(MainWindowPrivate *_d): d(_d) {}
55 Area::WalkerMode operator() (View *view, Sublime::Position position);
56 private:
57 MainWindowPrivate *d;
60 /**Use this to create views for an area.*/
61 class ViewCreator {
62 public:
63 ViewCreator(MainWindowPrivate *_d): d(_d) {}
64 Area::WalkerMode operator() (AreaIndex *index);
65 private:
66 MainWindowPrivate *d;
69 /**Reconstructs the mainwindow according to the current area.*/
70 void reconstruct();
71 /**Clears the area leaving mainwindow empty.*/
72 void clearArea();
74 void activateFirstVisibleView();
76 /**Updates all QDockWidgets to the TitleBarMode that is set*/
77 void applyVerticalTitleBarMode();
79 void setStatusIcon(View* view, const QIcon& icon);
81 Controller *controller;
82 Area *area;
83 QList<View*> docks;
84 QMap<View*, Container*> viewContainers;
85 QMap<QWidget*, View*> widgetToView;
87 View *activeView;
88 View *activeToolView;
90 QWidget *centralWidget;
92 IdealMainWidget *idealMainWidget;
93 int ignoreDockShown;
94 bool autoAreaSettingsSave;
96 public slots:
97 void viewAdded(Sublime::AreaIndex *index, Sublime::View *view);
98 void raiseToolView(Sublime::View* view);
99 void aboutToRemoveView(Sublime::AreaIndex *index, Sublime::View *view);
100 void toolViewAdded(Sublime::View *toolView, Sublime::Position position);
101 void aboutToRemoveToolView(Sublime::View *toolView, Sublime::Position position);
102 void toolViewMoved(Sublime::View *toolView, Sublime::Position position);
104 private slots:
105 void switchToArea(QAction *action);
106 void updateAreaSwitcher(Sublime::Area *area);
107 void slotDockShown(Sublime::View*, Sublime::Position, bool);
108 void widgetResized(IdealMainLayout::Role role, int thickness);
109 void widgetCloseRequest(QWidget* widget);
111 protected:
112 virtual bool eventFilter(QObject *, QEvent *event);
114 private:
115 Qt::DockWidgetArea positionToDockArea(Position position);
116 void recreateCentralWidget();
118 MainWindow *m_mainWindow;
119 QMap<AreaIndex*, QSplitter*> m_indexSplitters;
120 friend class AreaSelectionAction;
122 QMap<Area*, QAction*> m_areaActions;
123 QMap<QAction*, Area*> m_actionAreas;
126 class AreaSelectorWidget : public QWidget
128 Q_OBJECT
129 public:
130 AreaSelectorWidget(QWidget* parent, MainWindow* window,
131 Controller* controller);
133 private Q_SLOTS:
134 void activateArea(int index);
135 void resetCurrentArea();
136 void areaChanged(Sublime::Area* area);
138 private:
139 MainWindow* window_;
140 Controller* controller_;
141 QComboBox* combo_;
142 QVector<QString> areaIds_;
145 class AreaSelectionAction : public KAction
147 public:
148 AreaSelectionAction(MainWindowPrivate* parent, Controller* controller)
149 : KAction(parent), window_(parent->m_mainWindow),
150 controller_(controller) {}
152 QWidget* createWidget(QWidget* parent);
154 private:
155 MainWindow* window_;
156 Controller* controller_;
162 #endif