SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIMessageWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A logging window for the gui
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef GUIMessageWindow_h
22 #define GUIMessageWindow_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <fx.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class GUIGlObject;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
61 class GUIMessageWindow : public FXText {
62 public:
67  GUIMessageWindow(FXComposite* parent);
68 
69 
72 
73 
74  virtual void setCursorPos(FXint pos, FXbool notify = FALSE);
75 
76 
85  void appendMsg(GUIEventType eType, const std::string& msg);
86 
87 
89  void addSeparator();
90 
91 
93  void clear();
94 
96  void registerMsgHandlers();
97  void unregisterMsgHandlers();
98 
100  static void enableLocateLinks(const bool val) {
101  myLocateLinks = val;
102  }
103 
105  static bool locateLinksEnabled() {
106  return myLocateLinks;
107  }
108 
109 
110 private:
111  class MsgOutputDevice : public OutputDevice {
112  public:
114  myMsgWindow(msgWindow),
115  myType(type) { }
116 
118 
119  protected:
120  std::ostream& getOStream() {
121  return myStream;
122  }
123  void postWriteHook() {
125  myStream.str("");
126  }
127 
128  private:
130  std::ostringstream myStream;
132  };
133 
134  const GUIGlObject* getActiveStringObject(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
135 
136 private:
137 
139  static bool myLocateLinks;
140 
142  FXHiliteStyle* myStyles;
143 
146 
147 
148 
149 };
150 
151 
152 #endif
153 
154 /****************************************************************************/
155 
std::ostream & getOStream()
Returns the associated ostream.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
void registerMsgHandlers()
register and unregister message handlers
~GUIMessageWindow()
Destructor.
void addSeparator()
Adds a a separator to this log window.
void postWriteHook()
Called after every write access.
FXHiliteStyle * myStyles
The text colors used.
virtual void setCursorPos(FXint pos, FXbool notify=FALSE)
GUIMessageWindow(FXComposite *parent)
Constructor.
GUIEventType
Definition: GUIEvent.h:42
MsgOutputDevice(GUIMessageWindow *msgWindow, GUIEventType type)
OutputDevice * myMessageRetriever
static void enableLocateLinks(const bool val)
switch locate links on and off
static bool myLocateLinks
whether messages are linked to the GUI elements
const GUIGlObject * getActiveStringObject(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
void clear()
Clears the window.
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations.
static bool locateLinksEnabled()
ask whether locate links is enabled
A logging window for the gui.
OutputDevice * myWarningRetriever