Eclipse SUMO - Simulation of Urban MObility
GUIMessageWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2003-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A logging window for the gui
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <string>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class GUIGlObject;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
52 class GUIMessageWindow : public FXText {
53 public:
58  GUIMessageWindow(FXComposite* parent, GUIMainWindow* mainWindow);
59 
62 
64  virtual void setCursorPos(FXint pos, FXbool notify = FALSE);
65 
74  void appendMsg(GUIEventType eType, const std::string& msg);
75 
77  void addSeparator();
78 
80  void clear();
81 
83  void registerMsgHandlers();
84 
86  void unregisterMsgHandlers();
87 
89  static void enableLocateLinks(const bool val) {
90  myLocateLinks = val;
91  }
92 
94  static bool locateLinksEnabled() {
95  return myLocateLinks;
96  }
97 
99  static void setBreakPointOffset(SUMOTime val) {
100  myBreakPointOffset = val;
101  }
102 
105  return myBreakPointOffset;
106  }
107 
108 private:
110  class MsgOutputDevice : public OutputDevice {
111  public:
114  myMsgWindow(msgWindow),
115  myType(type) { }
116 
119 
120  protected:
122  std::ostream& getOStream() {
123  return myStream;
124  }
126  void postWriteHook() {
128  myStream.str("");
129  }
130 
131  private:
134 
136  std::ostringstream myStream;
137 
140  };
141 
143  const GUIGlObject* getActiveStringObject(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
144  SUMOTime getTimeString(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
145 
146 private:
148 
150  static bool myLocateLinks;
151 
154 
156  FXHiliteStyle* myStyles;
157 
160 };
GUIEventType
Definition: GUIEvent.h:32
long long int SUMOTime
Definition: SUMOTime.h:32
std::ostream & getOStream()
get Output Stream
std::ostringstream myStream
output string stream
MsgOutputDevice(GUIMessageWindow *msgWindow, GUIEventType type)
constructor
GUIMessageWindow * myMsgWindow
pointer to message Windows
GUIEventType myType
type of event
A logging window for the gui.
GUIMainWindow * myMainWindow
OutputDevice * myGLDebugRetriever
void addSeparator()
Adds a a separator to this log window.
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations.
void unregisterMsgHandlers()
unregister message handlers
static SUMOTime myBreakPointOffset
Offset when creating breakpoint by clicking on time links.
void clear()
Clears the window.
SUMOTime getTimeString(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
static bool myLocateLinks
whether messages are linked to the GUI elements
FXHiliteStyle * myStyles
The text colors used.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static bool locateLinksEnabled()
ask whether locate links is enabled
static void enableLocateLinks(const bool val)
switch locate links on and off
virtual void setCursorPos(FXint pos, FXbool notify=FALSE)
set cursor position over a certain line
GUIMessageWindow(FXComposite *parent, GUIMainWindow *mainWindow)
Constructor.
static void setBreakPointOffset(SUMOTime val)
switch locate links on and off
OutputDevice * myWarningRetriever
OutputDevice * myMessageRetriever
OutputDevice * myDebugRetriever
~GUIMessageWindow()
Destructor.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
const GUIGlObject * getActiveStringObject(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
get active string object
void registerMsgHandlers()
register message handlers
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61