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  QMdiSubWindow * addDisplayWindow(CDisplayWindow * displayWindow);
58 
59  /**
60  Returns the BibleTime main window
61  */
63  return m_bibleTime;
64  }
65 
66  /**
67  Resets the MDI arrangement mode and arranges the windows.
68  \param[in] mode new MDI arrangement mode.
69  */
71 
72  /**
73  Returns the current MDI arrangement mode.
74  */
76  { return m_mdiArrangementMode; }
77 
78  /**
79  * Forces an update of the currently chosen window arrangement.
80  */
81  void triggerWindowUpdate();
82 
83  /**
84  \returns a lists of all subwindows which are not minimized or hidden.
85  */
87 
88  /**
89  Show or hide the sub-window min/max buttons.
90  */
91  void enableWindowMinMaxFlags(bool enable);
92 
93  public Q_SLOTS:
94 
95  /**
96  Our own auto tile version which, if only one subwindow is left, shows it
97  \note This not set an automatic arrangement mode, it just arranges the
98  subwindows once. However, this method is also used when
99  arranging the subwindows into a tile automatically.
100  */
101  void myTile();
102 
103  /**
104  Our own cascade version which, if only one subwindow is left, shows it
105  maximized.
106  \note This not set an automatic arrangement mode, it just arranges the
107  subwindows once. However, this method is also used when
108  arranging the subwindows into a cascade automatically.
109  */
110  void myCascade();
111 
112  /**
113  Our own vertical tile version which, if only one subwindow is left,
114  shows it maximized.
115  \note This not set an automatic arrangement mode, it just arranges the
116  subwindows once. However, this method is also used when
117  arranging the subwindows into a vertical tiling automatically.
118  */
119  void myTileVertical();
120 
121  /**
122  Our own horizontal tile version which, if only one subwindow is left,
123  shows it maximized.
124  \note This not set an automatic arrangement mode, it just arranges the
125  subwindows once. However, this method is also used when
126  arranging the subwindows into a horizontal tiling automatically.
127  */
128  void myTileHorizontal();
129 
131 
133 
134  void highlightTextInActiveWindow(const QString& text, bool caseSensitive);
135 
136  Q_SIGNALS:
137 
138  /**
139  * Emits a signal to set the caption of the toplevel widget.
140  */
141  void sigSetToplevelCaption(const QString&);
142 
143  protected: // methods:
144 
145  void findTextInActiveWindow(bool const backward);
146 
147  /**
148  Reimplementation of QWidget::resizeEvent() to handle our automatic
149  tiling properly.
150  */
151  void resizeEvent(QResizeEvent *e) override;
152 
153  /**
154  Reimplementation of QObject::eventFilter() used to handle some MDI
155  subwindow events.
156  */
157  bool eventFilter(QObject *o, QEvent *e) override;
158 
160 
161  protected: // fields:
162 
164 
165  private: // fields:
166 
169 
170 }; /* 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:277
void findTextInActiveWindow(bool const backward)
Definition: cmdiarea.cpp:351
void myTileVertical()
Definition: cmdiarea.cpp:154
bool eventFilter(QObject *o, QEvent *e) override
Definition: cmdiarea.cpp:371
void emitWindowCaptionChanged()
Definition: cmdiarea.cpp:323
void setMDIArrangementMode(const MDIArrangementMode mode)
Definition: cmdiarea.cpp:134
void enableWindowMinMaxFlags(bool enable)
Definition: cmdiarea.cpp:438
void triggerWindowUpdate()
Definition: cmdiarea.cpp:417
void myTile()
Definition: cmdiarea.cpp:222
void highlightTextInActiveWindow(const QString &text, bool caseSensitive)
Definition: cmdiarea.cpp:346
CDisplayWindow * m_activeWindow
Definition: cmdiarea.h:167
void resizeEvent(QResizeEvent *e) override
Definition: cmdiarea.cpp:354
QList< QMdiSubWindow * > usableWindowList() const
Definition: cmdiarea.cpp:332
QMdiSubWindow * addDisplayWindow(CDisplayWindow *displayWindow)
Definition: cmdiarea.cpp:85
void sigSetToplevelCaption(const QString &)
BibleTime * m_bibleTime
Definition: cmdiarea.h:168
void findNextTextInActiveWindow()
Definition: cmdiarea.cpp:342
void findPreviousTextInActiveWindow()
Definition: cmdiarea.cpp:344
MDIArrangementMode m_mdiArrangementMode
Definition: cmdiarea.h:34
BibleTime * bibleTimeWindow()
Definition: cmdiarea.h:62
void myTileHorizontal()
Definition: cmdiarea.cpp:188
MDIArrangementMode getMDIArrangementMode() const
Definition: cmdiarea.h:75