HelpView.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  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 Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #ifndef GUI_DOCKWND_HELP_VIEW_H
00025 #define GUI_DOCKWND_HELP_VIEW_H
00026 
00027 #include <QTextBrowser>
00028 #include "DockWindow.h"
00029 #include "Window.h"
00030 
00031 class QUrl;
00032 class QLabel;
00033 class QHttpResponseHeader;
00034 
00035 namespace Gui {
00036 namespace DockWnd {
00037 
00043 class TextBrowserPrivate;
00044 class TextBrowser : public QTextBrowser
00045 {
00046   Q_OBJECT
00047 
00048 public:
00049   TextBrowser(QWidget * parent=0);
00050   virtual ~TextBrowser();
00051 
00052   void setSource (const QUrl& url);
00053   QVariant loadResource (int type, const QUrl& name);
00054 
00055   void backward();
00056   void forward();
00057 
00058 Q_SIGNALS:
00060   void startExternalBrowser( const QString& );
00061   void stateChanged(const QString&);
00062 
00063 protected:
00064   void dropEvent       (QDropEvent  * e);
00065   void dragEnterEvent  (QDragEnterEvent * e);
00066   void dragMoveEvent   (QDragMoveEvent  * e );
00067   void contextMenuEvent(QContextMenuEvent * );
00068   void timerEvent      (QTimerEvent * e );
00069 
00070 private Q_SLOTS:
00071   void setBackwardAvailable( bool b);
00072   void setForwardAvailable( bool b);
00073   void done( bool );
00074   void onStateChanged ( int state );
00075   void onResponseHeaderReceived(const QHttpResponseHeader &);
00076   void onHighlighted(const QString&);
00077 
00078 private:
00079   QString findUrl(const QUrl &name) const;
00080   QVariant loadFileResource(int type, const QUrl& name);
00081   QVariant loadHttpResource(int type, const QUrl& name);
00082 
00083 private:
00084   TextBrowserPrivate* d;
00085 };
00086 
00091 class HelpViewViewPrivate;
00092 class GuiExport HelpView : public QWidget
00093 {
00094   Q_OBJECT
00095 
00096 public:
00097   HelpView( const QString& home_, QWidget* parent = 0 );
00098   ~HelpView();
00099 
00100   void setFileSource( const QString& );
00104   bool eventFilter ( QObject* o, QEvent* e );
00105 
00106 Q_SIGNALS:
00107   void setSource( const QUrl& );
00108 
00109 private Q_SLOTS:
00110   void openHelpFile();
00111   void startExternalBrowser( const QString& );
00112   void onStateChanged(const QString& state);
00113 
00114 private:
00115   QLabel* label;
00116 };
00117 
00118 } // namespace DockWnd
00119 } // namespace Gui
00120 
00121 #endif // GUI_DOCKWND_HELP_VIEW_H

Generated on Wed Nov 23 19:00:17 2011 for FreeCAD by  doxygen 1.6.1