summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/keychooser/ckeyreferencewidget.h
blob: 0025945ca97c65df14dddf62d67353bec1f01625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



#ifndef CKEYREFERENCEWIDGET_H
#define CKEYREFERENCEWIDGET_H

#include "cscrollerwidgetset.h"
#include "backend/cswordbiblemoduleinfo.h"

#include <tqwidget.h>
#include <tqlayout.h>

#include <klineedit.h>
#include <kcompletion.h>

class CLexiconKeyChooser;
class CSwordVerseKey;

class CKeyReferenceCompletion : public KCompletion {
    Q_OBJECT
public:
    CKeyReferenceCompletion(CSwordBibleModuleInfo*);
    TQString makeCompletion(const TQString &);
    TQStringList allMatches();
private:
    CSwordVerseKey *m_key;
    CSwordBibleModuleInfo *m_module;
};

class CKeyReferenceLineEdit : public KLineEdit {
    Q_OBJECT
public:
    CKeyReferenceLineEdit(TQWidget *parent=0, const char *name=0);
    void makeCompletion(const TQString &);
};

class CKeyReferenceWidget : public TQWidget  {
    Q_OBJECT
public:
    /**
    * the constructor
    */
    CKeyReferenceWidget(CSwordBibleModuleInfo *, CSwordVerseKey*, TQWidget *parent=0, const char *name=0);
    bool setKey(CSwordVerseKey* key);
    KLineEdit* textbox();
    void setModule(CSwordBibleModuleInfo *m = 0);

signals:
    void changed(CSwordVerseKey* key);

protected:
    void updateText();

protected slots: // Protected slots
    /**
    * Is called when the return key was presed in the textbox.
    */
    void slotReturnPressed();

    void slotClearRef();

    void slotUpdateLock();
    void slotUpdateUnlock();
    void slotBookChange(int);
    void slotChapterChange(int);
    void slotVerseChange(int);

private:
    friend class CLexiconKeyChooser;
    TQHBoxLayout *m_mainLayout;
    CKeyReferenceLineEdit *m_textbox;
    CSwordVerseKey *m_key;
    CScrollerWidgetSet *m_bookScroller;
    CScrollerWidgetSet *m_chapterScroller;
    CScrollerWidgetSet *m_verseScroller;
    bool updatelock;
    TQString oldKey;
    CSwordBibleModuleInfo *m_module;
};

#endif