3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
5
* Copyright 1999-2008 by the BibleTime developers.
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
10
#ifndef CMODULECHOOSERBUTTON_H
11
#define CMODULECHOOSERBUTTON_H
13
#include <QToolButton>
14
#include "util/cpointers.h"
17
#include "backend/btmoduletreeitem.h"
21
class CModuleChooserBar;
22
class CSwordModuleInfo;
24
/** The CModuleChooserButton displays a list of submenus sorted by language which contain the possible modules
25
* which can be displayed together with the first one.
26
* @author The BibleTime team
28
class CModuleChooserButton : public QToolButton, public CPointers {
32
/** Filter out modules of wrong type. See populateMenu() and BTModuleTreeItem. */
33
struct TypeFilter : public BTModuleTreeItem::Filter {
34
TypeFilter(CSwordModuleInfo::ModuleType t) {
37
bool filter(CSwordModuleInfo* mi) {
38
return (mi->type() == m_mType);
40
CSwordModuleInfo::ModuleType m_mType;
43
CModuleChooserButton(CSwordModuleInfo* useModule, CSwordModuleInfo::ModuleType type, const int id, CModuleChooserBar *parent);
44
~CModuleChooserButton();
46
CSwordModuleInfo* module();
48
* Returns the id used for this button.
51
void updateMenuItems();
54
/** Populates the menu with language submenus and module items. */
56
/** Adds items to the menu recursively. */
57
void addItemToMenu(BTModuleTreeItem* item, QMenu* menu);
61
* Returns the icon used for the current status.
63
const QString iconName();
67
QAction* m_noneAction;
68
CSwordModuleInfo::ModuleType m_moduleType;
69
CSwordModuleInfo* m_module;
72
QList<QMenu*> m_submenus;
74
CModuleChooserBar* m_moduleChooserBar;
78
void moduleChosen(QAction* action );
81
void sigRemoveButton(const int ID);