Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

htmlentrytextedit.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 - 2008 by Martin Mueller                           *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKAL_UIHTMLENTRYTEXTEDIT_H
00021 #define BLOKKAL_UIHTMLENTRYTEXTEDIT_H
00022 
00023 #include <ktextedit.h>
00024 #include <sonnet/highlighter.h>
00025 
00026 #include "../blokkal_export.h"
00027 
00028 class QAction;
00029 class KAction;
00030 class KActionCollection;
00031 
00032 namespace Blokkal {
00033 namespace Ui {
00034 class HtmlTextHighlighter;
00035 class DropProxy;
00042 class BLOKKAL_EXPORT HtmlEntryTextEdit : public KTextEdit
00043 {
00044 Q_OBJECT
00045 public:
00050         HtmlEntryTextEdit( QWidget * parent = 0 );
00051 
00055    virtual ~HtmlEntryTextEdit( void );
00056 
00061         void insertTextAtCursor( const QString & text );
00062 
00070         void frameSelection( const QString & front, const QString & tail );
00071 
00076         void setDropProxy( Blokkal::Ui::DropProxy * proxy );
00077 
00078 Q_SIGNALS:
00084         void plainTextChanged( void );
00085         
00086 protected:
00091         virtual void dropEvent( QDropEvent * event );
00092 
00096         virtual void contextMenuEvent( QContextMenuEvent * event );
00097 
00098 private Q_SLOTS:
00099         void checkCurrentBlock( void );
00100         void menuActivated( QAction * action );
00101 
00102 private:
00103         class Private;
00104         Private * const d;
00105 
00106 };
00107 
00116 class BLOKKAL_EXPORT HtmlTextHighlighter : public Sonnet::Highlighter
00117 {
00118 Q_OBJECT
00119 public:
00126         HtmlTextHighlighter( QTextEdit * parent );
00127 
00131         virtual ~HtmlTextHighlighter( void );
00132 
00133 protected:
00134         virtual void highlightBlock ( const QString & text );
00135 
00136 private Q_SLOTS:
00137         void slotAppearanceSettingsChanged( void );
00138         
00139 private:
00140         class Private;
00141         Private * const d;
00142 };
00143 
00150 class BLOKKAL_EXPORT DropProxy {
00151 public:
00152         virtual ~DropProxy( void );
00159         virtual bool handleDrop( QDropEvent * event, QWidget * widget ) = 0;
00160 };
00161 
00162 }
00163 }
00164 
00165 #endif