LCOV - code coverage report
Current view: top level - src/utils/gui/windows - GUIDialog_ChooserAbstract.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 3 0
Test Date: 2024-11-23 15:47:30 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-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    GUIDialog_ChooserAbstract.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Michael Behrisch
      18              : /// @date    Sept 2002
      19              : ///
      20              : // Class for the window that allows to choose a street, junction or vehicle
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <string>
      26              : #include <vector>
      27              : #include <set>
      28              : #include <utils/foxtools/fxheader.h>
      29              : #include <utils/gui/globjects/GUIGlObject.h>
      30              : #include <utils/gui/div/GUIPersistentWindowPos.h>
      31              : #include "GUIAppEnum.h"
      32              : 
      33              : 
      34              : // ===========================================================================
      35              : // class declarations
      36              : // ===========================================================================
      37              : class GUIGlChildWindow;
      38              : class GUIGlObjectStorage;
      39              : class GUIGlObject;
      40              : 
      41              : 
      42              : // ===========================================================================
      43              : // class definition
      44              : // ===========================================================================
      45              : /**
      46              :  * @class GUIDialog_ChooserAbstract
      47              :  * Instances of this class are windows that display the list of instances
      48              :  * from a given artifact like vehicles, edges or junctions and allow
      49              :  * one of their items
      50              :  */
      51              : class GUIDialog_ChooserAbstract : public FXMainWindow, public GUIPersistentWindowPos {
      52              :     // FOX-declarations
      53            0 :     FXDECLARE(GUIDialog_ChooserAbstract)
      54              : 
      55              : public:
      56              :     /** @brief Constructor
      57              :      * @param[in] windowsParent The calling view
      58              :      * @param[in] viewParent The calling view (netedit)
      59              :      * @param[in] icon The icon to use
      60              :      * @param[in] title The title to use
      61              :      * @param[in] glStorage The storage to retrieve ids from
      62              :      */
      63              :     GUIDialog_ChooserAbstract(GUIGlChildWindow* windowsParent, int messageId,
      64              :                               FXIcon* icon, const FXString& title, const std::vector<GUIGlID>& ids,
      65              :                               GUIGlObjectStorage& glStorage);
      66              : 
      67              :     /// @brief Destructor
      68              :     virtual ~GUIDialog_ChooserAbstract();
      69              : 
      70              :     /** @brief Returns the chosen (selected) object
      71              :      * @return The selected object
      72              :      */
      73              :     GUIGlObject* getObject() const;
      74              : 
      75              :     /// @name FOX-callbacks
      76              :     /// @{
      77              : 
      78              :     /// @brief Callback: The selected item shall be centered within the calling view
      79              :     long onCmdCenter(FXObject*, FXSelector, void*);
      80              : 
      81              :     /// @brief Callback: The selected vehicle shall be tracked within the calling view
      82              :     long onCmdTrack(FXObject*, FXSelector, void*);
      83              : 
      84              :     /// @brief Callback: The dialog shall be closed
      85              :     long onCmdClose(FXObject*, FXSelector, void*);
      86              : 
      87              :     /// @brief Callback: Something has been typed into the field
      88              :     long onChgText(FXObject*, FXSelector, void*);
      89              : 
      90              :     /// @brief Callback: Selects to current item if enter is pressed
      91              :     long onCmdText(FXObject*, FXSelector, void*);
      92              : 
      93              :     /// @brief Callback: Selects to current item if enter is pressed
      94              :     long onListKeyPress(FXObject*, FXSelector, void*);
      95              : 
      96              :     /// @brief Callback: Current list item has changed
      97              :     long onChgList(FXObject*, FXSelector, void*);
      98              : 
      99              :     /// @brief Callback: Current list item selection has changed
     100              :     long onChgListSel(FXObject*, FXSelector, void*);
     101              : 
     102              :     /// @brief Callback: Hides unselected items if pressed
     103              :     long onCmdFilter(FXObject*, FXSelector, void*);
     104              : 
     105              :     /// @brief Callback: Hides unmatched items if pressed
     106              :     long onCmdFilterSubstr(FXObject*, FXSelector, void*);
     107              : 
     108              :     /// @brief Callback: Toggle selection status of current object / list
     109              :     long onCmdToggleSelection(FXObject*, FXSelector, void*);
     110              :     long onCmdAddListSelection(FXObject*, FXSelector, void*);
     111              :     long onCmdClearListSelection(FXObject*, FXSelector, void*);
     112              : 
     113              :     /// @brief Callback: Toggle locator by name
     114              :     long onCmdLocateByName(FXObject*, FXSelector, void*);
     115              : 
     116              :     /// @brief Callback: Update list
     117              :     long onCmdUpdate(FXObject*, FXSelector, void*);
     118              :     /// @}
     119              : 
     120              :     /// @brief sets the focus after the window is created to work-around bug in libfox
     121              :     void show();
     122              : 
     123              :     int getMessageId() const {
     124            0 :         return myMessageId;
     125              :     }
     126              : 
     127              : protected:
     128              :     /// @brief fox need this
     129            0 :     FOX_CONSTRUCTOR(GUIDialog_ChooserAbstract)
     130              : 
     131              :     /// @brief toggle selection (handled differently in netedit)
     132              :     virtual void toggleSelection(int listIndex);
     133              : 
     134              :     /// @brief set selection (handled differently in netedit)
     135              :     virtual void select(int listIndex);
     136              : 
     137              :     /// @brief unset selection (handled differently in netedit)
     138              :     virtual void deselect(int listIndex);
     139              : 
     140              :     /// @brief filter ACs (needed in netedit)
     141              :     virtual void filterACs(const std::vector<GUIGlID>& GLIDs);
     142              : 
     143              :     /// update the list with the given ids
     144              :     void refreshList(const std::vector<GUIGlID>& ids);
     145              : 
     146              :     /// @brief retrieve name for the given object
     147              :     virtual std::string getObjectName(GUIGlObject* o) const;
     148              : 
     149              : private:
     150              :     /// @brief window parent
     151              :     GUIGlChildWindow* myWindowsParent;
     152              : 
     153              :     /// @brief the object type being chosen
     154              :     int myMessageId;
     155              : 
     156              :     /// @brief The list that holds the ids
     157              :     FXList* myList;
     158              : 
     159              :     /// @brief The button that triggers centering on the select object
     160              :     FXButton* myCenterButton;
     161              : 
     162              :     /// @brief The button that triggers tracking on the select vehicle
     163              :     FXButton* myTrackButton;
     164              : 
     165              :     /// @brief The chosen id
     166              :     GUIGlObject* mySelected;
     167              : 
     168              :     /// @brief The text field
     169              :     FXTextField* myTextEntry;
     170              : 
     171              :     /// @brief myList contains (void) pointers to elements of myIDs instead of the more volatile pointers to GUIGlObject
     172              :     std::set<GUIGlID> myIDs;
     173              : 
     174              :     /// @brief whether to locate by object name instead of id
     175              :     bool myLocateByName;
     176              : 
     177              :     /// @brief whether the list was filter by substring
     178              :     bool myHaveFilteredSubstring;
     179              : 
     180              :     /// @brief label for declaring list size
     181              :     FXLabel* myCountLabel;
     182              : 
     183              :     /// @brief Whether search is case sensitive
     184              :     FXCheckButton* myCaseSensitive;
     185              : 
     186              :     /// @brief Whether each change in the list should re-center the view
     187              :     FXCheckButton* myInstantCenter;
     188              : 
     189              : };
        

Generated by: LCOV version 2.0-1