Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIMessageWindow.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2003-2026 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
113 long onRightBtnRelease(FXObject* o, FXSelector sel, void* data);
114
116 long onCmdClear(FXObject*, FXSelector, void*);
117
119 long onUpdClear(FXObject* sender, FXSelector, void* data);
120
122 static FXHiliteStyle* getStyles();
123
124protected:
126 FOX_CONSTRUCTOR(GUIMessageWindow)
127
128private:
131
132 public:
135 myMsgWindow(msgWindow),
136 myType(type) { }
137
140
141 protected:
143 std::ostream& getOStream() {
144 return myStream;
145 }
149 myStream.str("");
150 }
151
152 private:
155
157 std::ostringstream myStream;
158
161 };
162
164 static bool findObjectTypeID(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE, std::string& id, std::string& type);
165 const GUIGlObject* getActiveStringObject(const FXString& text, const FXint pos, const FXint lineS, const FXint lineE) const;
166 bool hasActiveStringObject(const FXString& text, const FXint pos) const;
167
169 SUMOTime getTimeString(const FXString& text, const FXint pos) const;
170
172 void fillStyles();
173
176
178 static bool myLocateLinks;
179
182
184 static FXHiliteStyle* myStyles;
185
187 static std::string myTimeText;
188
190 static std::map<std::string, std::string> myTypeStrings;
191
194};
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
main window
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.
void fillStyles()
fill styles
static std::string myTimeText
The time text to look for.
static FXHiliteStyle * myStyles
The text colors used.
static bool myLocateLinks
whether messages are linked to the GUI elements
long onRightBtnRelease(FXObject *o, FXSelector sel, void *data)
handle right button release
long onUpdClear(FXObject *sender, FXSelector, void *data)
handle update of clear command
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static bool locateLinksEnabled()
ask whether locate links is enabled
static FXHiliteStyle * getStyles()
The text colors used.
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
SUMOTime getTimeString(const FXString &text, const FXint pos) const
get time string object
static void setBreakPointOffset(SUMOTime val)
switch locate links on and off
static std::map< std::string, std::string > myTypeStrings
The translated type strings text to look for.
OutputDevice * myWarningRetriever
OutputDevice * myMessageRetriever
static bool findObjectTypeID(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE, std::string &id, std::string &type)
get active string object
~GUIMessageWindow()
Destructor.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
long onCmdClear(FXObject *, FXSelector, void *)
handle clear command
const GUIGlObject * getActiveStringObject(const FXString &text, const FXint pos, const FXint lineS, const FXint lineE) const
bool hasActiveStringObject(const FXString &text, const FXint pos) const
void registerMsgHandlers()
register message handlers
Static storage of an output device and its base (abstract) implementation.