LCOV - code coverage report
Current view: top level - src/utils/foxtools - MFXListIconItem.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 1 0
Test Date: 2025-12-06 15:35:27 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2006-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    MFXListIconItem.h
      15              : /// @author  Pablo Alvarez Lopez
      16              : /// @date    Feb 2023
      17              : ///
      18              : //
      19              : /****************************************************************************/
      20              : #pragma once
      21              : #include <config.h>
      22              : 
      23              : #include "fxheader.h"
      24              : 
      25              : // ===========================================================================
      26              : // class declaration
      27              : // ===========================================================================
      28              : 
      29              : class MFXListIcon;
      30              : 
      31              : // ===========================================================================
      32              : // class definitions
      33              : // ===========================================================================
      34              : 
      35              : class MFXListIconItem : public FXObject {
      36              :     /// @brief FOX declaration
      37            0 :     FXDECLARE(MFXListIconItem)
      38              : 
      39              :     /// @brief declare friend class
      40              :     friend class MFXListIcon;
      41              : 
      42              : public:
      43              :     enum {
      44              :         SELECTED  = 1,      /// Selected
      45              :         FOCUS     = 2,      /// Focus
      46              :         DISABLED  = 4,      /// Disabled
      47              :         DRAGGABLE = 8,      /// Draggable
      48              :         ICONOWNED = 16      /// Icon owned by item
      49              :     };
      50              : 
      51              :     /// @brief Construct new item with given text, icon, and user-data
      52              :     MFXListIconItem(const FXString& text, FXIcon* ic = NULL, FXColor backGroundColor = 0, void* ptr = NULL);
      53              : 
      54              :     /// @brief Destroy item and free icons if owned
      55              :     ~MFXListIconItem();
      56              : 
      57              :     /// @brief Change item's text label
      58              :     void setText(const FXString& txt);
      59              : 
      60              :     /// @brief Return item's text label
      61              :     const FXString& getText() const;
      62              : 
      63              :     /// @brief Return item's icon
      64              :     FXIcon* getIcon() const;
      65              : 
      66              :     /// @brief get background color
      67              :     const FXColor& getBackGroundColor() const;
      68              : 
      69              :     /// @brief Make item draw as focused
      70              :     void setFocus(FXbool focus);
      71              : 
      72              :     /// @brief Return true if item has focus
      73              :     FXbool hasFocus() const;
      74              : 
      75              :     /// @brief Select item
      76              :     void setSelected(FXbool selected);
      77              : 
      78              :     /// @brief Return true if this item is selected
      79              :     FXbool isSelected() const;
      80              : 
      81              :     /// @brief Enable or disable item
      82              :     void setEnabled(FXbool enabled);
      83              : 
      84              :     /// @brief Return true if this item is enabled
      85              :     FXbool isEnabled() const;
      86              : 
      87              :     /// @brief Make item draggable
      88              :     void setDraggable(FXbool draggable);
      89              : 
      90              :     /// @brief Return true if this item is draggable
      91              :     FXbool isDraggable() const;
      92              : 
      93              :     /// @brief Return width of item as drawn in list
      94              :     FXint getWidth(const MFXListIcon* list) const;
      95              : 
      96              :     /// @brief Return height of item as drawn in list
      97              :     FXint getHeight(const MFXListIcon* list) const;
      98              : 
      99              :     /// @brief Create server-side resources
     100              :     void create();
     101              : 
     102              :     /// @brief Detach server-side resources
     103              :     void detach();
     104              : 
     105              :     /// @brief Destroy server-side resources
     106              :     void destroy();
     107              : 
     108              : protected:
     109              :     /// @brief FOX need this
     110              :     MFXListIconItem();
     111              : 
     112              :     /// @brief daraw
     113              :     void draw(const MFXListIcon* list, FXDC&   dc, FXint x, FXint y, FXint w, FXint h);
     114              : 
     115              :     /// @brief hit item
     116              :     FXint hitItem(const MFXListIcon* list, FXint x, FXint y) const;
     117              : 
     118              :     /// @brief label
     119              :     FXString label;
     120              : 
     121              :     /// @brief icon
     122              :     FXIcon* icon = nullptr;
     123              : 
     124              :     /// @brief data
     125              :     void* data = nullptr;
     126              : 
     127              :     /// @brief state
     128              :     FXuint state = 0;
     129              : 
     130              :     /// @brief position
     131              :     FXint x = 0;
     132              :     FXint y = 0;
     133              : 
     134              :     /// @brief backGround color
     135              :     FXColor myBackGroundColor = 0;
     136              : 
     137              :     /// @brief flag for show/hidde element
     138              :     bool show = true;
     139              : 
     140              : private:
     141              :     /// @brief invalidate copy constructor
     142              :     MFXListIconItem(const MFXListIconItem&) = delete;
     143              : 
     144              :     /// @brief invalidate assign constructor
     145              :     MFXListIconItem&   operator = (const MFXListIconItem&) = delete;
     146              : };
        

Generated by: LCOV version 2.0-1