BibleTime
src
frontend
displaywindow
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
23
class
BtModuleChooserMenu
;
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
*/
32
class
BtModuleChooserButton
:
public
QToolButton
{
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
*/
41
BtModuleChooserButton
(
CSwordModuleInfo::ModuleType
mtype,
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
72
BtModuleChooserMenu
*
m_popup
;
73
};
BtModuleList
QList< CSwordModuleInfo * > BtModuleList
Definition:
btmodulelist.h:20
BtModuleChooserButton
Definition:
btmodulechooserbutton.h:32
BtModuleChooserButton::m_popup
BtModuleChooserMenu * m_popup
Definition:
btmodulechooserbutton.h:72
BtModuleChooserButton::updateMenu
void updateMenu(BtModuleList newModulesToUse, CSwordModuleInfo *thisModule, int newIndex, int leftLikeModules)
Definition:
btmodulechooserbutton.cpp:62
BtModuleChooserButton::sigModuleAdd
void sigModuleAdd(int index, CSwordModuleInfo *module)
BtModuleChooserButton::moduleChosen
void moduleChosen(CSwordModuleInfo *const module)
Definition:
btmodulechooserbutton.cpp:84
BtModuleChooserButton::icon
QIcon const & icon()
Definition:
btmodulechooserbutton.cpp:39
BtModuleChooserButton::sigModuleReplace
void sigModuleReplace(int index, CSwordModuleInfo *newModule)
BtModuleChooserButton::BtModuleChooserButton
BtModuleChooserButton(CSwordModuleInfo::ModuleType mtype, QWidget *parent=nullptr)
Constructs an new empty button.
Definition:
btmodulechooserbutton.cpp:21
BtModuleChooserButton::sigModuleRemove
void sigModuleRemove(int index)
BtModuleChooserMenu
Definition:
btmodulechoosermenu.h:30
CSwordModuleInfo
Definition:
cswordmoduleinfo.h:49
CSwordModuleInfo::ModuleType
ModuleType
Definition:
cswordmoduleinfo.h:87
QToolButton
QWidget
Generated by
1.9.1