Choreonoid  1.8
MessageView.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_MESSAGE_VIEW_H
6 #define CNOID_BASE_MESSAGE_VIEW_H
7 
8 #include <cnoid/View>
9 #include <QString>
10 #include <string>
11 #include <iosfwd>
12 #include "exportdecl.h"
13 
14 namespace cnoid {
15 
16 class CNOID_EXPORT MessageView : public View
17 {
18 public:
19  static void postMessageBeforeInitialization(const std::string& message, int type = Normal);
20  static void initializeClass(ExtensionManager* ext);
21 
22  static MessageView* mainInstance();
23  static MessageView* instance();
24 
25  MessageView();
26  ~MessageView();
27 
28 #if defined(_WIN32) && defined(ERROR)
29 #undef ERROR
30 #endif
31 
32  enum MessageType {
33  Normal, Error, Warning, Highlight,
34  // deprecated
35  NORMAL = Normal, ERROR = Error, WARNING = Warning, HIGHLIGHT = Highlight
36  };
37 
38  void put(const std::string& message, int type = Normal);
39  void put(std::string&& message, int type = Normal);
40  void put(const char* message, int type = Normal);
41  void put(const QString& message, int type = Normal);
42 
43  void putln(const std::string& message, int type = Normal);
44  void putln(std::string&& message, int type = Normal);
45  void putln(const char* message, int type = Normal);
46  void putln(const QString& message, int type = Normal);
47  void putln();
48 
49  void notify(const std::string& message, int type = Normal);
50  void notify(std::string&& message, int type = Normal);
51  void notify(const char* message, int type = Normal);
52  void notify(const QString& message, int type = Normal);
53 
54  [[deprecated("Use put(const std::string& message, int type = Normal)")]]
55  void put(int type, const std::string& message);
56  [[deprecated("Use put(const char* message, int type = Normal)")]]
57  void put(int type, const char* message);
58  [[deprecated("Use put(const QString& message, int type = Normal)")]]
59  void put(int type, const QString& message);
60 
61  [[deprecated("Use putln(const std::string& message, int type = Normal)")]]
62  void putln(int type, const std::string& message);
63  [[deprecated("Use putln(const char* message, int type = Normal)")]]
64  void putln(int type, const char* message);
65  [[deprecated("Use putln(const QString& message, int type = Normal)")]]
66  void putln(int type, const QString& message);
67 
68  int currentColumn();
69 
70  void flush();
71  static bool isFlushing();
72 
73  void clear();
74 
75  std::ostream& cout(bool doFlush = true);
76 
77  void beginStdioRedirect();
78  void endStdioRedirect();
79 
80  SignalProxy<void(const std::string& text)> sigMessage();
81 
82  class Impl;
83 
84 protected:
85  virtual bool event(QEvent* e);
86 
87 private:
88  Impl* impl;
89 };
90 
91 #ifndef CNOID_BASE_MVOUT_DECLARED
92 #define CNOID_BASE_MVOUT_DECLARED
93 CNOID_EXPORT std::ostream& mvout(bool doFlush = true);
94 #endif
95 
96 CNOID_EXPORT void showMessageBox(const std::string& message);
97 CNOID_EXPORT void showMessageBox(const char* message);
98 CNOID_EXPORT void showMessageBox(const QString& message);
99 
100 CNOID_EXPORT void showWarningDialog(const std::string& message);
101 CNOID_EXPORT void showWarningDialog(const char* message);
102 CNOID_EXPORT void showWarningDialog(const QString& message);
103 
104 CNOID_EXPORT bool showConfirmDialog(const char* caption, const char* message);
105 CNOID_EXPORT bool showConfirmDialog(const std::string& caption, const std::string& message);
106 CNOID_EXPORT bool showConfirmDialog(const QString& caption, const QString& message);
107 
108 }
109 
110 #endif
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::View
Definition: View.h:27
cnoid::showConfirmDialog
CNOID_EXPORT bool showConfirmDialog(const char *caption, const char *message)
Definition: MessageView.cpp:1164
cnoid::showWarningDialog
CNOID_EXPORT void showWarningDialog(const std::string &message)
Definition: MessageView.cpp:1143
cnoid::MessageView
Definition: MessageView.h:16
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::MessageView::MessageType
MessageType
Definition: MessageView.h:32
cnoid::showMessageBox
CNOID_EXPORT void showMessageBox(const std::string &message)
Definition: MessageView.cpp:1125
cnoid::mvout
CNOID_EXPORT std::ostream & mvout(bool doFlush=true)
Definition: MessageView.cpp:1108
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::MessageView::Warning
@ Warning
Definition: MessageView.h:33