KTextEditor

message.h
1 /*
2  SPDX-FileCopyrightText: 2012-2013 Dominik Haumann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KTEXTEDITOR_MESSAGE_H
8 #define KTEXTEDITOR_MESSAGE_H
9 
10 #include <QAction>
11 #include <QIcon>
12 #include <QList>
13 #include <QObject>
14 
15 #include <ktexteditor_export.h>
16 
17 namespace KTextEditor
18 {
19 class View;
20 class Document;
21 
93 class KTEXTEDITOR_EXPORT Message : public QObject
94 {
95  Q_OBJECT
96 
97  //
98  // public data types
99  //
100 public:
106  enum MessageType {
107  Positive = 0,
110  Error
111  };
112 
119  AboveView = 0,
128  CenterInView
129  };
130 
136  Immediate = 0,
137  AfterUserInteraction
138  };
139 
140 public:
146  Message(const QString &richtext, MessageType type = Message::Information);
147 
151  virtual ~Message();
152 
156  QString text() const;
157 
163  QIcon icon() const;
164 
168  MessageType messageType() const;
169 
190  void addAction(QAction *action, bool closeOnTrigger = true);
191 
197  QList<QAction *> actions() const;
198 
209  void setAutoHide(int delay = 0);
210 
217  int autoHide() const;
218 
225  void setAutoHideMode(KTextEditor::Message::AutoHideMode mode);
226 
232  KTextEditor::Message::AutoHideMode autoHideMode() const;
233 
243  void setWordWrap(bool wordWrap);
244 
250  bool wordWrap() const;
251 
259  void setPriority(int priority);
260 
266  int priority() const;
267 
274  void setView(KTextEditor::View *view);
275 
280  KTextEditor::View *view() const;
281 
289  void setDocument(KTextEditor::Document *document);
290 
295  KTextEditor::Document *document() const;
296 
302  void setPosition(MessagePosition position);
303 
308  MessagePosition position() const;
309 
310 public Q_SLOTS:
321  void setText(const QString &richtext);
322 
333  void setIcon(const QIcon &icon);
334 
335 Q_SIGNALS:
344  void closed(KTextEditor::Message *message);
345 
352  void textChanged(const QString &text);
353 
359  void iconChanged(const QIcon &icon);
360 
361 private:
362  class MessagePrivate *const d;
363 };
364 
365 }
366 
367 #endif
show message below view.
Definition: message.h:121
QString mode() const override
Return the name of the currently used mode.
A KParts derived class representing a text document.
Definition: document.h:185
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
MessagePosition
Message position used to place the message either above or below of the KTextEditor::View.
Definition: message.h:117
MessageType
Message types used as visual indicator.
Definition: message.h:106
show message as view overlay in the top right corner.
Definition: message.h:123
AutoHideMode
The AutoHideMode determines when to trigger the autoHide timer.
Definition: message.h:135
information message type
Definition: message.h:108
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:143
show message as view overlay in the bottom right corner.
Definition: message.h:125
Mark class containing line and mark types.
Definition: message.h:93
warning message type
Definition: message.h:109
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 22:57:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.