LCOV - code coverage report
Current view: top level - src/utils/foxtools - MFXButtonTooltip.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 40.0 % 15 6
Test Date: 2025-11-13 15:38:19 Functions: 50.0 % 8 4

            Line data    Source code
       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              : /****************************************************************************/
      14              : /// @file    MFXButtonTooltip.cpp
      15              : /// @author  Angelo Banse
      16              : /// @date    2022-06-21
      17              : ///
      18              : // Button similar to FXButton but with the possibility of showing tooltips
      19              : /****************************************************************************/
      20              : #include <config.h>
      21              : 
      22              : #include "MFXStaticToolTip.h"
      23              : #include "MFXButtonTooltip.h"
      24              : 
      25              : // ===========================================================================
      26              : // FOX callback mapping
      27              : // ===========================================================================
      28              : 
      29              : FXDEFMAP(MFXButtonTooltip) MFXButtonTooltipMap[] = {
      30              :     FXMAPFUNC(SEL_ENTER,    0,  MFXButtonTooltip::onEnter),
      31              :     FXMAPFUNC(SEL_LEAVE,    0,  MFXButtonTooltip::onLeave),
      32              :     FXMAPFUNC(SEL_MOTION,   0,  MFXButtonTooltip::onMotion),
      33              : };
      34              : 
      35              : // Object implementation
      36     50157445 : FXIMPLEMENT(MFXButtonTooltip, FXButton, MFXButtonTooltipMap, ARRAYNUMBER(MFXButtonTooltipMap))
      37              : 
      38              : // ===========================================================================
      39              : // method definitions
      40              : // ===========================================================================
      41              : 
      42       166632 : MFXButtonTooltip::MFXButtonTooltip(FXComposite* p, MFXStaticToolTip* staticToolTip,
      43              :                                    const std::string& text, FXIcon* ic,
      44              :                                    FXObject* tgt, FXSelector sel, FXuint opts,
      45              :                                    FXint x, FXint y, FXint w, FXint h,
      46       166632 :                                    FXint pl, FXint pr, FXint pt, FXint pb) :
      47              :     FXButton(p, text.c_str(), ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),
      48       166632 :     myStaticToolTip(staticToolTip) {
      49       166632 : }
      50              : 
      51              : 
      52       332516 : MFXButtonTooltip::~MFXButtonTooltip() {}
      53              : 
      54              : 
      55              : long
      56            0 : MFXButtonTooltip::onEnter(FXObject* sender, FXSelector sel, void* ptr) {
      57              :     // show tip show
      58            0 :     myStaticToolTip->showStaticToolTip(getTipText());
      59            0 :     return FXButton::onEnter(sender, sel, ptr);
      60              : }
      61              : 
      62              : 
      63              : long
      64            0 : MFXButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {
      65              :     // hide static toolTip
      66            0 :     myStaticToolTip->hideStaticToolTip();
      67            0 :     return FXButton::onLeave(sender, sel, ptr);
      68              : }
      69              : 
      70              : 
      71              : long
      72            0 : MFXButtonTooltip::onMotion(FXObject* sender, FXSelector sel, void* ptr) {
      73              :     // update static tooltip
      74            0 :     myStaticToolTip->onUpdate(sender, sel, ptr);
      75            0 :     return FXButton::onMotion(sender, sel, ptr);
      76              : }
      77              : 
      78              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1