Path: blob/main/src/utils/foxtools/MFXCheckButtonTooltip.cpp
169678 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file MFXCheckButtonTooltip.cpp14/// @author Pablo Alvarez Lopez15/// @date May 2316///17// CheckButton similar to FXCheckButton but with the possibility of showing tooltips18/****************************************************************************/19#include <config.h>2021#include "MFXStaticToolTip.h"22#include "MFXCheckButtonTooltip.h"2324// ===========================================================================25// FOX callback mapping26// ===========================================================================2728FXDEFMAP(MFXCheckButtonTooltip) MFXCheckButtonTooltipMap[] = {29FXMAPFUNC(SEL_ENTER, 0, MFXCheckButtonTooltip::onEnter),30FXMAPFUNC(SEL_LEAVE, 0, MFXCheckButtonTooltip::onLeave),31FXMAPFUNC(SEL_MOTION, 0, MFXCheckButtonTooltip::onMotion),32};3334// Object implementation35FXIMPLEMENT(MFXCheckButtonTooltip, FXCheckButton, MFXCheckButtonTooltipMap, ARRAYNUMBER(MFXCheckButtonTooltipMap))3637// ===========================================================================38// method definitions39// ===========================================================================4041MFXCheckButtonTooltip::MFXCheckButtonTooltip(FXComposite* p, MFXStaticToolTip* staticToolTip, const FXString& text, FXObject* tgt,42FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) :43FXCheckButton(p, text, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),44myStaticToolTip(staticToolTip) {45}464748MFXCheckButtonTooltip::~MFXCheckButtonTooltip() {}495051void52MFXCheckButtonTooltip::setToolTipText(const FXString& toolTip) {53myToolTipText = toolTip;54}555657long58MFXCheckButtonTooltip::onEnter(FXObject* sender, FXSelector sel, void* ptr) {59// check if show toolTip text60if (!myToolTipText.empty()) {61// show toolTip text62setTipText(myToolTipText);63// show tip show64myStaticToolTip->showStaticToolTip(getTipText());65}66// continue with FXCheckButton function67return FXCheckButton::onEnter(sender, sel, ptr);68}697071long72MFXCheckButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {73// hide static toolTip74myStaticToolTip->hideStaticToolTip();75// continue with FXCheckButton function76return FXCheckButton::onLeave(sender, sel, ptr);77}787980long81MFXCheckButtonTooltip::onMotion(FXObject* sender, FXSelector sel, void* ptr) {82// update static tooltip83myStaticToolTip->onUpdate(sender, sel, ptr);84return FXCheckButton::onMotion(sender, sel, ptr);85}8687/****************************************************************************/888990