Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXCheckButtonTooltip.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
// CheckButton similar to FXCheckButton but with the possibility of showing tooltips
19
/****************************************************************************/
20
#include <config.h>
21
22
#include "
MFXCheckButtonTooltip.h
"
23
24
25
FXDEFMAP
(
MFXCheckButtonTooltip
) MFXCheckButtonTooltipMap[] = {
26
FXMAPFUNC(SEL_ENTER, 0,
MFXCheckButtonTooltip::onEnter
),
27
FXMAPFUNC(SEL_LEAVE, 0,
MFXCheckButtonTooltip::onLeave
),
28
FXMAPFUNC(SEL_MOTION, 0,
MFXCheckButtonTooltip::onMotion
),
29
};
30
31
// Object implementation
32
FXIMPLEMENT(
MFXCheckButtonTooltip
, FXCheckButton, MFXCheckButtonTooltipMap, ARRAYNUMBER(MFXCheckButtonTooltipMap))
33
34
35
MFXCheckButtonTooltip
::
MFXCheckButtonTooltip
(FXComposite* p,
MFXStaticToolTip
* staticToolTip, const FXString& text, FXObject* tgt,
36
FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
37
FXCheckButton(p, text, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),
38
myStaticToolTip(staticToolTip) {
39
}
40
41
42
MFXCheckButtonTooltip::~MFXCheckButtonTooltip
() {}
43
44
45
void
46
MFXCheckButtonTooltip::setToolTipText
(
const
FXString& toolTip) {
47
myToolTipText
= toolTip;
48
}
49
50
51
long
52
MFXCheckButtonTooltip::onEnter
(FXObject* sender, FXSelector sel,
void
* ptr) {
53
// check if show toolTip text
54
if
(!
myToolTipText
.empty()) {
55
// show toolTip text
56
setTipText(
myToolTipText
);
57
// show tip show
58
myStaticToolTip
->
showStaticToolTip
(getTipText());
59
}
60
// continue with FXCheckButton function
61
return
FXCheckButton::onEnter(sender, sel, ptr);
62
}
63
64
65
long
66
MFXCheckButtonTooltip::onLeave
(FXObject* sender, FXSelector sel,
void
* ptr) {
67
// hide static toolTip
68
myStaticToolTip
->
hideStaticToolTip
();
69
// continue with FXCheckButton function
70
return
FXCheckButton::onLeave(sender, sel, ptr);
71
}
72
73
74
long
75
MFXCheckButtonTooltip::onMotion
(FXObject* sender, FXSelector sel,
void
* ptr) {
76
// update static tooltip
77
myStaticToolTip
->
onUpdate
(sender, sel, ptr);
78
return
FXCheckButton::onMotion(sender, sel, ptr);
79
}
80
81
/****************************************************************************/
FXDEFMAP
FXDEFMAP(MFXCheckButtonTooltip) MFXCheckButtonTooltipMap[]
MFXCheckButtonTooltip.h
MFXCheckButtonTooltip
Definition
MFXCheckButtonTooltip.h:29
MFXCheckButtonTooltip::onMotion
long onMotion(FXObject *, FXSelector, void *)
called when mouse motion in MFXCheckButtonTooltip
Definition
MFXCheckButtonTooltip.cpp:75
MFXCheckButtonTooltip::onLeave
long onLeave(FXObject *, FXSelector, void *)
called when mouse leaves in MFXCheckButtonTooltip
Definition
MFXCheckButtonTooltip.cpp:66
MFXCheckButtonTooltip::myStaticToolTip
MFXStaticToolTip * myStaticToolTip
FOX needs this.
Definition
MFXCheckButtonTooltip.h:63
MFXCheckButtonTooltip::onEnter
long onEnter(FXObject *, FXSelector, void *)
Definition
MFXCheckButtonTooltip.cpp:52
MFXCheckButtonTooltip::myToolTipText
FXString myToolTipText
toolTip text (if set, tooltip will be always show)
Definition
MFXCheckButtonTooltip.h:66
MFXCheckButtonTooltip::~MFXCheckButtonTooltip
~MFXCheckButtonTooltip()
destructor (Called automatically)
Definition
MFXCheckButtonTooltip.cpp:42
MFXCheckButtonTooltip::setToolTipText
void setToolTipText(const FXString &toolTip)
set toolTip
Definition
MFXCheckButtonTooltip.cpp:46
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
src
utils
foxtools
MFXCheckButtonTooltip.cpp
Generated on Mon Dec 23 2024 00:16:00 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8