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

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

Generated by: LCOV version 1.14