knotes
knoteedit.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KNOTEEDIT_H
00022 #define KNOTEEDIT_H
00023
00024 #include <QDragEnterEvent>
00025 #include <QDropEvent>
00026 #include <QTextCharFormat>
00027 #include <QWidget>
00028
00029 #include <ktextedit.h>
00030
00031 class QColor;
00032 class QFont;
00033
00034 class KAction;
00035 class KActionCollection;
00036 class KFontAction;
00037 class KFontSizeAction;
00038 class KMenu;
00039 class KToggleAction;
00040
00041
00042 class KNoteEdit
00043 : public KTextEdit
00044 {
00045 Q_OBJECT
00046 public:
00047 KNoteEdit( KActionCollection *actions, QWidget *parent = 0 );
00048 ~KNoteEdit();
00049
00050 void setText( const QString &text );
00051 QString text() const;
00052
00053 void setTextFont( const QFont &font );
00054 void setTextColor( const QColor &color );
00055 void setTabStop( int tabs );
00056 void setAutoIndentMode( bool newmode );
00057
00058 void setContextMenu( KMenu *menu )
00059 {
00060 m_editMenu = menu;
00061 }
00062
00063 public slots:
00064 void setRichText( bool );
00065
00066 void textBold( bool );
00067 void textStrikeOut( bool );
00068
00069 void slotTextColor();
00070
00071 void textAlignLeft();
00072 void textAlignCenter();
00073 void textAlignRight();
00074 void textAlignBlock();
00075
00076 void textList();
00077
00078 void textSuperScript();
00079 void textSubScript();
00080
00081 void textIncreaseIndent();
00082 void textDecreaseIndent();
00083
00084 protected:
00085 virtual void contextMenuEvent( QContextMenuEvent * );
00086 virtual void dragEnterEvent( QDragEnterEvent * );
00087 virtual void dropEvent( QDropEvent * );
00088 virtual void keyPressEvent( QKeyEvent * );
00089 virtual void focusInEvent( QFocusEvent * );
00090 virtual void focusOutEvent( QFocusEvent * );
00091
00092 private slots:
00093 void slotCurrentCharFormatChanged( const QTextCharFormat & );
00094
00095 private:
00096 void autoIndent();
00097
00098 void setTextFormat( const QTextCharFormat & );
00099
00100 void enableRichTextActions();
00101 void disableRichTextActions();
00102
00103 private:
00104 KAction *m_cut;
00105 KAction *m_copy;
00106 KAction *m_paste;
00107
00108 KMenu *m_editMenu;
00109
00110 KToggleAction *m_textBold;
00111 KToggleAction *m_textItalic;
00112 KToggleAction *m_textUnderline;
00113 KToggleAction *m_textStrikeOut;
00114
00115 KToggleAction *m_textAlignLeft;
00116 KToggleAction *m_textAlignCenter;
00117 KToggleAction *m_textAlignRight;
00118 KToggleAction *m_textAlignBlock;
00119
00120 KToggleAction *m_textList;
00121 KToggleAction *m_textSuper;
00122 KToggleAction *m_textSub;
00123
00124 KAction *m_textIncreaseIndent;
00125 KAction *m_textDecreaseIndent;
00126
00127 KAction *m_textColor;
00128 KFontAction *m_textFont;
00129 KFontSizeAction *m_textSize;
00130
00131 bool m_autoIndentMode;
00132 };
00133
00134 #endif