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-2025 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 "MFXStaticToolTip.h"
24
25// ===========================================================================
26// FOX callback mapping
27// ===========================================================================
28
29FXDEFMAP(MFXCheckButtonTooltip) MFXCheckButtonTooltipMap[] = {
30 FXMAPFUNC(SEL_ENTER, 0, MFXCheckButtonTooltip::onEnter),
31 FXMAPFUNC(SEL_LEAVE, 0, MFXCheckButtonTooltip::onLeave),
32 FXMAPFUNC(SEL_MOTION, 0, MFXCheckButtonTooltip::onMotion),
33};
34
35// Object implementation
36FXIMPLEMENT(MFXCheckButtonTooltip, FXCheckButton, MFXCheckButtonTooltipMap, ARRAYNUMBER(MFXCheckButtonTooltipMap))
37
38// ===========================================================================
39// method definitions
40// ===========================================================================
41
42MFXCheckButtonTooltip::MFXCheckButtonTooltip(FXComposite* p, MFXStaticToolTip* staticToolTip, const FXString& text, FXObject* tgt,
43 FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :
44 FXCheckButton(p, text, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),
45 myStaticToolTip(staticToolTip) {
46}
47
48
50
51
52void
53MFXCheckButtonTooltip::setToolTipText(const FXString& toolTip) {
54 myToolTipText = toolTip;
55}
56
57
58long
59MFXCheckButtonTooltip::onEnter(FXObject* sender, FXSelector sel, void* ptr) {
60 // check if show toolTip text
61 if (!myToolTipText.empty()) {
62 // show toolTip text
63 setTipText(myToolTipText);
64 // show tip show
66 }
67 // continue with FXCheckButton function
68 return FXCheckButton::onEnter(sender, sel, ptr);
69}
70
71
72long
73MFXCheckButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {
74 // hide static toolTip
76 // continue with FXCheckButton function
77 return FXCheckButton::onLeave(sender, sel, ptr);
78}
79
80
81long
82MFXCheckButtonTooltip::onMotion(FXObject* sender, FXSelector sel, void* ptr) {
83 // update static tooltip
84 myStaticToolTip->onUpdate(sender, sel, ptr);
85 return FXCheckButton::onMotion(sender, sel, ptr);
86}
87
88/****************************************************************************/
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