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 
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 
00045     void setText( const QString& text );
00046     void setTextFont( const QFont& font );
00047     void setTextColor( const QColor& color );
00048     void setTabStop( int tabs );
00049     void setAutoIndentMode( bool newmode );
00050 
00051 public slots:
00052     virtual void setTextFormat( TextFormat f );
00053 
00054     void textStrikeOut( bool );
00055 
00056     void textColor();
00057 
00058     void textAlignLeft();
00059     void textAlignCenter();
00060     void textAlignRight();
00061     void textAlignBlock();
00062 
00063     void textList();
00064 
00065     void textSuperScript();
00066     void textSubScript();
00067 
00068     //void textIncreaseIndent();
00069     //void textDecreaseIndent();
00070     void slotCutEnabled( bool );
00071 
00072 protected:
00073     virtual void contentsDragEnterEvent( QDragEnterEvent *e );
00074     virtual void contentsDropEvent( QDropEvent *e );
00075     virtual QPopupMenu *createPopupMenu( const QPoint &pos );
00076 
00077 private slots:
00078     void slotReturnPressed();
00079 
00080     void fontChanged( const QFont &f );
00081     void colorChanged( const QColor &c );
00082     void alignmentChanged( int a );
00083     void verticalAlignmentChanged( VerticalAlignment a );
00084     void slotAllowTab();
00085 
00086     void setEnabledRedo( bool b );
00087     void setEnabledUndo( bool b );
00088 
00089 private:
00090     void autoIndent();
00091 
00092     virtual bool linksEnabled() const { return true; }
00093     virtual void emitLinkClicked( const QString &s );
00094 
00095     void enableRichTextActions();
00096     void disableRichTextActions();
00097 
00098 private:
00099     KAction *m_cut;
00100     KAction *m_copy;
00101     KAction *m_paste;
00102 
00103     KToggleAction *m_textBold;
00104     KToggleAction *m_textItalic;
00105     KToggleAction *m_textUnderline;
00106     KToggleAction *m_textStrikeOut;
00107 
00108     KToggleAction *m_textAlignLeft;
00109     KToggleAction *m_textAlignCenter;
00110     KToggleAction *m_textAlignRight;
00111     KToggleAction *m_textAlignBlock;
00112 
00113     KToggleAction *m_textList;
00114     KToggleAction *m_textSuper;
00115     KToggleAction *m_textSub;
00116 
00117     //KAction       *m_textIncreaseIndent;
00118     //KAction       *m_textDecreaseIndent;
00119 
00120     KAction         *m_textColor;
00121     KFontAction     *m_textFont;
00122     KFontSizeAction *m_textSize;
00123     KAction* undo;
00124     KAction* redo;
00125     bool m_autoIndentMode;
00126 };
00127 
00128 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys