1
#ifndef _KVI_MDIMANAGER_H_
2
#define _KVI_MDIMANAGER_H_
3
//=============================================================================
5
// File : kvi+_mdimanager.h
6
// Creation date : Wed Jun 21 2000 17:28:04 by Szymon Stefanek
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)
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.
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.
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.
26
//=============================================================================
29
* \file KviMdiManager.h
30
* \brief The MDI-manager
31
* \author Szymon Stefanek
34
#include "kvi_settings.h"
35
#include "KviMdiChild.h"
41
class KviTalPopupMenu;
44
* \class KviMdiManager
45
* \brief Handles all MDI windows
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.
53
class KVIRC_API KviMdiManager : public QMdiArea
55
friend class KviMdiChild;
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
65
KviMdiManager(QWidget * pParent, KviMainWindow * pFrm, const char * pcName);
68
* \brief Destroys the Mdi manager object
73
* \brief Filters out some events: (de)activation events, window switching
76
bool eventFilter(QObject *obj, QEvent *event);
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;
88
* \brief Get the currently active window
89
* \return KviMdiChild *
91
KviMdiChild * topChild();
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
100
void manageChild(KviMdiChild * lpC, bool bCascade = true, QRect * setGeom = 0);
103
* \brief Show the KviMdiChild and bring it to the front
104
* \param lpC The KviMdiChild which will be shown.
107
void showAndActivate(KviMdiChild * lpC);
110
* \brief Returns the window popup
111
* \return KviTalPopupMenu *
113
inline KviTalPopupMenu * windowPopup() { return m_pWindowPopup; };
116
* \brief Move the focus the the previous active window
119
void focusPreviousTopChild(KviMdiChild * pExcludeThis = NULL);
122
* \brief Remove and delete the subwindow
123
* \param lpC The KviMdiChild which will be destroyed.
126
void destroyChild(KviMdiChild * lpC);
129
* \brief Hides the specified child and focuses some other child
130
* \param lpC The KviMdiChild which will be hidden.
133
void hideChild(KviMdiChild * lpC);
136
* \brief Get all visible subwindows
139
int getVisibleChildCount();
142
* \brief Check if we are in SDI mode
145
inline bool isInSDIMode() { return m_bInSDIMode; };
148
* \brief Returns the current scrollbar offsets
151
inline QPoint scrollBarsOffset() { return QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value()); };
154
* \brief Sets if we are in SDI mode
156
void setIsInSDIMode(bool bMode);
159
* \brief Repaints the transparent backgrounds if activated
161
virtual void paintEvent(QPaintEvent * e);
165
* \brief Make sure that no KviMdiChild is maximized
168
* Goes trough all KviMdiChild objects and checks for maximized mode and restores that windows
170
void ensureNoMaximized();
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
178
void tileAllInternal(int maxWnds,bool bHorizontal);
181
void cascadeWindows();
182
void cascadeMaximized();
183
void expandVertical();
184
void expandHorizontal();
188
void toggleAutoTile();
191
void menuActivated(int id);
192
void tileMethodMenuActivated(int id);
193
void fillWindowPopup();
194
void slotSubWindowActivated(QMdiSubWindow * pMdiChild);
197
#endif //_KVI_MDIMANAGER_H_