1 /***************************************************************************
2 * Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
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. *
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. *
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
27 #include "sublimedefs.h"
29 #include "mainwindow.h"
30 #include "ideallayout.h"
44 class IdealMainWidget
;
46 class MainWindowPrivate
: public QObject
{
49 MainWindowPrivate(MainWindow
*w
, Controller
* controller
);
51 /**Use this to create tool views for an area.*/
52 class IdealToolViewCreator
{
54 IdealToolViewCreator(MainWindowPrivate
*_d
): d(_d
) {}
55 Area::WalkerMode
operator() (View
*view
, Sublime::Position position
);
60 /**Use this to create views for an area.*/
63 ViewCreator(MainWindowPrivate
*_d
): d(_d
) {}
64 Area::WalkerMode
operator() (AreaIndex
*index
);
69 /**Reconstructs the mainwindow according to the current area.*/
71 /**Clears the area leaving mainwindow empty.*/
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
;
84 QMap
<View
*, Container
*> viewContainers
;
85 QMap
<QWidget
*, View
*> widgetToView
;
90 QWidget
*centralWidget
;
92 IdealMainWidget
*idealMainWidget
;
94 bool autoAreaSettingsSave
;
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
);
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
);
112 virtual bool eventFilter(QObject
*, QEvent
*event
);
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
130 AreaSelectorWidget(QWidget
* parent
, MainWindow
* window
,
131 Controller
* controller
);
134 void activateArea(int index
);
135 void resetCurrentArea();
136 void areaChanged(Sublime::Area
* area
);
140 Controller
* controller_
;
142 QVector
<QString
> areaIds_
;
145 class AreaSelectionAction
: public KAction
148 AreaSelectionAction(MainWindowPrivate
* parent
, Controller
* controller
)
149 : KAction(parent
), window_(parent
->m_mainWindow
),
150 controller_(controller
) {}
152 QWidget
* createWidget(QWidget
* parent
);
156 Controller
* controller_
;