krop's commit fixes my problem in a better way, reverting
[kdepim.git] / knotes / knoteedit.h
blob8ed438de0f192de9127145d3a5a37cd98995cbc7
1 /*******************************************************************
2 KNotes -- Notes for the KDE project
4 Copyright (c) 1997-2005, The KNotes Developers
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *******************************************************************/
21 #ifndef KNOTEEDIT_H
22 #define KNOTEEDIT_H
24 #include <QDragEnterEvent>
25 #include <QDropEvent>
26 #include <QTextCharFormat>
27 #include <QWidget>
29 #include <ktextedit.h>
31 class QFont;
33 class KAction;
34 class KActionCollection;
35 class KFontAction;
36 class KFontSizeAction;
37 class KToggleAction;
38 class KNote;
40 class KNoteEdit
41 : public KTextEdit
43 Q_OBJECT
44 public:
45 KNoteEdit( KActionCollection *actions, QWidget *parent = 0 );
46 ~KNoteEdit();
48 void setNote( KNote *_note ) {
49 m_note = _note;
51 void setText( const QString &text );
52 QString text() const;
54 void setTextFont( const QFont &font );
55 void setTabStop( int tabs );
56 void setAutoIndentMode( bool newmode );
58 public slots:
59 void setRichText( bool );
61 void textBold( bool );
62 void textStrikeOut( bool );
64 void slotTextColor();
66 void textAlignLeft();
67 void textAlignCenter();
68 void textAlignRight();
69 void textAlignBlock();
71 void textList();
73 void textSuperScript();
74 void textSubScript();
76 void textIncreaseIndent();
77 void textDecreaseIndent();
78 void setTextFontSize( int );
80 void slotTextBackgroundColor();
82 protected:
83 virtual void dragEnterEvent( QDragEnterEvent * );
84 virtual void dropEvent( QDropEvent * );
85 virtual void keyPressEvent( QKeyEvent * );
86 virtual void focusInEvent( QFocusEvent * );
87 virtual void focusOutEvent( QFocusEvent * );
89 private slots:
90 void slotCurrentCharFormatChanged( const QTextCharFormat & );
91 void slotCursorPositionChanged();
92 private:
93 void autoIndent();
95 void setTextFormat( const QTextCharFormat & );
97 void enableRichTextActions();
98 void disableRichTextActions();
100 private:
102 KToggleAction *m_textBold;
103 KToggleAction *m_textItalic;
104 KToggleAction *m_textUnderline;
105 KToggleAction *m_textStrikeOut;
107 KToggleAction *m_textAlignLeft;
108 KToggleAction *m_textAlignCenter;
109 KToggleAction *m_textAlignRight;
110 KToggleAction *m_textAlignBlock;
112 KToggleAction *m_textList;
113 KToggleAction *m_textSuper;
114 KToggleAction *m_textSub;
116 KAction *m_textIncreaseIndent;
117 KAction *m_textDecreaseIndent;
119 KAction *m_textColor;
120 KFontAction *m_textFont;
121 KFontSizeAction *m_textSize;
122 KNote *m_note;
123 bool m_autoIndentMode;
126 #endif