BibleTime
cmdiarea.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include <QMdiArea>
16 
17 #include <QObject>
18 #include <QString>
19 #include <QtCore>
20 #include <QList>
21 
22 
23 class BibleTime;
24 class CDisplayWindow;
25 class QMdiSubWindow;
26 class QWidget;
27 
28 /**
29  A custom MDI area widget.
30 */
31 class CMDIArea: public QMdiArea {
32 
33  Q_OBJECT
35 
36  public: // types:
37 
38  /**
39  Possible MDI subwindow arrangement modes.
40  */
48  };
49 
50  public: // methods:
51 
52  /**
53  \param[in] parent BibleTime main window used for parent widget.
54  */
55  CMDIArea(BibleTime *parent);
56 
57  /**
58  Reimplementation of QMdiArea::addSubWindow().
59  */
60  QMdiSubWindow * addSubWindow(QWidget * widget,
61  Qt::WindowFlags windowFlags = Qt::WindowFlags());
62 
63  /**
64  Returns the BibleTime main window
65  */
67  return m_bibleTime;
68  }
69 
70  /**
71  Resets the MDI arrangement mode and arranges the windows.
72  \param[in] mode new MDI arrangement mode.
73  */
75 
76  /**
77  Returns the current MDI arrangement mode.
78  */
80  { return m_mdiArrangementMode; }
81 
82  /**
83  * Forces an update of the currently chosen window arrangement.
84  */
85  void triggerWindowUpdate();
86 
87  /**
88  \returns a lists of all subwindows which are not minimized or hidden.
89  */
91 
92  /**
93  Show or hide the sub-window min/max buttons.
94  */
95  void enableWindowMinMaxFlags(bool enable);
96 
97  public Q_SLOTS:
98 
99  /**
100  Our own auto tile version which, if only one subwindow is left, shows it
101  \note This not set an automatic arrangement mode, it just arranges the
102  subwindows once. However, this method is also used when
103  arranging the subwindows into a tile automatically.
104  */
105  void myTile();
106 
107  /**
108  Our own cascade version which, if only one subwindow is left, shows it
109  maximized.
110  \note This not set an automatic arrangement mode, it just arranges the
111  subwindows once. However, this method is also used when
112  arranging the subwindows into a cascade automatically.
113  */
114  void myCascade();
115 
116  /**
117  Our own vertical tile version which, if only one subwindow is left,
118  shows it maximized.
119  \note This not set an automatic arrangement mode, it just arranges the
120  subwindows once. However, this method is also used when
121  arranging the subwindows into a vertical tiling automatically.
122  */
123  void myTileVertical();
124 
125  /**
126  Our own horizontal tile version which, if only one subwindow is left,
127  shows it maximized.
128  \note This not set an automatic arrangement mode, it just arranges the
129  subwindows once. However, this method is also used when
130  arranging the subwindows into a horizontal tiling automatically.
131  */
132  void myTileHorizontal();
133 
135 
137 
138  void highlightTextInActiveWindow(const QString& text, bool caseSensitive);
139 
140  Q_SIGNALS:
141 
142  /**
143  * Emits a signal to set the caption of the toplevel widget.
144  */
145  void sigSetToplevelCaption(const QString&);
146 
147  protected: // methods:
148 
149  void findTextInActiveWindow(bool const backward);
150 
151  /**
152  Reimplementation of QWidget::resizeEvent() to handle our automatic
153  tiling properly.
154  */
155  void resizeEvent(QResizeEvent *e) override;
156 
157  /**
158  Reimplementation of QObject::eventFilter() used to handle some MDI
159  subwindow events.
160  */
161  bool eventFilter(QObject *o, QEvent *e) override;
162 
164 
165  void fixSystemMenu(QMdiSubWindow* subWindow);
166 
167  protected Q_SLOTS:
168 
169  /**
170  Called whan a tabbed subwindow is closed from the tab
171  */
172  void closeTab(int i);
173 
174  protected: // fields:
175 
177 
178  private: // fields:
179 
182 
183 }; /* class CMDIArea */
The base class for all display windows of BibleTime.
MDIArrangementMode
Definition: cmdiarea.h:41
@ ArrangementModeTileVertical
Definition: cmdiarea.h:42
@ ArrangementModeCascade
Definition: cmdiarea.h:44
@ ArrangementModeManual
Definition: cmdiarea.h:45
@ ArrangementModeTabbed
Definition: cmdiarea.h:47
@ ArrangementModeTileHorizontal
Definition: cmdiarea.h:43
@ ArrangementModeTile
Definition: cmdiarea.h:46
CMDIArea(BibleTime *parent)
Definition: cmdiarea.cpp:44
void myCascade()
Definition: cmdiarea.cpp:286
void findTextInActiveWindow(bool const backward)
Definition: cmdiarea.cpp:360
void fixSystemMenu(QMdiSubWindow *subWindow)
Definition: cmdiarea.cpp:85
void myTileVertical()
Definition: cmdiarea.cpp:163
bool eventFilter(QObject *o, QEvent *e) override
Definition: cmdiarea.cpp:380
void emitWindowCaptionChanged()
Definition: cmdiarea.cpp:332
void setMDIArrangementMode(const MDIArrangementMode mode)
Definition: cmdiarea.cpp:135
void closeTab(int i)
Definition: cmdiarea.cpp:155
void enableWindowMinMaxFlags(bool enable)
Definition: cmdiarea.cpp:448
void triggerWindowUpdate()
Definition: cmdiarea.cpp:427
void myTile()
Definition: cmdiarea.cpp:231
void highlightTextInActiveWindow(const QString &text, bool caseSensitive)
Definition: cmdiarea.cpp:355
CDisplayWindow * m_activeWindow
Definition: cmdiarea.h:180
void resizeEvent(QResizeEvent *e) override
Definition: cmdiarea.cpp:363
QList< QMdiSubWindow * > usableWindowList() const
Definition: cmdiarea.cpp:341
void sigSetToplevelCaption(const QString &)
BibleTime * m_bibleTime
Definition: cmdiarea.h:181
void findNextTextInActiveWindow()
Definition: cmdiarea.cpp:351
void findPreviousTextInActiveWindow()
Definition: cmdiarea.cpp:353
MDIArrangementMode m_mdiArrangementMode
Definition: cmdiarea.h:34
BibleTime * bibleTimeWindow()
Definition: cmdiarea.h:66
void myTileHorizontal()
Definition: cmdiarea.cpp:197
QMdiSubWindow * addSubWindow(QWidget *widget, Qt::WindowFlags windowFlags=Qt::WindowFlags())
Definition: cmdiarea.cpp:96
MDIArrangementMode getMDIArrangementMode() const
Definition: cmdiarea.h:79