QGIS API Documentation  2.2.0-Valmiera
 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  // TODO: implementation where python class could be passed
63  static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f );
64 
67  static QgsMessageOutput* createMessageOutput();
68 
69  private:
70 
73 };
74 
75 
82 class CORE_EXPORT QgsMessageOutputConsole : public QObject, public QgsMessageOutput
83 {
84  Q_OBJECT
85 
86  public:
87 
89 
90  virtual void setMessage( const QString& message, MessageType msgType );
91 
92  virtual void appendMessage( const QString& message );
93 
94  virtual void setTitle( const QString& title );
95 
97  virtual void showMessage( bool blocking = true );
98 
99  signals:
100 
102  void destroyed();
103 
104  private:
105 
107  QString mMessage;
108 
110  QString mTitle;
111 
113 };
114 
115 #endif