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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/***************************************************************************
cbooktreechooser.h - description
-------------------
begin : Sat Jan 26 2002
copyright : (C) 2002 by The BibleTime team
email : info@bibletime.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CBOOKTREECHOOSER_H
#define CBOOKTREECHOOSER_H
/** The treechooser implementation for books.
* @author The BibleTime team
*/
//BibleTime includes
#include "ckeychooser.h"
#include "ckeychooserwidget.h"
//Sword includes
//Qt includes
#include <qwidget.h>
#include <qsize.h>
#include <qmap.h>
#include <qptrlist.h>
#include <qstringlist.h>
//KDE includes
#include <klistview.h>
class CSwordKey;
class CSwordBookModuleInfo;
class CSwordTreeKey;
class TreeKeyIdx;
/** The keychooser implementeation for books.
* @author The BibleTime team
*/
class CBookTreeChooser : public CKeyChooser {
Q_OBJECT
public:
CBookTreeChooser(ListCSwordModuleInfo modules, CSwordKey *key=0, QWidget *parent=0, const char *name=0);
~CBookTreeChooser();
/**
* Refreshes the content.
*/
virtual void refreshContent();
/**
* Sets another module to this keychooser
*/
virtual void setModules(ListCSwordModuleInfo modules, const bool refresh = true);
/**
* Returns the key of this kechooser.
*/
virtual CSwordKey* const key();
/**
* Sets a new key to this keychooser
*/
virtual void setKey(CSwordKey*);
void setKey(CSwordKey*, const bool emitSinal);
public slots: // Public slots
virtual void updateKey( CSwordKey* );
/**
* Reimplementationm to handle tree creation on show.
*/
virtual void show();
protected: // Protected methods
/**
* Set up the tree with the current level of key.
*/
void setupTree( QListViewItem* parent,QListViewItem* after, CSwordTreeKey* key );
/**
* Creates the first level of the tree structure.
*/
void setupTree();
virtual void adjustFont();
protected slots: // Protected slots
void itemActivated( QListViewItem* item );
private:
class TreeItem : public KListViewItem {
public:
TreeItem(QListViewItem* parent, QListViewItem* after, CSwordTreeKey* key, const QString keyName);
TreeItem(QListViewItem* parent, CSwordTreeKey* key, const QString keyName);
TreeItem(QListView* view,QListViewItem* after, CSwordTreeKey* key, const QString keyName);
const QString& key() const;
void createChilds();
virtual void setOpen(bool);
protected:
/**
* Initializes this item with the correct caption.
*/
virtual void setup();
private:
CSwordTreeKey* m_key;
QString m_keyName;
};
QPtrList<CSwordBookModuleInfo> m_modules;
CSwordTreeKey* m_key;
KListView* m_treeView;
};
#endif
|