BibleTime
bttextwindowheader.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 <QWidget>
16 
17 #include <QList>
18 #include "../../backend/drivers/cswordmoduleinfo.h"
19 #include "../../backend/drivers/btmodulelist.h"
20 
21 
23 
24 class BtTextWindowHeader final: public QWidget {
25 
26  Q_OBJECT
27 
28 public: /* Methods: */
29 
31  BtModuleList modules,
32  QWidget * window = nullptr);
33 
34 public Q_SLOTS:
35 
36  void setModules(BtModuleList newModules);
37 
38 Q_SIGNALS:
39 
40  void moduleAdded(int index, CSwordModuleInfo * module);
41  void moduleReplaced(int index, CSwordModuleInfo * newModule);
42  void moduleRemoved(int index);
43 
44 private: /* Methods: */
45 
46  /** Called when backend has changed and menus must be created from scratch.*/
47  void initMenus();
48 
49  /** Updates all widgets without recreating them. */
50  void updateWidgets(BtModuleList const & modules);
51 
52  /**
53  \brief Ensures exactly numModules widgets.
54  \param[in] numWidgets The exact number of widgets required.
55  */
56  void adjustWidgetCount(int const numWidgets);
57 
58  /** Adds an empty widget to the header. */
60 
61 private: /* Fields: */
62 
65 
66 };
QList< CSwordModuleInfo * > BtModuleList
Definition: btmodulelist.h:20
void moduleAdded(int index, CSwordModuleInfo *module)
void moduleReplaced(int index, CSwordModuleInfo *newModule)
BtTextWindowHeaderWidget * addWidget()
void adjustWidgetCount(int const numWidgets)
Ensures exactly numModules widgets.
void setModules(BtModuleList newModules)
void updateWidgets(BtModuleList const &modules)
CSwordModuleInfo::ModuleType const m_moduleType
BtTextWindowHeader(CSwordModuleInfo::ModuleType modtype, BtModuleList modules, QWidget *window=nullptr)
void moduleRemoved(int index)
QList< BtTextWindowHeaderWidget * > m_widgetList