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