~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/frontend/keychooser/ckeychooser.h

  • Committer: mgruner
  • Date: 2007-05-08 15:51:07 UTC
  • Revision ID: vcs-imports@canonical.com-20070508155107-0rj7jdmm5ivf8685
-imported source and data files to new svn module
-this is where KDE4-based development will take place

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-2006 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
 
 
11
 
 
12
#ifndef CKEYCHOOSER_H
 
13
#define CKEYCHOOSER_H
 
14
 
 
15
#include <qwidget.h>
 
16
 
 
17
#include "backend/cswordmoduleinfo.h"
 
18
 
 
19
class CSwordModuleInfo;
 
20
class CSwordKey;
 
21
 
 
22
/**
 
23
 * The base class for the KeyChooser.
 
24
 * Do not use directly, create a KeyChooser with
 
25
 * @ref #createInstance , this will create the proper one
 
26
 * of the classes that inherit from @ref CKeyChooser
 
27
 *
 
28
  * @author The BibleTime team
 
29
  */
 
30
 
 
31
class CKeyChooser : public QWidget {
 
32
        Q_OBJECT
 
33
 
 
34
public:
 
35
        /**
 
36
        * Creates a proper Instance, either
 
37
        *
 
38
        @ref CLexiconKeyChooser or
 
39
        * @ref CBibleKeyChooser
 
40
        * @param info the @ref CModuleInfo to be represented by the KeyChooser
 
41
        * @param key if not NULL, the @ref CKey the KeyChooser should be set to
 
42
        * @param parent the parent of the widget to create
 
43
        */
 
44
        static CKeyChooser* createInstance(ListCSwordModuleInfo modules, CSwordKey *key, QWidget *parent);
 
45
 
 
46
        const QStringList getPreviousKeys() const;
 
47
        const QStringList getNextKeys() const;
 
48
 
 
49
public slots:
 
50
        /**
 
51
        * sets the @ref CKey
 
52
        * @param key the key which the widget should be set to
 
53
        */
 
54
        virtual void setKey(CSwordKey* key) = 0;
 
55
        /**
 
56
        * sets the @ref CKey
 
57
        * @param key the key which the widget should be set to
 
58
        */
 
59
        virtual void updateKey(CSwordKey* key) = 0;
 
60
        /**
 
61
        * gets the current @ref CKey
 
62
        *
 
63
        * @return the current @ref CKey
 
64
        */
 
65
        virtual CSwordKey* const key() = 0;
 
66
        /**
 
67
        * Sets the module of this keychooser and refreshes the comboboxes
 
68
        */
 
69
        virtual void setModules( const ListCSwordModuleInfo& modules, const bool refresh = true ) = 0;
 
70
        /**
 
71
        * Freshes the content of the different key chooser parts.
 
72
        */
 
73
        virtual void refreshContent() = 0;
 
74
 
 
75
        void addToHistory(CSwordKey*);
 
76
 
 
77
        void backInHistory();
 
78
        void backInHistory(int);
 
79
 
 
80
        void forwardInHistory();
 
81
        void forwardInHistory(int);
 
82
 
 
83
signals:
 
84
        /**
 
85
        * is emitted if the @ref CKey was changed by the user
 
86
        */
 
87
        void keyChanged(CSwordKey* key);
 
88
        /**
 
89
        * Is emitted before the key is changed!
 
90
        */
 
91
        void beforeKeyChange(const QString& key);
 
92
        void historyChanged();
 
93
 
 
94
protected:
 
95
        /**
 
96
        * the constructor - DO NOT USE! -- use @ref #createInstance instead!
 
97
        */
 
98
        CKeyChooser(ListCSwordModuleInfo info, CSwordKey *key=0, QWidget *parent=0, const char *name=0);
 
99
        virtual ~CKeyChooser();
 
100
        /**
 
101
        * Set the appropriate font do display the modules
 
102
        */
 
103
        virtual void adjustFont() = 0;
 
104
 
 
105
private:
 
106
        QStringList m_prevKeyHistoryList;
 
107
        QStringList m_nextKeyHistoryList;
 
108
        int m_currentKeyHistoryPos;
 
109
        bool m_inHistoryFunction;
 
110
protected:
 
111
        virtual void polish();
 
112
};
 
113
 
 
114
#endif