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// ===========================================================================
34class GUIGlObject;
35
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
52class GUIMessageWindow : public FXText {
53 FXDECLARE(GUIMessageWindow)
54public:
59 GUIMessageWindow(FXComposite* parent, GUIMainWindow* mainWindow);
60
63
65 virtual void setCursorPos(FXint pos, FXbool notify = FALSE);
66
75 void appendMsg(GUIEventType eType, const std::string& msg);
76
78 void addSeparator();
79
81 void clear();
82
85
88
90 static void enableLocateLinks(const bool val) {
91 myLocateLinks = val;
92 }
93
95 static bool locateLinksEnabled() {
96 return myLocateLinks;
97 }
98
100 static void setBreakPointOffset(SUMOTime val) {
101 myBreakPointOffset = val;
102 }
103
106 return myBreakPointOffset;
107 }
108
110 long onKeyPress(FXObject* o, FXSelector sel, void* data);
111
112protected:
113 FOX_CONSTRUCTOR(GUIMessageWindow)
114
115private:
118 public:
121 myMsgWindow(msgWindow),
122 myType(type) { }
123
126
127 protected:
129 std::ostream& getOStream() {
130 return myStream;
131 }
135 myStream.str("");
136 }
137
138 private:
141
143 std::ostringstream myStream;
144
147 };
148
150 const GUIGlObject* getActiveStringObject(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
151 SUMOTime getTimeString(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
152
153private:
155
157 static bool myLocateLinks;
158
161
163 FXHiliteStyle* myStyles;
164
167};
long long int SUMOTime
Definition: GUI.h:36
GUIEventType
Definition: GUIEvent.h:32
std::ostringstream myStream
output string stream
MsgOutputDevice(GUIMessageWindow *msgWindow, GUIEventType type)
constructor
std::ostream & getOStream()
get Output Stream
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
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
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