1
/*****************************************************************
2
* Unipro UGENE - Integrated Bioinformatics Suite
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
6
* This source code is distributed under the terms of the
7
* GNU General Public License. See the files COPYING and LICENSE
9
*****************************************************************/
11
#ifndef _GB2_MAIN_WINDOW_H_
12
#define _GB2_MAIN_WINDOW_H_
15
#include "PluginModel.h"
16
#include "ServiceTypes.h"
18
#include <QtCore/QSize>
19
#include <QtGui/QWidget>
20
#include <QtGui/QKeySequence>
34
class MWToolBarManager;
39
class GB2_COREAPI_EXPORT MainWindow : public QObject {
41
virtual MWMenuManager* getMenuManager() const = 0;
42
virtual MWToolBarManager* getToolBarManager() const = 0;
43
virtual MWMDIManager* getMDIManager() const = 0;
44
virtual MWDockManager* getDockManager() const = 0;
46
virtual void setWindowTitle(const QString& title) = 0;
49
//////////////////////////////////////////////////////////////////////////
53
class GB2_COREAPI_EXPORT MWMenuManager : public QObject {
56
MWMenuManager(QObject* p) : QObject(p){}
58
virtual QMenu* getTopLevelMenu(const QString& sysName) const = 0;
63
//////////////////////////////////////////////////////////////////////////
66
class GB2_COREAPI_EXPORT MWToolBarManager : public QObject {
69
MWToolBarManager(QObject* p) : QObject(p){}
71
virtual QToolBar* getToolbar(const QString& sysName) const = 0;
75
//////////////////////////////////////////////////////////////////////////
78
class GB2_COREAPI_EXPORT MWMDIWindow : public QWidget {
81
friend class MWMDIManager;
84
MWMDIWindow(const QString& _windowName);
86
const QString& getWindowName() const {return windowName;}
88
//BUG:416: conflict with ObjectViewName!!!
89
virtual void setWindowName(const QString& newWindowName) {
90
if (newWindowName != windowName) {
91
windowName = newWindowName;
92
setWindowTitle(windowName);
93
emit si_windowNameChanged(this);
97
virtual void setupMDIToolbar(QToolBar* tb) {Q_UNUSED(tb);}
98
virtual void setupViewMenu(QMenu* m) {Q_UNUSED(m);}
100
int getId() const {return windowId;}
103
/* returns true if a window may be closed, false otherwise */
104
virtual bool onCloseEvent() {return true;}
107
void si_windowNameChanged(MWMDIWindow* thiz);
114
class GB2_COREAPI_EXPORT MWMDIManager : public QObject {
117
MWMDIManager(QObject* p) : QObject(p){}
119
virtual void addMDIWindow(MWMDIWindow* w) = 0;
121
virtual bool closeMDIWindow(MWMDIWindow* w) = 0;
123
virtual QList<MWMDIWindow*> getWindows() const = 0;
125
virtual MWMDIWindow* getWindowById(int id) const = 0;
127
virtual Qt::WindowStates getWindowState(MWMDIWindow* w) const = 0;
129
virtual void activateWindow(MWMDIWindow* w) = 0;
131
virtual MWMDIWindow* getActiveWindow() const = 0;
134
void si_windowAdded(MWMDIWindow* w);
135
void si_windowClosing(MWMDIWindow* w);
138
/* returns true if the window agreed to close, false otherwise */
139
bool onCloseEvent(MWMDIWindow* w) {return w->onCloseEvent();}
143
//////////////////////////////////////////////////////////////////////////
153
class GB2_COREAPI_EXPORT MWDockManager: public QObject {
156
MWDockManager(QObject* p) : QObject(p){}
158
virtual QAction* registerDock(MWDockArea area, QWidget* w, const QKeySequence& ks = QKeySequence()) = 0;
160
virtual QWidget* findWidget(const QString& widgetObjName) = 0;
162
virtual QWidget* getActiveWidget(MWDockArea a) = 0;
164
virtual QWidget* activateDock(const QString& widgetObjName) = 0;
166
virtual QWidget* toggleDock(const QString& widgetObjName) = 0;