1 /***************************************************************************
2 * Copyright 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 UICONTROLLER_H
20 #define UICONTROLLER_H
22 #include "shellexport.h"
24 #include <interfaces/iuicontroller.h>
25 #include <sublime/controller.h>
27 #include <ksharedconfig.h>
39 class KDEVPLATFORMSHELL_EXPORT UiController
: public Sublime::Controller
, public IUiController
{
43 UiController(Core
*core
);
44 virtual ~UiController();
46 /** @return area for currently active sublime mainwindow or 0 if
47 no sublime mainwindow is active.*/
48 virtual Sublime::Area
*activeArea();
49 /** @return active sublime mainwindow or 0 if no such mainwindow is active.*/
50 virtual Sublime::MainWindow
*activeSublimeWindow();
51 /** @return active sublime mainwindow or 0 if no such mainwindow is active.*/
52 virtual KParts::MainWindow
*activeMainWindow();
54 /** @return default main window - the main window for default area in the shell.
55 No guarantee is given that it always exists so this method may return 0.*/
56 MainWindow
*defaultMainWindow();
57 /** @return the default area for this shell.*/
58 Sublime::Area
*defaultArea();
60 virtual void switchToArea(const QString
&areaName
, SwitchMode switchMode
);
62 virtual void addToolView(const QString
&name
, IToolViewFactory
*factory
);
63 virtual void removeToolView(IToolViewFactory
*factory
);
65 void addNewToolView(MainWindow
*mw
);
70 void showSettingsDialog();
71 Sublime::Controller
* controller();
73 void mainWindowDeleted(MainWindow
* mw
);
75 void saveAllAreas(KSharedConfig::Ptr config
);
76 void saveArea(Sublime::Area
* area
, KConfigGroup
& group
);
77 void loadAllAreas(KSharedConfig::Ptr config
);
78 void loadArea(Sublime::Area
* area
, const KConfigGroup
& group
);
80 /*! @p status must implement KDevelop::IStatus */
81 virtual void registerStatus(QObject
* status
);
84 void addToolViewIfWanted(IToolViewFactory
* factory
,
85 Sublime::ToolDocument
* doc
,
87 void addToolViewToArea(IToolViewFactory
* factory
,
88 Sublime::ToolDocument
* doc
,
90 void saveArea(Sublime::AreaIndex
* area
, KConfigGroup
& group
);
91 void loadArea(Sublime::Area
* area
, Sublime::AreaIndex
* areaIndex
, const KConfigGroup
& group
);
95 void raiseToolView(Sublime::View
* view
);
98 class UiControllerPrivate
* const d
;
99 friend class UiControllerPrivate
;
100 Q_PRIVATE_SLOT(d
, void widgetChanged(QWidget
*,QWidget
*))