Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXComboBoxIcon.h
Go to the documentation of this file.
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/****************************************************************************/
19// ComboBox with search field and icons
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include "MFXListIcon.h"
25#include "MFXTextFieldSearch.h"
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
30
31class MFXComboBoxIcon : public FXPacker {
33 FXDECLARE(MFXComboBoxIcon)
34
35public:
37 enum {
38 ID_LIST = FXPacker::ID_LAST,
42 };
43
45 MFXComboBoxIcon(FXComposite* p, FXint cols, const bool canSearch,
46 const int visibleItems, FXObject* tgt, FXSelector sel = 0, FXuint opts = COMBOBOX_NORMAL,
47 FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
48 FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
49
52
54 void create();
55
57 void detach();
58
60 void destroy();
61
63 void enable();
64
66 void disable();
67
69 FXint getDefaultWidth();
70
72 FXint getDefaultHeight();
73
75 void layout();
76
78 FXString getText() const;
79
81 FXint getNumItems() const;
82
84 void setNumVisible(FXint nvis);
85
87 void setText(const FXString& text, FXbool notify = FALSE);
88
90 FXbool isItemCurrent(FXint index) const;
91
93 long setCurrentItem(const FXint index, FXbool notify = FALSE);
94
96 long setCurrentItem(const FXString& text, FXbool notify = FALSE);
97
99 FXint getCurrentItem() const;
100
102 FXint updateIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
103
105 FXint insertIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
106
108 FXint appendIconItem(const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
109
111 void removeItem(FXint index);
112
114 virtual void clearItems();
115
117 FXint findItem(const FXString& text) const;
118
120 std::string getItemText(FXint index) const;
121
123 void setBackColor(FXColor clr);
124
126 void setTextColor(FXColor clr);
127
129 FXColor getTextColor() const;
130
132 void setTipText(const FXString& txt);
133
135 const FXString& getTipText() const;
136
139
140 long onFocusUp(FXObject*, FXSelector, void*);
141 long onFocusDown(FXObject*, FXSelector, void*);
142 long onFocusSelf(FXObject*, FXSelector, void*);
143 long onMouseWheel(FXObject*, FXSelector, void*);
144 long onTextButton(FXObject*, FXSelector, void*);
145 long onTextChanged(FXObject*, FXSelector, void*);
146 long onTextCommand(FXObject*, FXSelector, void*);
147 long onListClicked(FXObject*, FXSelector, void*);
148 long onFwdToText(FXObject*, FXSelector, void*);
149 long onUpdFmText(FXObject*, FXSelector, void*);
150 long onCmdFilter(FXObject*, FXSelector, void*);
151
153
154protected:
157
160
162 FXMenuButton* myButton = nullptr;
163
165 MFXListIcon* myList = nullptr;
166
169
171 FXPopup* myPane = nullptr;
172
174 FXLabel* myNoItemsLabel = nullptr;
175
176private:
179
182};
FXbool isItemCurrent(FXint index) const
Return true if current item.
FXint insertIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
insert icon item in the given position
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
void layout()
Perform layout.
FXint getCurrentItem() const
Get the current item's index.
void destroy()
Destroy server-side resources.
FXint findItem(const FXString &text) const
find item
long onTextChanged(FXObject *, FXSelector, void *)
void removeItem(FXint index)
Remove this item from the list.
long onFwdToText(FXObject *, FXSelector, void *)
FXint getNumItems() const
Return the number of items in the list.
FXLabel * myNoItemsLabel
no items label
const FXString & getTipText() const
Get the tool tip message for this combobox.
MFXComboBoxIcon(const MFXComboBoxIcon &)=delete
invalidate copy constructor
long onMouseWheel(FXObject *, FXSelector, void *)
FXint getDefaultWidth()
Return default width.
MFXTextFieldSearch * myTextFieldSearch
text field search
void setBackColor(FXColor clr)
Set window background color.
long onListClicked(FXObject *, FXSelector, void *)
FXMenuButton * myButton
myButton
MFXListIcon * myList
list with all items
FXString getText() const
Get the text.
MFXComboBoxIcon & operator=(const MFXComboBoxIcon &)=delete
invalidate assignment operator
long onCmdFilter(FXObject *, FXSelector, void *)
void setTextColor(FXColor clr)
Change text color.
FXPopup * myPane
popup in which place search label and list
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
~MFXComboBoxIcon()
Destructor.
virtual void clearItems()
Remove all items from the list.
FXint updateIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
Replace the item at index.
FXint getDefaultHeight()
Return default height.
long onTextButton(FXObject *, FXSelector, void *)
void setTipText(const FXString &txt)
Set the tool tip message for this combobox.
std::string getItemText(FXint index) const
Get text for specified item.
void disable()
Disable combo box.
MFXComboBoxIcon()
FOX need this.
FXColor getTextColor() const
Return text color.
long onUpdFmText(FXObject *, FXSelector, void *)
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
void enable()
Enable combo box.
MFXTextFieldIcon * myTextFieldIcon
textField icon
long onTextCommand(FXObject *, FXSelector, void *)
void detach()
Detach server-side resources.
void create()
Create server-side resources.
long onFocusDown(FXObject *, FXSelector, void *)
long onFocusSelf(FXObject *, FXSelector, void *)
void setText(const FXString &text, FXbool notify=FALSE)
Set the text in the textField.
long onFocusUp(FXObject *, FXSelector, void *)
Commands.
A list item which allows for custom coloring.
Definition MFXListIcon.h:30
FXTextFieldIcon (based on FXTextFieldIcon)