knotes

knoteedit.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2004, The KNotes Developers
00005 
00006  This program is free software; you can redistribute it and/or
00007  modify it under the terms of the GNU General Public License
00008  as published by the Free Software Foundation; either version 2
00009  of the License, or (at your option) any later version.
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with this program; if not, write to the Free Software
00018  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 *******************************************************************/
00020 
00021 #ifndef KNOTEEDIT_H
00022 #define KNOTEEDIT_H
00023 
00024 #include <qwidget.h>
00025 
00026 #include <ktextedit.h>
00027 class KNote;
00028 class QFont;
00029 class QColor;
00030 class QPushButton;
00031 class KAction;
00032 class KActionCollection;
00033 class KToggleAction;
00034 class KFontAction;
00035 class KFontSizeAction;
00036 
00037 
00038 class KNoteEdit : public KTextEdit
00039 {
00040     Q_OBJECT
00041 public:
00042     KNoteEdit( KActionCollection *actions, QWidget *parent=0, const char *name=0 );
00043     ~KNoteEdit();
00044     void setNote( KNote *_note ) {
00045         m_note = _note;
00046     }
00047     void setText( const QString& text );
00048     void setTextFont( const QFont& font );
00049     void setTextColor( const QColor& color );
00050     void setTabStop( int tabs );
00051     void setAutoIndentMode( bool newmode );
00052 
00053 public slots:
00054     virtual void setTextFormat( TextFormat f );
00055 
00056     void textStrikeOut( bool );
00057 
00058     void textColor();
00059 
00060     void textAlignLeft();
00061     void textAlignCenter();
00062     void textAlignRight();
00063     void textAlignBlock();
00064 
00065     void textList();
00066 
00067     void textSuperScript();
00068     void textSubScript();
00069 
00070     //void textIncreaseIndent();
00071     //void textDecreaseIndent();
00072     void slotCutEnabled( bool );
00073 
00074 protected:
00075     virtual void contentsDragEnterEvent( QDragEnterEvent *e );
00076     virtual void contentsDropEvent( QDropEvent *e );
00077     virtual QPopupMenu *createPopupMenu( const QPoint &pos );
00078 
00079 private slots:
00080     void slotReturnPressed();
00081 
00082     void fontChanged( const QFont &f );
00083     void colorChanged( const QColor &c );
00084     void alignmentChanged( int a );
00085     void verticalAlignmentChanged( VerticalAlignment a );
00086     void slotAllowTab();
00087 
00088     void setEnabledRedo( bool b );
00089     void setEnabledUndo( bool b );
00090 
00091 private:
00092     void autoIndent();
00093 
00094     virtual bool linksEnabled() const { return true; }
00095     virtual void emitLinkClicked( const QString &s );
00096 
00097     void enableRichTextActions();
00098     void disableRichTextActions();
00099 
00100 private:
00101     KAction *m_cut;
00102     KAction *m_copy;
00103     KAction *m_paste;
00104 
00105     KToggleAction *m_textBold;
00106     KToggleAction *m_textItalic;
00107     KToggleAction *m_textUnderline;
00108     KToggleAction *m_textStrikeOut;
00109 
00110     KToggleAction *m_textAlignLeft;
00111     KToggleAction *m_textAlignCenter;
00112     KToggleAction *m_textAlignRight;
00113     KToggleAction *m_textAlignBlock;
00114 
00115     KToggleAction *m_textList;
00116     KToggleAction *m_textSuper;
00117     KToggleAction *m_textSub;
00118 
00119     //KAction       *m_textIncreaseIndent;
00120     //KAction       *m_textDecreaseIndent;
00121 
00122     KAction         *m_textColor;
00123     KFontAction     *m_textFont;
00124     KFontSizeAction *m_textSize;
00125     KAction* undo;
00126     KAction* redo;
00127     bool m_autoIndentMode;
00128     KNote           *m_note;
00129 };
00130 
00131 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys