Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXToggleButtonTooltip.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// Button similar to FXToggleButton but with the possibility of showing tooltips
19/****************************************************************************/
20#include <config.h>
21
23
24
25FXDEFMAP(MFXToggleButtonTooltip) MFXToggleButtonTooltipMap[] = {
26 FXMAPFUNC(SEL_ENTER, 0, MFXToggleButtonTooltip::onEnter),
27 FXMAPFUNC(SEL_LEAVE, 0, MFXToggleButtonTooltip::onLeave),
28 FXMAPFUNC(SEL_MOTION, 0, MFXToggleButtonTooltip::onMotion),
29};
30
31
32// Object implementation
33FXIMPLEMENT(MFXToggleButtonTooltip, FXToggleButton, MFXToggleButtonTooltipMap, ARRAYNUMBER(MFXToggleButtonTooltipMap))
34
36 const std::string& text1, const std::string& text2, FXIcon* ic1, FXIcon* ic2, FXObject* tgt,
37 FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
38 FXToggleButton(p, text1.c_str(), text2.c_str(), ic1, ic2, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),
39 myStaticToolTip(staticToolTip) {
40}
41
42
44
45
46long
47MFXToggleButtonTooltip::onEnter(FXObject* sender, FXSelector sel, void* ptr) {
48 // show tip show
50 return FXToggleButton::onEnter(sender, sel, ptr);
51}
52
53
54long
55MFXToggleButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {
56 // hide static toolTip
58 return FXToggleButton::onLeave(sender, sel, ptr);
59}
60
61
62long
63MFXToggleButtonTooltip::onMotion(FXObject* sender, FXSelector sel, void* ptr) {
64 // update static tooltip
65 myStaticToolTip->onUpdate(sender, sel, ptr);
66 return FXToggleButton::onMotion(sender, sel, ptr);
67}
68
69/****************************************************************************/
FXDEFMAP(MFXToggleButtonTooltip) MFXToggleButtonTooltipMap[]
MFXStaticToolTip (based on FXToolTip)
long onUpdate(FXObject *sender, FXSelector sel, void *ptr)
called when tooltip is updated
void showStaticToolTip(const FXString &toolTipText)
show static toolTip
void hideStaticToolTip()
hide static toolTip
long onMotion(FXObject *, FXSelector, void *)
called when mouse motion in MFXToggleButtonTooltip
long onLeave(FXObject *, FXSelector, void *)
called when mouse leaves in MFXToggleButtonTooltip
~MFXToggleButtonTooltip()
destructor (Called automatically)
long onEnter(FXObject *, FXSelector, void *)
MFXStaticToolTip * myStaticToolTip
FOX needs this.
Definition json.hpp:4471