~ubuntu-branches/debian/jessie/ugene/jessie

« back to all changes in this revision

Viewing changes to src/ugeneui/src/main_window/MDIManagerImpl.h

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-11-02 13:29:07 UTC
  • mfrom: (1.2.1) (3.1.11 natty)
  • Revision ID: package-import@ubuntu.com-20111102132907-o34gwnt0uj5g6hen
Tags: 1.9.8+repack-1
* First release to Debian
  - added README.Debian
  - increased policy version to 3.9.2
  - added URLs for version control system
* Added debug package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * UGENE - Integrated Bioinformatics Tools.
 
3
 * Copyright (C) 2008-2011 UniPro <ugene@unipro.ru>
 
4
 * http://ugene.unipro.ru
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
19
 * MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
#ifndef _U2_MDI_MANAGER_IMPL_H_
 
23
#define _U2_MDI_MANAGER_IMPL_H_
 
24
 
 
25
#include "MainWindowImpl.h"
 
26
 
 
27
#include <QtCore/QSignalMapper>
 
28
#include <QtCore/QEvent>
 
29
 
 
30
#include <QtGui/QMdiArea>
 
31
#include <QtGui/QMdiSubWindow>
 
32
 
 
33
namespace U2 {
 
34
 
 
35
class MDIItem : QWidget { 
 
36
        Q_OBJECT
 
37
public:
 
38
    MDIItem(MWMDIWindow* _w, QMdiSubWindow* _qw) : w(_w), qw(_qw){this->setObjectName(_w->objectName()+"_MDIItem");qw->setObjectName(_w->objectName()+"_SubWindow");}
 
39
        
 
40
        MWMDIWindow* w;
 
41
        QMdiSubWindow* qw;
 
42
};
 
43
 
 
44
typedef QList<MDIItem*> MDIItems;
 
45
 
 
46
class MWMDIManagerImpl : public MWMDIManager {
 
47
        Q_OBJECT
 
48
public:
 
49
    MWMDIManagerImpl(MainWindow* _mw, FixedMdiArea* _mdiArea) 
 
50
                : MWMDIManager(_mw), mw(_mw), mdiArea(_mdiArea){ prepareGUI();}
 
51
 
 
52
        ~MWMDIManagerImpl();
 
53
 
 
54
        virtual void addMDIWindow(MWMDIWindow* w);
 
55
 
 
56
        virtual bool closeMDIWindow(MWMDIWindow* w);
 
57
 
 
58
        virtual QList<MWMDIWindow*> getWindows() const;
 
59
 
 
60
        virtual MWMDIWindow* getWindowById(int id) const;
 
61
 
 
62
        virtual void activateWindow(MWMDIWindow* w);
 
63
        
 
64
        virtual MWMDIWindow* getActiveWindow() const;
 
65
 
 
66
protected:
 
67
        bool eventFilter(QObject *obj, QEvent *event);
 
68
        
 
69
private slots:
 
70
        void sl_setActiveSubWindow(QWidget *);
 
71
        void sl_updateWindowMenu();
 
72
        void sl_onSubWindowActivated(QMdiSubWindow *);
 
73
    void sl_updateWindowLayout();
 
74
        
 
75
private:
 
76
        MDIItem* getMDIItem(int id) const;
 
77
        MDIItem* getMDIItem(MWMDIWindow* w) const;
 
78
        MDIItem* getMDIItem(QMdiSubWindow* qw) const;
 
79
 
 
80
        void clearMDIContent(bool addCloseAction);
 
81
        void prepareGUI();
 
82
 
 
83
        void updateActions();
 
84
        void updateState();
 
85
 
 
86
        MDIItem* getCurrentMDIItem() const ;
 
87
 
 
88
 
 
89
        MainWindow* mw;
 
90
        FixedMdiArea*   mdiArea;
 
91
        MDIItems        items;
 
92
 
 
93
 
 
94
        QAction* closeAct;
 
95
        QAction* closeAllAct;
 
96
        QAction* tileAct;
 
97
        QAction* cascadeAct;
 
98
        QAction* nextAct;
 
99
        QAction* previousAct;
 
100
        QAction* separatorAct;
 
101
 
 
102
        QSignalMapper*  windowMapper;
 
103
        bool            defaultIsMaximized;
 
104
        MDIItem*        mdiContentOwner;
 
105
};
 
106
 
 
107
} //namespace
 
108
 
 
109
#endif