BibleTime
btmodulechooserbutton.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 <QToolButton>
16 
17 #include <QObject>
18 #include <QString>
19 #include <QStringList>
20 #include "../../backend/drivers/cswordmoduleinfo.h"
21 
22 
24 class QIcon;
25 class QWidget;
26 
27 /* A toolbar button for choosing a module in a window. When user selects a
28  module, button sends a signal. This button needs to get a signal back after
29  a window module list has been changed. Only then the button will be updated.
30  \see BtModuleChooserBar.
31 */
33 
34  Q_OBJECT
35 
36  public: // methods:
37 
38  /** \brief Constructs an new empty button.
39  \note updateMenu() is needed to update the icon, menu items etc.
40  */
42  QWidget * parent = nullptr);
43 
44  void updateMenu(BtModuleList newModulesToUse,
45  CSwordModuleInfo * thisModule,
46  int newIndex,
47  int leftLikeModules);
48 
49  Q_SIGNALS:
50 
51  /** User selected a module from menu to replace another module. */
52  void sigModuleReplace(int index, CSwordModuleInfo * newModule);
53 
54  /** User selected a module from menu to add. */
55  void sigModuleAdd(int index, CSwordModuleInfo * module);
56 
57  /** User selected a module from menu to be removed. */
58  void sigModuleRemove ( int index );
59 
60  private Q_SLOTS:
61 
62  /** Handle the action signal from the menu. */
63  void moduleChosen(CSwordModuleInfo * const module);
64 
65  private:
66 
67  /** Returns the icon used for the current status. */
68  QIcon const & icon();
69 
70  private:
71 
73 };
QList< CSwordModuleInfo * > BtModuleList
Definition: btmodulelist.h:20
BtModuleChooserMenu * m_popup
void updateMenu(BtModuleList newModulesToUse, CSwordModuleInfo *thisModule, int newIndex, int leftLikeModules)
void sigModuleAdd(int index, CSwordModuleInfo *module)
void moduleChosen(CSwordModuleInfo *const module)
void sigModuleReplace(int index, CSwordModuleInfo *newModule)
BtModuleChooserButton(CSwordModuleInfo::ModuleType mtype, QWidget *parent=nullptr)
Constructs an new empty button.
void sigModuleRemove(int index)