Quantum GIS API Documentation  1.8
src/core/qgsmessageoutput.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsmessageoutput.h  -  interface for showing messages
00003     ----------------------
00004     begin                : April 2006
00005     copyright            : (C) 2006 by Martin Dobias
00006     email                : wonder.sk at gmail dot com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 
00017 #ifndef QGSMESSAGEOUTPUT_H
00018 #define QGSMESSAGEOUTPUT_H
00019 
00020 #include <QString>
00021 #include <QObject>
00022 
00023 class QgsMessageOutput;
00024 typedef QgsMessageOutput*( *MESSAGE_OUTPUT_CREATOR )();
00025 
00026 
00038 class CORE_EXPORT QgsMessageOutput
00039 {
00040   public:
00041 
00043     enum MessageType { MessageText, MessageHtml };
00044 
00046     virtual ~QgsMessageOutput();
00047 
00049     virtual void setMessage( const QString& message, MessageType msgType ) = 0;
00050 
00052     virtual void appendMessage( const QString& message ) = 0;
00053 
00055     virtual void setTitle( const QString& title ) = 0;
00056 
00058     virtual void showMessage( bool blocking = true ) = 0;
00059 
00061     static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f );
00062 
00065     static QgsMessageOutput* createMessageOutput();
00066 
00067   private:
00068 
00070     static MESSAGE_OUTPUT_CREATOR mMessageOutputCreator;
00071 };
00072 
00073 
00080 class CORE_EXPORT QgsMessageOutputConsole : public QObject, public QgsMessageOutput
00081 {
00082     Q_OBJECT
00083 
00084   public:
00085 
00086     QgsMessageOutputConsole();
00087 
00088     virtual void setMessage( const QString& message, MessageType msgType );
00089 
00090     virtual void appendMessage( const QString& message );
00091 
00092     virtual void setTitle( const QString& title );
00093 
00095     virtual void showMessage( bool blocking = true );
00096 
00097   signals:
00098 
00100     void destroyed();
00101 
00102   private:
00103 
00105     QString mMessage;
00106 
00108     QString mTitle;
00109 
00110     MessageType mMsgType;
00111 };
00112 
00113 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines