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 "fxheader.h"
25
26// ===========================================================================
27// class declaration
28// ===========================================================================
29
30class MFXListIcon;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
39class MFXComboBoxIcon : public FXPacker {
41 FXDECLARE(MFXComboBoxIcon)
42
43public:
45 enum {
46 ID_LIST = FXPacker::ID_LAST,
50 };
51
53 MFXComboBoxIcon(FXComposite* p, MFXStaticToolTip* staticToolTip, const bool canSearch,
54 const int visibleItems, FXObject* tgt, FXSelector sel, FXuint opts,
55 FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
56 FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
57
60
62 void create();
63
65 void detach();
66
68 void destroy();
69
71 void enable();
72
74 void disable();
75
77 FXint getDefaultWidth();
78
80 FXint getDefaultHeight();
81
83 void layout();
84
86 FXString getText() const;
87
89 FXint getNumItems() const;
90
92 void setNumVisible(FXint nvis);
93
95 void setText(const FXString& text, FXbool notify = FALSE);
96
98 FXbool isItemCurrent(FXint index) const;
99
101 long setCurrentItem(const FXint index, FXbool notify = FALSE);
102
104 long setCurrentItem(const FXString& text, FXbool notify = FALSE);
105
107 FXint getCurrentItem() const;
108
110 FXint updateIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
111
113 FXint insertIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
114
116 FXint appendIconItem(const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
117
119 void removeItem(FXint index);
120
122 virtual void clearItems();
123
125 FXint findItem(const FXString& text) const;
126
128 std::string getItemText(FXint index) const;
129
131 void setBackColor(FXColor clr);
132
134 void setTextColor(FXColor clr);
135
137 FXColor getTextColor() const;
138
140 void setTipText(const FXString& txt);
141
143 const FXString& getTipText() const;
144
147
148 long onFocusUp(FXObject*, FXSelector, void*);
149 long onFocusDown(FXObject*, FXSelector, void*);
150 long onFocusSelf(FXObject*, FXSelector, void*);
151 long onMouseWheel(FXObject*, FXSelector, void*);
152 long onTextButton(FXObject*, FXSelector, void*);
153 long onTextChanged(FXObject*, FXSelector, void*);
154 long onTextCommand(FXObject*, FXSelector, void*);
155 long onListClicked(FXObject*, FXSelector, void*);
156 long onFwdToText(FXObject*, FXSelector, void*);
157 long onUpdFmText(FXObject*, FXSelector, void*);
158 long onCmdFilter(FXObject*, FXSelector, void*);
159
161
162protected:
165
168
170 FXMenuButton* myButton = nullptr;
171
173 MFXListIcon* myList = nullptr;
174
177
179 FXPopup* myPane = nullptr;
180
182 FXLabel* myNoItemsLabel = nullptr;
183
184private:
187
190};
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:38
MFXStaticToolTip (based on FXToolTip)
FXTextFieldIcon (based on FXTextFieldIcon)