QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsmessageoutput.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmessageoutput.h - interface for showing messages
3  ----------------------
4  begin : April 2006
5  copyright : (C) 2006 by Martin Dobias
6  email : wonder.sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 
17 #ifndef QGSMESSAGEOUTPUT_H
18 #define QGSMESSAGEOUTPUT_H
19 
20 #include <QString>
21 #include <QObject>
22 
23 class QgsMessageOutput;
24 typedef QgsMessageOutput*( *MESSAGE_OUTPUT_CREATOR )();
25 
26 
38 class CORE_EXPORT QgsMessageOutput
39 {
40  public:
41 
43  enum MessageType { MessageText, MessageHtml };
44 
46  virtual ~QgsMessageOutput();
47 
49  virtual void setMessage( const QString& message, MessageType msgType ) = 0;
50 
52  virtual void appendMessage( const QString& message ) = 0;
53 
55  virtual void setTitle( const QString& title ) = 0;
56 
58  virtual void showMessage( bool blocking = true ) = 0;
59 
62  static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f );
63 
66  static QgsMessageOutput* createMessageOutput();
67 
68  private:
69 
72 };
73 
74 
81 class CORE_EXPORT QgsMessageOutputConsole : public QObject, public QgsMessageOutput
82 {
83  Q_OBJECT
84 
85  public:
86 
88 
89  virtual void setMessage( const QString& message, MessageType msgType );
90 
91  virtual void appendMessage( const QString& message );
92 
93  virtual void setTitle( const QString& title );
94 
96  virtual void showMessage( bool blocking = true );
97 
98  signals:
99 
101  void destroyed();
102 
103  private:
104 
106  QString mMessage;
107 
109  QString mTitle;
110 
112 };
113 
114 #endif