summaryrefslogtreecommitdiff
path: root/bibletime/printing/cprintitem.h
blob: 81b33a3e8f87f87f4459035d7e7ec21a37778ae6 (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
/***************************************************************************
                          cprintitem.h  -  description
                             -------------------
    begin                : Sun Aug 20 2000
    copyright            : (C) 2000 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 CPRINTITEM_H
#define CPRINTITEM_H

//BibleTime includes
#include "frontend/cbtconfig.h"

//Qt includes
#include <qobject.h>
#include <qguardedptr.h>
#include <qptrlist.h>
#include <qlistview.h>

class CSwordKey;
class CSwordModuleInfo;
class CStyle;
class CPrinter;
class CPrintItem;
class CPrintItemList;

typedef QPtrList<CPrintItem> ListCPrintItem;

/**
	* The class which implements the printable items.
  * @author The BibleTime team
  */
class CPrintItem {
public:
  class ListViewItem : public QListViewItem {
		public:
			ListViewItem( QListView* parent, CPrintItem* printItem );
			CPrintItem* const printItem() const;		
			CStyle* const style() const;			
		private:
			CPrintItem* m_printItem;
  };
	
	CPrintItem(CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, const QString& description = QString::null, const CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults(),const CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults() );
  /**
	* Sets the style for this item.
 	*/
	void setStyle( CStyle* );
  /**
	* Sets the style for this item.
 	*/
	CStyle* const style() const;
  /**
 	* Returns the listview item for this printitem.
 	*/
  QListViewItem* listViewItem( CPrintItemList* );
  /**
 	* Updates the item.
 	*/
  void updateListViewItem();
  /**
	* Returns the used ListView item.
	*/
  QListViewItem* const listViewItem() const;
  /**
 	* Deletes the list view item.
 	*/
  void deleteListViewItem();
  /**
  * Draws the content of this item on the page.
  */
  void draw(QPainter* p, CPrinter* printer);

private: // Protected attributes
  const QString& headerText();
  const QString& moduleText();

  CStyle* m_style;
  QString m_headerText;
  QString m_description;
  QString m_moduleText;
	QString m_startKey;
	QString m_stopKey;
	bool m_startEmpty;
	bool m_stopEmpty;
  CSwordModuleInfo* m_module;
  QListViewItem* m_listViewItem;

  CSwordBackend::DisplayOptions m_displayOptions;
  CSwordBackend::FilterOptions m_filterOptions;
};

#endif