summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/display/chtmlwritedisplay.h
blob: 0d81610731f4fa4e9293f8758ff4c94a563cc67f (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
/*********
*
* 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 CHTMLWRITEDISPLAY_H
#define CHTMLWRITEDISPLAY_H

//BibleTime includes
#include "cplainwritedisplay.h"

//TQt includes
#include <tqwidget.h>
#include <tqtextedit.h>

class CWriteWindow;

class TQPopupMenu;

class TDEToggleAction;
class TDEFontAction;
class TDEFontSizeAction;

class KColorButton;

/** The WYSIWYG implementation of the write display interface.
  * @author The BibleTime team
  */
class CHTMLWriteDisplay : public CPlainWriteDisplay  {
	Q_OBJECT
  
public:
	/**
	* Sets the new text for this display widget.
	*/
	virtual void setText( const TQString& newText );
	/**
	* Returns the text of this edit widget.
	*/
	virtual const TQString plainText();

	/**
	* Creates the necessary action objects and puts them on the toolbar.
	*/
	virtual void setupToolbar(TDEToolBar * bar, TDEActionCollection * actionCollection);

protected:
	friend class CDisplay;
	CHTMLWriteDisplay(CWriteWindow* parentWindow, TQWidget* parent);
	~CHTMLWriteDisplay();
	/**
	* Reimplementation to show a popup menu if the right mouse butoon was clicked.
	*/
	virtual TQPopupMenu* createPopupMenu( const TQPoint& pos );

protected slots:
	void toggleBold();
	void toggleItalic();
	void toggleUnderline();

	void alignLeft();
	void alignCenter();
	void alignRight();

	void slotFontChanged( const TQFont& );
	/**
	* The text's alignment changed. Enable the right buttons.
	*/
	void slotAlignmentChanged( int );
	/**
	* Is called when a new color was selected.
	*/
	void slotColorSelected( const TQColor& );
	/**
	* Is called when a text with another color was selected.
	*/
	void slotColorChanged( const TQColor& );

private:
	struct {
		TDEToggleAction* bold;
		TDEToggleAction* italic;
		TDEToggleAction* underline;

		TDEToggleAction* alignLeft;
		TDEToggleAction* alignCenter;
		TDEToggleAction* alignRight;

		TDEFontAction* fontChooser;
		TDEFontSizeAction* fontSizeChooser;

		//popup menu
		TDEAction* selectAll;
	}
	m_actions;
	KColorButton* m_colorButton;
};

#endif