~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/ui/KviMdiManager.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _KVI_MDIMANAGER_H_
 
2
#define _KVI_MDIMANAGER_H_
 
3
//=============================================================================
 
4
//
 
5
//   File : kvi+_mdimanager.h
 
6
//   Creation date : Wed Jun 21 2000 17:28:04 by Szymon Stefanek
 
7
//
 
8
//   This file is part of the KVIrc irc client distribution
 
9
//   Copyright (C) 2000 Szymon Stefanek (pragma at kvirc dot net)
 
10
//   Copyright (C) 2008 TheXception (kvirc at thexception dot net)
 
11
//
 
12
//   This program is FREE software. You can redistribute it and/or
 
13
//   modify it under the terms of the GNU General Public License
 
14
//   as published by the Free Software Foundation; either version 2
 
15
//   of the License, or (at your opinion) any later version.
 
16
//
 
17
//   This program is distributed in the HOPE that it will be USEFUL,
 
18
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
20
//   See the GNU General Public License for more details.
 
21
//
 
22
//   You should have received a copy of the GNU General Public License
 
23
//   along with this program. If not, write to the Free Software Foundation,
 
24
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
25
//
 
26
//=============================================================================
 
27
 
 
28
/**
 
29
* \file KviMdiManager.h
 
30
* \brief The MDI-manager
 
31
* \author Szymon Stefanek
 
32
*/
 
33
 
 
34
#include "kvi_settings.h"
 
35
#include "KviMdiChild.h"
 
36
 
 
37
#include <QMdiArea>
 
38
#include <QScrollBar>
 
39
 
 
40
class KviMainWindow;
 
41
class KviTalPopupMenu;
 
42
 
 
43
/**
 
44
* \class KviMdiManager
 
45
* \brief Handles all MDI windows
 
46
*
 
47
* This MDI-manager is based on QMdiArea of Qt 4. It handles all docked windows and does their tiling.
 
48
* Basicly all windows are managed by the KviMainWindow, which also gives the order to the MDI-manager to dock or undock a window.
 
49
* What does that mean?
 
50
* All windows in KVIrc are of the type QWidget which can be standalone windows. These are packed into a QMdiSubWindow and added to the MDI-manager.
 
51
* So the KviMdiManager gets a KviMdiChild which will be set as main widget of our QMdiSubWindow. When it'll be undocked QMdiSubWindow will be removed and our KviWindow is "free" again.
 
52
*/
 
53
class KVIRC_API KviMdiManager : public QMdiArea
 
