knotes Library API Documentation

knoteedit.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2003, 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 
00033 
00034 class KNoteEdit : public KTextEdit
00035 {
00036     Q_OBJECT
00037 public:
00038     KNoteEdit( QWidget *tool, QWidget *parent=0, const char *name=0 );
00039     ~KNoteEdit();
00040 
00041     void setTextFont( const QFont& font );
00042     void setTextColor( const QColor& color );
00043     void setTabStop( int tabs );
00044     void setAutoIndentMode( bool newmode );
00045 
00046 public slots:
00047     virtual void setTextFormat( TextFormat f );
00048 
00049 //    void textStyleSelected( int );
00050 //    void textSizeSelected( int );
00051 //    void textFontSelected( const QString & );
00052 
00053     void textColor();
00054 
00055     void textAlignLeft();
00056     void textAlignCenter();
00057     void textAlignRight();
00058     void textAlignBlock();
00059 
00060     void textList();
00061 
00062     void textSuperScript();
00063     void textSubScript();
00064 
00065     void textIncreaseIndent();
00066     void textDecreaseIndent();
00067 
00068 protected:
00069     virtual void contentsDragEnterEvent( QDragEnterEvent *e );
00070     virtual void contentsDragMoveEvent( QDragMoveEvent *e );
00071     virtual void contentsDropEvent( QDropEvent *e );
00072 
00073 private slots:
00074     void slotReturnPressed();
00075 
00076     // this is needed as long as we don't use actions
00077     void slotSetBold();
00078     void slotSetItalic();
00079     void slotSetUnderline();
00080 
00081     void fontChanged( const QFont &f );
00082     void colorChanged( const QColor &c );
00083     void alignmentChanged( int a );
00084     void verticalAlignmentChanged( VerticalAlignment a );
00085 
00086 private:
00087     void autoIndent();
00088 
00089     virtual bool linksEnabled() const { return true; }
00090     virtual void emitLinkClicked( const QString &s );
00091 
00092     void enableRichTextActions();
00093     void disableRichTextActions();
00094 
00095 private:
00096     KAction *m_cut;
00097     KAction *m_copy;
00098     KAction *m_paste;
00099 
00100 #if 0
00101     KAction *m_textColor;
00102 
00103     KToggleAction *m_textBold;
00104     KToggleAction *m_textItalic;
00105     KToggleAction *m_textUnderline;
00106 
00107     KToggleAction *m_textAlignLeft;
00108     KToggleAction *m_textAlignCenter;
00109     KToggleAction *m_textAlignRight;
00110     KToggleAction *m_textAlignBlock;
00111 
00112     KToggleAction *m_textList;
00113     KToggleAction *m_textSuper;
00114     KToggleAction *m_textSub;
00115 
00116     KAction *m_textIncreaseIndent;
00117     KAction *m_textDecreaseIndent;
00118 #else
00119     QPushButton *m_textColor;
00120 
00121     QPushButton *m_textBold;
00122     QPushButton *m_textItalic;
00123     QPushButton *m_textUnderline;
00124 
00125     QPushButton *m_textAlignLeft;
00126     QPushButton *m_textAlignCenter;
00127     QPushButton *m_textAlignRight;
00128     QPushButton *m_textAlignBlock;
00129 
00130     QPushButton *m_textList;
00131     QPushButton *m_textSuper;
00132     QPushButton *m_textSub;
00133 
00134     QPushButton *m_textIncreaseIndent;
00135     QPushButton *m_textDecreaseIndent;
00136 #endif
00137 
00138     bool m_autoIndentMode;
00139 };
00140 
00141 #endif
KDE Logo
This file is part of the documentation for knotes Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Mar 6 17:18:05 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003