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
23
24
25FXDEFMAP(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
32FXIMPLEMENT(MFXCheckButtonTooltip, FXCheckButton, MFXCheckButtonTooltipMap, ARRAYNUMBER(MFXCheckButtonTooltipMap))
33
34
35MFXCheckButtonTooltip::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
43
44
45void
46MFXCheckButtonTooltip::setToolTipText(const FXString& toolTip) {
47 myToolTipText = toolTip;
48}
49
50
51long
52MFXCheckButtonTooltip::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
59 }
60 // continue with FXCheckButton function
61 return FXCheckButton::onEnter(sender, sel, ptr);
62}
63
64
65long
66MFXCheckButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {
67 // hide static toolTip
69 // continue with FXCheckButton function
70 return FXCheckButton::onLeave(sender, sel, ptr);
71}
72
73
74long
75MFXCheckButtonTooltip::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(MFXCheckButtonTooltip) MFXCheckButtonTooltipMap[]
long onMotion(FXObject *, FXSelector, void *)
called when mouse motion in MFXCheckButtonTooltip
long onLeave(FXObject *, FXSelector, void *)
called when mouse leaves in MFXCheckButtonTooltip
MFXStaticToolTip * myStaticToolTip
FOX needs this.
long onEnter(FXObject *, FXSelector, void *)
FXString myToolTipText
toolTip text (if set, tooltip will be always show)
~MFXCheckButtonTooltip()
destructor (Called automatically)
void setToolTipText(const FXString &toolTip)
set toolTip
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