summaryrefslogtreecommitdiff
path: root/bibletime/frontend/displaywindow/cbuttons.h
blob: 7a84c35ebf9cd4c6ab7c7c6603fdfb8999178979 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/***************************************************************************
                          cbuttons.h  -  description
                             -------------------
    begin                : Sam Jul 13 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 CBUTTONS_H
#define CBUTTONS_H

//BibleTime includes
#include "backend/cswordbackend.h"
#include "backend/cswordmoduleinfo.h"

//QT includes
#include <qdict.h>

//KDE includes
#include <ktoolbarbutton.h>

class KPopupMenu;

/** This class manages the transliteration of the selected modules.
  * @author The BibleTime team
  */
class CTransliterationButton : public KToolBarButton  {
   Q_OBJECT
public: 
	CTransliterationButton(CSwordBackend::FilterOptions* displayOptions, QWidget *parent, const char *name=0);
	~CTransliterationButton();
  /**
  * Setup the menu entries.
  */
  void populateMenu();
  /**
  * Resets the buttons with the list of used modules.
  */
  void reset( ListCSwordModuleInfo& modules );

protected slots: // Protected slots
  void optionSelected(int);

private:
  KPopupMenu* m_popup;
  CSwordBackend::FilterOptions* m_filterOptions;

signals:
  void sigChanged();
};

/** This class manages the display options of the selected modules.
  * @author The BibleTime team
  */
class CDisplaySettingsButton : public KToolBarButton  {
   Q_OBJECT
public:
	CDisplaySettingsButton(CSwordBackend::DisplayOptions *displaySettings, CSwordBackend::FilterOptions *settings, const ListCSwordModuleInfo& useModules, QWidget *parent=0, const char *name=0);
	void reset(const ListCSwordModuleInfo& useModules);
  /**
  * Sets the item at position pos to the satet given as 2nd paramter.
  */
  void setItemStatus( const int pos, const bool checked );
  /**
  * Returns the number of usable menu items in the setttings menu.
  */
  const int menuItemCount();
  /**
  * Returns the status of the item at position "index"
  */
  const bool itemStatus( const int index );
  /**
  * Sets the status to changed. The signal changed will be emitted.
  */
  void setChanged();

signals:
	void sigChanged(void);

protected slots:
	void optionToggled(int ID);

protected:
	CSwordBackend::FilterOptions*  m_moduleSettings;
	CSwordBackend::DisplayOptions* m_displaySettings;
	CSwordBackend::FilterOptions m_available;
	ListCSwordModuleInfo m_modules;

	QDict<int> m_dict;

	KPopupMenu* m_popup;

  int populateMenu();
	bool isOptionAvailable( const CSwordBackend::FilterTypes option);
  int addMenuEntry( const QString name, const int* option, const bool available);
};

#endif