Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXStaticToolTip.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2006-2024 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
/****************************************************************************/
18
//
19
/****************************************************************************/
20
21
/* =========================================================================
22
* included modules
23
* ======================================================================= */
24
#include <config.h>
25
26
#include <
utils/gui/div/GUIDesigns.h
>
27
#include <
utils/gui/images/GUIIconSubSys.h
>
28
#include <
utils/gui/windows/GUIAppEnum.h
>
29
30
#include "
MFXStaticToolTip.h
"
31
32
33
// ===========================================================================
34
// FOX callback mapping
35
// ===========================================================================
36
37
FXDEFMAP
(
MFXStaticToolTip
) MFXStaticToolTipMap[] = {
38
FXMAPFUNC(SEL_PAINT, 0,
MFXStaticToolTip::onPaint
),
39
FXMAPFUNC(SEL_UPDATE, 0,
MFXStaticToolTip::onUpdate
),
40
};
41
42
// Object implementation
43
FXIMPLEMENT(
MFXStaticToolTip
, FXToolTip, MFXStaticToolTipMap, ARRAYNUMBER(MFXStaticToolTipMap))
44
45
// ===========================================================================
46
// method definitions
47
// ===========================================================================
48
49
MFXStaticToolTip
::
MFXStaticToolTip
(FXApp* app) :
50
FXToolTip(app) {
51
// set empty test
52
setText(
""
);
53
// start hide
54
hide();
55
}
56
57
58
MFXStaticToolTip::~MFXStaticToolTip
() {}
59
60
61
void
62
MFXStaticToolTip::enableStaticToolTip
(
const
bool
value) {
63
if
(value) {
64
myEnableStaticTooltip
=
true
;
65
}
else
{
66
myEnableStaticTooltip
=
false
;
67
hideStaticToolTip
();
68
}
69
}
70
71
72
bool
73
MFXStaticToolTip::isStaticToolTipEnabled
()
const
{
74
return
myEnableStaticTooltip
;
75
}
76
77
78
void
79
MFXStaticToolTip::showStaticToolTip
(
const
FXString& toolTipText) {
80
if
(!
myEnableStaticTooltip
|| toolTipText.empty()) {
81
hideStaticToolTip
();
82
}
else
{
83
// set tip text
84
setText(toolTipText);
85
// update before show (for position)
86
onUpdate
(
nullptr
, 0,
nullptr
);
87
// show StaticToolTip
88
show();
89
}
90
}
91
92
93
void
94
MFXStaticToolTip::hideStaticToolTip
() {
95
// clear text
96
setText(
""
);
97
// hide staticTooltip
98
hide();
99
}
100
101
102
long
103
MFXStaticToolTip::onPaint
(FXObject* sender, FXSelector sel,
void
* obj) {
104
// draw tooltip using myToolTippedObject
105
if
(!label.empty() &&
myEnableStaticTooltip
) {
106
return
FXToolTip::onPaint(sender, sel, obj);
107
}
else
{
108
return
0;
109
}
110
}
111
112
113
long
114
MFXStaticToolTip::onUpdate
(FXObject* sender, FXSelector sel,
void
* ptr) {
115
// Regular GUI update
116
FXWindow::onUpdate(sender, sel, ptr);
117
// Ask the help source for a new status text first
118
if
(label.empty()) {
119
popped = FALSE;
120
hide();
121
}
else
{
122
popped = TRUE;
123
FXint x, y;
124
FXuint state;
125
getRoot()->getCursorPosition(x, y, state);
126
place(x, y);
127
}
128
return
1;
129
}
130
131
132
MFXStaticToolTip::MFXStaticToolTip
() :
133
FXToolTip() {
134
}
GUIAppEnum.h
GUIDesigns.h
GUIIconSubSys.h
FXDEFMAP
FXDEFMAP(MFXStaticToolTip) MFXStaticToolTipMap[]
MFXStaticToolTip.h
MFXStaticToolTip
MFXStaticToolTip (based on FXToolTip)
Definition
MFXStaticToolTip.h:27
MFXStaticToolTip::onUpdate
long onUpdate(FXObject *sender, FXSelector sel, void *ptr)
called when tooltip is updated
Definition
MFXStaticToolTip.cpp:114
MFXStaticToolTip::showStaticToolTip
void showStaticToolTip(const FXString &toolTipText)
show static toolTip
Definition
MFXStaticToolTip.cpp:79
MFXStaticToolTip::myEnableStaticTooltip
bool myEnableStaticTooltip
flag for enable/disable static tooltip
Definition
MFXStaticToolTip.h:66
MFXStaticToolTip::onPaint
long onPaint(FXObject *obj, FXSelector sel, void *ptr)
Definition
MFXStaticToolTip.cpp:103
MFXStaticToolTip::enableStaticToolTip
void enableStaticToolTip(const bool value)
enable/disable static tooltip
Definition
MFXStaticToolTip.cpp:62
MFXStaticToolTip::~MFXStaticToolTip
~MFXStaticToolTip()
destructor
Definition
MFXStaticToolTip.cpp:58
MFXStaticToolTip::hideStaticToolTip
void hideStaticToolTip()
hide static toolTip
Definition
MFXStaticToolTip.cpp:94
MFXStaticToolTip::MFXStaticToolTip
MFXStaticToolTip()
FOX need this.
Definition
MFXStaticToolTip.cpp:132
MFXStaticToolTip::isStaticToolTipEnabled
bool isStaticToolTipEnabled() const
check staticToolTip is enabled
Definition
MFXStaticToolTip.cpp:73
src
utils
foxtools
MFXStaticToolTip.cpp
Generated on Tue Nov 5 2024 00:10:31 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8