/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2006-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 MFXComboBoxIcon.h14/// @author Jakob Erdmann15/// @author Pablo Alvarez Lopez16/// @date 2018-12-1917///18// ComboBox with search field and icons19/****************************************************************************/20#pragma once21#include <config.h>2223#include "fxheader.h"2425// ===========================================================================26// class declaration27// ===========================================================================2829class MFXListIcon;30class MFXStaticToolTip;31class MFXTextFieldIcon;32class MFXTextFieldSearch;3334// ===========================================================================35// class definitions36// ===========================================================================3738class MFXComboBoxIcon : public FXPacker {39/// @brief FOX declaration40FXDECLARE(MFXComboBoxIcon)4142public:43/// @brief enum for ID44enum {45ID_LIST = FXPacker::ID_LAST,46ID_TEXT,47ID_SEARCH,48ID_LAST49};5051/// @brief Construct a Combo Box widget with room to display cols columns of text52MFXComboBoxIcon(FXComposite* p, MFXStaticToolTip* staticToolTip, const bool canSearch,53const int visibleItems, FXObject* tgt, FXSelector sel, FXuint opts,54FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,55FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);5657/// @brief Destructor58~MFXComboBoxIcon();5960/// @brief Create server-side resources61void create();6263/// @brief Detach server-side resources64void detach();6566/// @brief Destroy server-side resources67void destroy();6869/// @brief Enable combo box70void enable();7172/// @brief Disable combo box73void disable();7475/// @brief Return default width76FXint getDefaultWidth();7778/// @brief Return default height79FXint getDefaultHeight();8081/// @brief Perform layout82void layout();8384/// @brief Get the text85FXString getText() const;8687/// @brief Return the number of items in the list88FXint getNumItems() const;8990/// @brief Set the number of visible items in the drop down list91void setNumVisible(FXint nvis);9293/// @brief Set the text in the textField94void setText(const FXString& text, FXbool notify = FALSE);9596/// @brief Return true if current item97FXbool isItemCurrent(FXint index) const;9899/// @brief Set the current item (index is zero-based)100long setCurrentItem(const FXint index, FXbool notify = FALSE);101102/// @brief Set the current item103long setCurrentItem(const FXString& text, FXbool notify = FALSE);104105/// @brief Get the current item's index106FXint getCurrentItem() const;107108/// @brief Replace the item at index109FXint updateIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);110111/// @brief insert icon item in the given position112FXint insertIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);113114/// @brief append icon item in the last position115FXint appendIconItem(const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);116117/// @brief Remove this item from the list118void removeItem(FXint index);119120/// @brief Remove all items from the list121virtual void clearItems();122123/// @brief find item124FXint findItem(const FXString& text) const;125126/// @brief Get text for specified item127std::string getItemText(FXint index) const;128129/// @brief Set window background color130void setBackColor(FXColor clr);131132/// @brief Change text color133void setTextColor(FXColor clr);134135/// @brief Return text color136FXColor getTextColor() const;137138/// @brief Set the tool tip message for this combobox139void setTipText(const FXString& txt);140141/// @brief Get the tool tip message for this combobox142const FXString& getTipText() const;143144/// @brief Commands145/// @{146147long onFocusUp(FXObject*, FXSelector, void*);148long onFocusDown(FXObject*, FXSelector, void*);149long onFocusSelf(FXObject*, FXSelector, void*);150long onMouseWheel(FXObject*, FXSelector, void*);151long onTextButton(FXObject*, FXSelector, void*);152long onTextChanged(FXObject*, FXSelector, void*);153long onTextCommand(FXObject*, FXSelector, void*);154long onListClicked(FXObject*, FXSelector, void*);155long onFwdToText(FXObject*, FXSelector, void*);156long onUpdFmText(FXObject*, FXSelector, void*);157long onCmdFilter(FXObject*, FXSelector, void*);158159/// @}160161protected:162/// @brief FOX need this163MFXComboBoxIcon();164165/// @brief textField icon166MFXTextFieldIcon* myTextFieldIcon = nullptr;167168/// @brief myButton169FXMenuButton* myButton = nullptr;170171/// @brief list with all items172MFXListIcon* myList = nullptr;173174/// @brief text field search175MFXTextFieldSearch* myTextFieldSearch = nullptr;176177/// @brief popup in which place search label and list178FXPopup* myPane = nullptr;179180/// @brief no items label181FXLabel* myNoItemsLabel = nullptr;182183private:184/// @brief invalidate copy constructor185MFXComboBoxIcon(const MFXComboBoxIcon&) = delete;186187/// @brief invalidate assignment operator188MFXComboBoxIcon& operator=(const MFXComboBoxIcon&) = delete;189};190191192