~ubuntu-branches/ubuntu/trusty/bibletime/trusty

« back to all changes in this revision

Viewing changes to src/frontend/displaywindow/cmodulechooserbutton.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Marsden
  • Date: 2010-01-10 22:21:36 UTC
  • mfrom: (1.3.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100110222136-905hza76230hperg
Tags: 2.5-1
New upstream version 2.5 (Closes: #564551).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********
2
 
*
3
 
* This file is part of BibleTime's source code, http://www.bibletime.info/.
4
 
*
5
 
* Copyright 1999-2008 by the BibleTime developers.
6
 
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
7
 
*
8
 
**********/
9
 
 
10
 
#ifndef CMODULECHOOSERBUTTON_H
11
 
#define CMODULECHOOSERBUTTON_H
12
 
 
13
 
#include <QToolButton>
14
 
#include "util/cpointers.h"
15
 
 
16
 
#include <QList>
17
 
#include "backend/btmoduletreeitem.h"
18
 
 
19
 
 
20
 
class QMenu;
21
 
class CModuleChooserBar;
22
 
class CSwordModuleInfo;
23
 
 
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
27
 
  */
28
 
class CModuleChooserButton : public QToolButton, public CPointers  {
29
 
        Q_OBJECT
30
 
    public:
31
 
 
32
 
        /** Filter out modules of wrong type. See populateMenu() and BTModuleTreeItem. */
33
 
        struct TypeFilter : public BTModuleTreeItem::Filter {
34
 
            TypeFilter(CSwordModuleInfo::ModuleType t) {
35
 
                m_mType = t;
36
 
            }
37
 
            bool filter(CSwordModuleInfo* mi) {
38
 
                return (mi->type() == m_mType);
39
 
            }
40
 
            CSwordModuleInfo::ModuleType m_mType;
41
 
        };
42
 
 
43
 
        CModuleChooserButton(CSwordModuleInfo* useModule, CSwordModuleInfo::ModuleType type, const int id, CModuleChooserBar *parent);
44
 
        ~CModuleChooserButton();
45
 
 
46
 
        CSwordModuleInfo* module();
47
 
        /**
48
 
        * Returns the id used for this button.
49
 
        */
50
 
        int getId() const;
51
 
        void updateMenuItems();
52
 
 
53
 
    protected:
54
 
        /** Populates the menu with language submenus and module items. */
55
 
        void populateMenu();
56
 
        /** Adds items to the menu recursively. */
57
 
        void addItemToMenu(BTModuleTreeItem* item, QMenu* menu);
58
 
 
59
 
    private:
60
 
        /**
61
 
        * Returns the icon used for the current status.
62
 
        */
63
 
        const QString iconName();
64
 
 
65
 
        bool m_hasModule;
66
 
        int m_id;
67
 
        QAction* m_noneAction;
68
 
        CSwordModuleInfo::ModuleType m_moduleType;
69
 
        CSwordModuleInfo* m_module;
70
 
 
71
 
        QMenu* m_popup;
72
 
        QList<QMenu*> m_submenus;
73
 
 
74
 
        CModuleChooserBar* m_moduleChooserBar;
75
 
 
76
 
 
77
 
    private slots:
78
 
        void moduleChosen(QAction* action );
79
 
 
80
 
    signals:
81
 
        void sigRemoveButton(const int ID);
82
 
        void sigAddButton();
83
 
        void sigChanged();
84
 
};
85
 
#endif