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