54
{
 
55
        friend class KviMdiChild;
 
56
        Q_OBJECT
 
57
public:
 
58
        /**
 
59
        * \brief Constructs the Mdi manager object
 
60
        * \param pParent The parent widget
 
61
        * \param pFrm The frame container
 
62
        * \param pcName The name of the manager
 
63
        * \return KviMdiManager
 
64
        */
 
65
        KviMdiManager(QWidget * pParent, KviMainWindow * pFrm, const char * pcName);
 
66
 
 
67
        /**
 
68
        * \brief Destroys the Mdi manager object
 
69
        */
 
70
        ~KviMdiManager();
 
71
 
 
72
        /**
 
73
        * \brief Filters out some events: (de)activation events, window switching
 
74
        * \return bool
 
75
        */
 
76
        bool eventFilter(QObject *obj, QEvent *event);
 
77
private:
 
78
        bool m_bInSDIMode;
 
79
protected:
 
80
        /// Holds the specialized window popup
 
81
        KviTalPopupMenu * m_pWindowPopup;
 
82
        /// Holds the tiling popup
 
83
        KviTalPopupMenu * m_pTileMethodPopup;
 
84
        /// The frame where this KviMdiManager belongs to
 
85
        KviMainWindow        * m_pFrm;
 
86
public:
 
87
        /**
 
88
        * \brief Get the currently active window
 
89
        * \return KviMdiChild *
 
90
        */
 
91
        KviMdiChild * topChild();
 
92
 
 
93
        /**
 
94
        * \brief Add an KviMdiChild to the area
 
95
        * \param lpC The KviMdiChild
 
96
        * \param bCascade Cascade window or not.
 
97
        * \param setGeom Sets the windows geometry before shown
 
98
        * \return void
 
99
        */
 
100
        void manageChild(KviMdiChild * lpC, bool bCascade = true, QRect * setGeom = 0);
 
101
 
 
102
        /**
 
103
        * \brief Show the KviMdiChild and bring it to the front
 
104
        * \param lpC The KviMdiChild which will be shown.
 
105
        * \return void
 
106
        */
 
107
        void showAndActivate(KviMdiChild * lpC);
 
108
 
 
109
        /**
 
110
        * \brief Returns the window popup
 
111
        * \return KviTalPopupMenu *
 
112
        */
 
113
        inline KviTalPopupMenu * windowPopup() { return m_pWindowPopup; };
 
114
 
 
115
        /**
 
116
        * \brief Move the focus the the previous active window
 
117
        * \return void
 
118
        */
 
119
        void focusPreviousTopChild(KviMdiChild * pExcludeThis = NULL);
 
120
 
 
121
        /**
 
122
        * \brief Remove and delete the subwindow
 
123
        * \param lpC The KviMdiChild which will be destroyed.
 
124
        * \return void
 
125
        */
 
126
        void destroyChild(KviMdiChild * lpC);
 
127
 
 
128
        /**
 
129
        * \brief Hides the specified child and focuses some other child
 
130
        * \param lpC The KviMdiChild which will be hidden.
 
131
        * \return void
 
132
        */
 
133
        void hideChild(KviMdiChild * lpC);
 
134
 
 
135
        /**
 
136
        * \brief Get all visible subwindows
 
137
        * \return int
 
138
        */
 
139
        int getVisibleChildCount();
 
140
 
 
141
        /**
 
142
        * \brief Check if we are in SDI mode
 
143
        * \return bool
 
144
        */
 
145
        inline bool isInSDIMode() { return m_bInSDIMode; };
 
146
 
 
147
        /**
 
148
        * \brief Returns the current scrollbar offsets
 
149
        * \return QPoint
 
150
        */
 
151
        inline QPoint scrollBarsOffset() { return QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value()); };
 
152
protected:
 
153
        /**
 
154
        * \brief Sets if we are in SDI mode
 
155
        */
 
156
        void setIsInSDIMode(bool bMode);
 
157
 
 
158
        /**
 
159
         * \brief Repaints the transparent backgrounds if activated
 
160
         */
 
161
        virtual void paintEvent(QPaintEvent * e);
 
162
 
 
163
private:
 
164
        /**
 
165
         * \brief Make sure that no KviMdiChild is maximized
 
166
         * \return void
 
167
         *
 
168
         * Goes trough all KviMdiChild objects and checks for maximized mode and restores that windows
 
169
         */
 
170
        void ensureNoMaximized();
 
171
 
 
172
        /**
 
173
         * \brief The internal member which provides the tiling methods
 
174
         * \param maxWnds The maximum number of windows
 
175
         * \param bHorizontal If the windows will be tiled horizontal or vertical
 
176
         * \return void
 
177
         */
 
178
        void tileAllInternal(int maxWnds,bool bHorizontal);
 
179
 
 
180
public slots:
 
181
        void cascadeWindows();
 
182
        void cascadeMaximized();
 
183
        void expandVertical();
 
184
        void expandHorizontal();
 
185
        void minimizeAll();
 
186
        void restoreAll();
 
187
        void tile();
 
188
        void toggleAutoTile();
 
189
        void tileAnodine();
 
190
protected slots:
 
191
        void menuActivated(int id);
 
192
        void tileMethodMenuActivated(int id);
 
193
        void fillWindowPopup();
 
194
        void slotSubWindowActivated(QMdiSubWindow * pMdiChild);
 
195
};
 
196
 
 
197
#endif //_KVI_MDIMANAGER_H_