~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/frontend/display/chtmlwritedisplay.h

  • Committer: mgruner
  • Date: 2007-05-08 15:51:07 UTC
  • Revision ID: vcs-imports@canonical.com-20070508155107-0rj7jdmm5ivf8685
-imported source and data files to new svn module
-this is where KDE4-based development will take place

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********
 
2
*
 
3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
 
4
*
 
5
* Copyright 1999-2006 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
 
 
11
 
 
12
#ifndef CHTMLWRITEDISPLAY_H
 
13
#define CHTMLWRITEDISPLAY_H
 
14
 
 
15
//BibleTime includes
 
16
#include "cplainwritedisplay.h"
 
17
 
 
18
//Qt includes
 
19
#include <qwidget.h>
 
20
#include <qtextedit.h>
 
21
 
 
22
class CWriteWindow;
 
23
 
 
24
class QPopupMenu;
 
25
 
 
26
class KToggleAction;
 
27
class KFontAction;
 
28
class KFontSizeAction;
 
29
 
 
30
class KColorButton;
 
31
 
 
32
/** The WYSIWYG implementation of the write display interface.
 
33
  * @author The BibleTime team
 
34
  */
 
35
class CHTMLWriteDisplay : public CPlainWriteDisplay  {
 
36
        Q_OBJECT
 
37
public:
 
38
        /**
 
39
        * Sets the new text for this display widget.
 
40
        */
 
41
        virtual void setText( const QString& newText );
 
42
        /**
 
43
        * Returns the text of this edit widget.
 
44
        */
 
45
        virtual const QString plainText();
 
46
 
 
47
        /**
 
48
        * Creates the necessary action objects and puts them on the toolbar.
 
49
        */
 
50
        virtual void setupToolbar(KToolBar * bar, KActionCollection * actionCollection);
 
51
 
 
52
protected:
 
53
        friend class CDisplay;
 
54
        CHTMLWriteDisplay(CWriteWindow* parentWindow, QWidget* parent);
 
55
        ~CHTMLWriteDisplay();
 
56
        /**
 
57
        * Reimplementation to show a popup menu if the right mouse butoon was clicked.
 
58
        */
 
59
        virtual QPopupMenu* createPopupMenu( const QPoint& pos );
 
60
 
 
61
protected slots:
 
62
        void toggleBold();
 
63
        void toggleItalic();
 
64
        void toggleUnderline();
 
65
 
 
66
        void alignLeft();
 
67
        void alignCenter();
 
68
        void alignRight();
 
69
 
 
70
        void slotFontChanged( const QFont& );
 
71
        /**
 
72
        * The text's alignment changed. Enable the right buttons.
 
73
        */
 
74
        void slotAlignmentChanged( int );
 
75
        /**
 
76
        * Is called when a new color was selected.
 
77
        */
 
78
        void slotColorSelected( const QColor& );
 
79
        /**
 
80
        * Is called when a text with another color was selected.
 
81
        */
 
82
        void slotColorChanged( const QColor& );
 
83
 
 
84
private:
 
85
        struct {
 
86
                KToggleAction* bold;
 
87
                KToggleAction* italic;
 
88
                KToggleAction* underline;
 
89
 
 
90
                KToggleAction* alignLeft;
 
91
                KToggleAction* alignCenter;
 
92
                KToggleAction* alignRight;
 
93
 
 
94
                KFontAction* fontChooser;
 
95
                KFontSizeAction* fontSizeChooser;
 
96
 
 
97
                //popup menu
 
98
                KAction* selectAll;
 
99
        }
 
100
        m_actions;
 
101
        KColorButton* m_colorButton;
 
102
};
 
103
 
 
104
#endif