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 <tqwidget.h> 00025 00026 #include <ktextedit.h> 00027 class KNote; 00028 class TQFont; 00029 class TQColor; 00030 class TQPushButton; 00031 class TDEAction; 00032 class TDEActionCollection; 00033 class TDEToggleAction; 00034 class TDEFontAction; 00035 class TDEFontSizeAction; 00036 00037 00038 class KNoteEdit : public KTextEdit 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 KNoteEdit( TDEActionCollection *actions, TQWidget *parent=0, const char *name=0 ); 00044 ~KNoteEdit(); 00045 void setNote( KNote *_note ) { 00046 m_note = _note; 00047 } 00048 void setText( const TQString& text ); 00049 void setTextFont( const TQFont& font ); 00050 void setTextColor( const TQColor& color ); 00051 void setTabStop( int tabs ); 00052 void setAutoIndentMode( bool newmode ); 00053 00054 public slots: 00055 virtual void setTextFormat( TextFormat f ); 00056 00057 void textStrikeOut( bool ); 00058 00059 void textColor(); 00060 00061 void textAlignLeft(); 00062 void textAlignCenter(); 00063 void textAlignRight(); 00064 void textAlignBlock(); 00065 00066 void textList(); 00067 00068 void textSuperScript(); 00069 void textSubScript(); 00070 00071 //void textIncreaseIndent(); 00072 //void textDecreaseIndent(); 00073 void slotCutEnabled( bool ); 00074 00075 protected: 00076 virtual void contentsDragEnterEvent( TQDragEnterEvent *e ); 00077 virtual void contentsDropEvent( TQDropEvent *e ); 00078 virtual TQPopupMenu *createPopupMenu( const TQPoint &pos ); 00079 00080 private slots: 00081 void slotReturnPressed(); 00082 00083 void fontChanged( const TQFont &f ); 00084 void colorChanged( const TQColor &c ); 00085 void alignmentChanged( int a ); 00086 void verticalAlignmentChanged( VerticalAlignment a ); 00087 void slotAllowTab(); 00088 00089 void setEnabledRedo( bool b ); 00090 void setEnabledUndo( bool b ); 00091 00092 private: 00093 void autoIndent(); 00094 00095 virtual bool linksEnabled() const { return true; } 00096 virtual void emitLinkClicked( const TQString &s ); 00097 00098 void enableRichTextActions(); 00099 void disableRichTextActions(); 00100 00101 private: 00102 TDEAction *m_cut; 00103 TDEAction *m_copy; 00104 TDEAction *m_paste; 00105 00106 TDEToggleAction *m_textBold; 00107 TDEToggleAction *m_textItalic; 00108 TDEToggleAction *m_textUnderline; 00109 TDEToggleAction *m_textStrikeOut; 00110 00111 TDEToggleAction *m_textAlignLeft; 00112 TDEToggleAction *m_textAlignCenter; 00113 TDEToggleAction *m_textAlignRight; 00114 TDEToggleAction *m_textAlignBlock; 00115 00116 TDEToggleAction *m_textList; 00117 TDEToggleAction *m_textSuper; 00118 TDEToggleAction *m_textSub; 00119 00120 //TDEAction *m_textIncreaseIndent; 00121 //TDEAction *m_textDecreaseIndent; 00122 00123 TDEAction *m_textColor; 00124 TDEFontAction *m_textFont; 00125 TDEFontSizeAction *m_textSize; 00126 TDEAction* undo; 00127 TDEAction* redo; 00128 bool m_autoIndentMode; 00129 KNote *m_note; 00130 }; 00131 00132 #endif