~ubuntu-branches/ubuntu/karmic/ugene/karmic

« back to all changes in this revision

Viewing changes to src/core/src/core_api/MainWindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Ivan Efremov
  • Date: 2009-01-26 19:17:51 UTC
  • Revision ID: james.westby@ubuntu.com-20090126191751-9kqqevd3yf4o098r
Tags: upstream-1.3.2+repack
ImportĀ upstreamĀ versionĀ 1.3.2+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
* Unipro UGENE - Integrated Bioinformatics Suite
 
3
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
 
4
* All Rights Reserved
 
5
 
6
*     This source code is distributed under the terms of the
 
7
*     GNU General Public License. See the files COPYING and LICENSE
 
8
*     for details.
 
9
*****************************************************************/
 
10
 
 
11
#ifndef _GB2_MAIN_WINDOW_H_
 
12
#define _GB2_MAIN_WINDOW_H_
 
13
 
 
14
#include "core_api.h"
 
15
#include "PluginModel.h"
 
16
#include "ServiceTypes.h"
 
17
 
 
18
#include <QtCore/QSize>
 
19
#include <QtGui/QWidget>
 
20
#include <QtGui/QKeySequence>
 
21
 
 
22
class QAction;
 
23
class QMdiSubWindow;
 
24
class QDockWidget;
 
25
class QMenu;
 
26
class QToolBar;
 
27
 
 
28
namespace GB2 {
 
29
 
 
30
 
 
31
class MWMenuManager;
 
32
class MWMenu;
 
33
class MWMenuItem;
 
34
class MWToolBarManager;
 
35
class MWToolBar;
 
36
class MWMDIManager;
 
37
class MWDockManager;
 
38
 
 
39
class GB2_COREAPI_EXPORT MainWindow : public QObject {
 
40
public:
 
41
        virtual MWMenuManager*          getMenuManager() const = 0;
 
42
    virtual MWToolBarManager*       getToolBarManager() const = 0;
 
43
    virtual MWMDIManager*           getMDIManager() const = 0;
 
44
    virtual MWDockManager*          getDockManager() const = 0;
 
45
    
 
46
        virtual void setWindowTitle(const QString& title) = 0;
 
47
 
 
48
};
 
49
//////////////////////////////////////////////////////////////////////////
 
50
/// MENU
 
51
 
 
52
 
 
53
class GB2_COREAPI_EXPORT MWMenuManager : public QObject {
 
54
    Q_OBJECT
 
55
public:
 
56
    MWMenuManager(QObject* p) : QObject(p){}
 
57
 
 
58
    virtual QMenu* getTopLevelMenu(const QString& sysName) const = 0;
 
59
};
 
60
 
 
61
 
 
62
 
 
63
//////////////////////////////////////////////////////////////////////////
 
64
/// Toolbar
 
65
 
 
66
class GB2_COREAPI_EXPORT  MWToolBarManager : public QObject {
 
67
    Q_OBJECT
 
68
public:
 
69
    MWToolBarManager(QObject* p) : QObject(p){}
 
70
 
 
71
        virtual QToolBar* getToolbar(const QString& sysName) const  = 0;
 
72
};
 
73
 
 
74
 
 
75
//////////////////////////////////////////////////////////////////////////
 
76
/// MDI
 
77
 
 
78
class GB2_COREAPI_EXPORT MWMDIWindow : public QWidget {
 
79
    Q_OBJECT
 
80
 
 
81
    friend class MWMDIManager;
 
82
public:
 
83
        
 
84
        MWMDIWindow(const QString& _windowName);
 
85
 
 
86
        const QString& getWindowName() const {return windowName;}
 
87
 
 
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);
 
94
                }
 
95
        }
 
96
 
 
97
        virtual void setupMDIToolbar(QToolBar* tb) {Q_UNUSED(tb);}
 
98
        virtual void setupViewMenu(QMenu* m) {Q_UNUSED(m);}
 
99
 
 
100
    int getId() const {return windowId;}
 
101
 
 
102
protected:
 
103
    /* returns true if a window may be closed, false otherwise */
 
104
    virtual bool onCloseEvent() {return true;}
 
105
 
 
106
signals:
 
107
        void si_windowNameChanged(MWMDIWindow* thiz);
 
108
 
 
109
protected:
 
110
        QString windowName;
 
111
    int     windowId;
 
112
};
 
113
 
 
114
class GB2_COREAPI_EXPORT MWMDIManager : public QObject {
 
115
    Q_OBJECT
 
116
public:
 
117
    MWMDIManager(QObject* p) : QObject(p){}
 
118
    
 
119
        virtual void addMDIWindow(MWMDIWindow* w) = 0;
 
120
        
 
121
        virtual bool closeMDIWindow(MWMDIWindow* w) = 0;
 
122
 
 
123
        virtual QList<MWMDIWindow*> getWindows() const = 0;
 
124
 
 
125
        virtual MWMDIWindow* getWindowById(int id) const = 0;
 
126
 
 
127
        virtual Qt::WindowStates getWindowState(MWMDIWindow* w) const = 0;
 
128
 
 
129
        virtual void activateWindow(MWMDIWindow* w) = 0;
 
130
 
 
131
        virtual MWMDIWindow* getActiveWindow() const = 0;
 
132
 
 
133
signals:
 
134
        void si_windowAdded(MWMDIWindow* w);
 
135
    void si_windowClosing(MWMDIWindow* w);
 
136
 
 
137
protected: 
 
138
    /* returns true if the window agreed to close, false otherwise */
 
139
    bool onCloseEvent(MWMDIWindow* w) {return w->onCloseEvent();}
 
140
};
 
141
 
 
142
 
 
143
//////////////////////////////////////////////////////////////////////////
 
144
/// DOCK
 
145
 
 
146
enum MWDockArea {
 
147
    MWDockArea_Left,
 
148
    MWDockArea_Right,
 
149
    MWDockArea_Bottom,
 
150
    MWDockArea_MaxDocks
 
151
};
 
152
 
 
153
class GB2_COREAPI_EXPORT MWDockManager: public QObject {
 
154
    Q_OBJECT
 
155
public:
 
156
    MWDockManager(QObject* p) : QObject(p){}
 
157
    
 
158
        virtual QAction* registerDock(MWDockArea area, QWidget* w, const QKeySequence& ks = QKeySequence()) = 0;
 
159
 
 
160
    virtual QWidget* findWidget(const QString& widgetObjName) = 0;
 
161
 
 
162
    virtual QWidget* getActiveWidget(MWDockArea a) = 0;
 
163
 
 
164
    virtual QWidget* activateDock(const QString& widgetObjName) = 0;
 
165
 
 
166
    virtual QWidget* toggleDock(const QString& widgetObjName) = 0;
 
167
};
 
168
 
 
169
}//namespace
 
170
#endif