Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXMenuButtonTooltip.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-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
// MenuButton similar to FXMenuButton but with the possibility of showing tooltips
19
/****************************************************************************/
20
#include <config.h>
21
22
#include <
utils/gui/windows/GUIAppEnum.h
>
23
#include "
MFXMenuButtonTooltip.h
"
24
25
26
FXDEFMAP
(
MFXMenuButtonTooltip
) MFXMenuButtonTooltipMap[] = {
27
FXMAPFUNC(SEL_ENTER, 0,
MFXMenuButtonTooltip::onEnter
),
28
FXMAPFUNC(SEL_LEAVE, 0,
MFXMenuButtonTooltip::onLeave
),
29
FXMAPFUNC(SEL_MOTION, 0,
MFXMenuButtonTooltip::onMotion
),
30
FXMAPFUNC(SEL_LEFTBUTTONPRESS, 0,
MFXMenuButtonTooltip::onLeftBtnPress
),
31
FXMAPFUNC(SEL_KEYPRESS, 0,
MFXMenuButtonTooltip::onKeyPress
),
32
FXMAPFUNC(SEL_COMMAND, FXWindow::ID_POST,
MFXMenuButtonTooltip::onCmdPost
),
33
};
34
35
// Object implementation
36
FXIMPLEMENT(
MFXMenuButtonTooltip
, FXMenuButton, MFXMenuButtonTooltipMap, ARRAYNUMBER(MFXMenuButtonTooltipMap))
37
38
39
MFXMenuButtonTooltip
::
MFXMenuButtonTooltip
(FXComposite* p,
MFXStaticToolTip
* staticToolTip, const
std
::
string
& text, FXIcon* ic,
40
FXPopup* pup, FXObject* optionalTarget, FXuint opts,
41
FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
42
FXMenuButton(p, text.c_str(), ic, pup, opts, x, y, w, h, pl, pr, pt, pb),
43
myStaticToolTip(staticToolTip),
44
myOptionalTarget(optionalTarget) {
45
}
46
47
48
MFXMenuButtonTooltip::~MFXMenuButtonTooltip
() {}
49
50
51
long
52
MFXMenuButtonTooltip::onEnter
(FXObject* sender, FXSelector sel,
void
* ptr) {
53
// show tip show
54
myStaticToolTip
->
showStaticToolTip
(getTipText());
55
return
FXMenuButton::onEnter(sender, sel, ptr);
56
}
57
58
59
long
60
MFXMenuButtonTooltip::onLeave
(FXObject* sender, FXSelector sel,
void
* ptr) {
61
// hide static toolTip
62
myStaticToolTip
->
hideStaticToolTip
();
63
return
FXMenuButton::onLeave(sender, sel, ptr);
64
}
65
66
67
long
68
MFXMenuButtonTooltip::onMotion
(FXObject* sender, FXSelector sel,
void
* ptr) {
69
// update static tooltip
70
myStaticToolTip
->
onUpdate
(sender, sel, ptr);
71
return
FXMenuButton::onMotion(sender, sel, ptr);
72
}
73
74
75
long
76
MFXMenuButtonTooltip::onLeftBtnPress
(FXObject* sender, FXSelector sel,
void
* ptr) {
77
// inform optional target
78
if
(
myOptionalTarget
) {
79
myOptionalTarget
->tryHandle(
this
, FXSEL(
MID_MBTTIP_FOCUS
, message),
nullptr
);
80
}
81
// continue handling onLeftBtnPress
82
return
FXMenuButton::onLeftBtnPress(sender, sel, ptr);
83
}
84
85
long
86
MFXMenuButtonTooltip::onKeyPress
(FXObject* sender, FXSelector sel,
void
* ptr) {
87
// inform optional target
88
if
(
myOptionalTarget
) {
89
myOptionalTarget
->tryHandle(
this
, FXSEL(
MID_MBTTIP_FOCUS
, message),
nullptr
);
90
}
91
// continue handling onKeyPress
92
return
FXMenuButton::onKeyPress(sender, sel, ptr);
93
}
94
95
96
long
97
MFXMenuButtonTooltip::onCmdPost
(FXObject* sender, FXSelector sel,
void
* ptr) {
98
// inform optional target
99
if
(
myOptionalTarget
) {
100
myOptionalTarget
->tryHandle(
this
, FXSEL(
MID_MBTTIP_SELECTED
, message),
nullptr
);
101
}
102
// continue handling onCheck
103
return
FXMenuButton::onCmdPost(sender, sel, ptr);
104
}
105
106
/****************************************************************************/
GUIAppEnum.h
MID_MBTTIP_SELECTED
@ MID_MBTTIP_SELECTED
Definition
GUIAppEnum.h:1623
MID_MBTTIP_FOCUS
@ MID_MBTTIP_FOCUS
callback for MFXMenuButtonTooltip
Definition
GUIAppEnum.h:1622
FXDEFMAP
FXDEFMAP(MFXMenuButtonTooltip) MFXMenuButtonTooltipMap[]
MFXMenuButtonTooltip.h
MFXMenuButtonTooltip
Definition
MFXMenuButtonTooltip.h:31
MFXMenuButtonTooltip::myStaticToolTip
MFXStaticToolTip * myStaticToolTip
FOX needs this.
Definition
MFXMenuButtonTooltip.h:73
MFXMenuButtonTooltip::onMotion
long onMotion(FXObject *, FXSelector, void *)
called when mouse motion in MFXMenuButtonTooltip
Definition
MFXMenuButtonTooltip.cpp:68
MFXMenuButtonTooltip::onKeyPress
long onKeyPress(FXObject *, FXSelector, void *)
called when key is press
Definition
MFXMenuButtonTooltip.cpp:86
MFXMenuButtonTooltip::~MFXMenuButtonTooltip
~MFXMenuButtonTooltip()
destructor (Called automatically)
Definition
MFXMenuButtonTooltip.cpp:48
MFXMenuButtonTooltip::onLeave
long onLeave(FXObject *, FXSelector, void *)
called when mouse leaves in MFXMenuButtonTooltip
Definition
MFXMenuButtonTooltip.cpp:60
MFXMenuButtonTooltip::onLeftBtnPress
long onLeftBtnPress(FXObject *, FXSelector, void *)
called when left mouse button is press
Definition
MFXMenuButtonTooltip.cpp:76
MFXMenuButtonTooltip::myOptionalTarget
FXObject * myOptionalTarget
optional target
Definition
MFXMenuButtonTooltip.h:76
MFXMenuButtonTooltip::onCmdPost
long onCmdPost(FXObject *, FXSelector, void *)
called when button is press
Definition
MFXMenuButtonTooltip.cpp:97
MFXMenuButtonTooltip::onEnter
long onEnter(FXObject *, FXSelector, void *)
Definition
MFXMenuButtonTooltip.cpp:52
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::hideStaticToolTip
void hideStaticToolTip()
hide static toolTip
Definition
MFXStaticToolTip.cpp:94
std
Definition
json.hpp:4471
src
utils
foxtools
MFXMenuButtonTooltip.cpp
Generated on Sat Nov 9 2024 00:10:31 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8