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-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/****************************************************************************/
19//
20/****************************************************************************/
21
22#pragma once
23#include <config.h>
24
25#include "MFXListIcon.h"
26#include "MFXTextFieldSearch.h"
27
28
30class MFXComboBoxIcon : public FXPacker {
32 FXDECLARE(MFXComboBoxIcon)
33
34public:
36 enum {
37 ID_LIST = FXPacker::ID_LAST,
41 };
42
44 MFXComboBoxIcon(FXComposite* p, FXint cols, const bool canSearch,
45 const int visibleItems, FXObject* tgt, FXSelector sel = 0, FXuint opts = COMBOBOX_NORMAL,
46 FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
47 FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
48
51
53 void create();
54
56 void detach();
57
59 void destroy();
60
62 void enable();
63
65 void disable();
66
68 FXint getDefaultWidth();
69
71 FXint getDefaultHeight();
72
74 void layout();
75
77 FXString getText() const;
78
80 FXint getNumItems() const;
81
83 void setNumVisible(FXint nvis);
84
86 void setText(const FXString& text);
87
89 FXbool isItemCurrent(FXint index) const;
90
92 long setCurrentItem(const FXint index, FXbool notify = FALSE);
93
95 long setCurrentItem(const FXString& text, FXbool notify = FALSE);
96
98 FXint getCurrentItem() const;
99
101 FXint updateIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
102
104 FXint insertIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
105
107 FXint appendIconItem(const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
108
110 void removeItem(FXint index);
111
113 void clearItems();
114
116 FXint findItem(const FXString& text) const;
117
119 std::string getItemText(FXint index) const;
120
122 void setBackColor(FXColor clr);
123
125 void setTextColor(FXColor clr);
126
128 FXColor getTextColor() const;
129
131 void setTipText(const FXString& txt);
132
134 const FXString& getTipText() const;
135
138
139 long onFocusUp(FXObject*, FXSelector, void*);
140 long onFocusDown(FXObject*, FXSelector, void*);
141 long onFocusSelf(FXObject*, FXSelector, void*);
142 long onMouseWheel(FXObject*, FXSelector, void*);
143 long onTextButton(FXObject*, FXSelector, void*);
144 long onTextChanged(FXObject*, FXSelector, void*);
145 long onTextCommand(FXObject*, FXSelector, void*);
146 long onListClicked(FXObject*, FXSelector, void*);
147 long onFwdToText(FXObject*, FXSelector, void*);
148 long onUpdFmText(FXObject*, FXSelector, void*);
149 long onCmdFilter(FXObject*, FXSelector, void*);
150
152
153protected:
156
159
161 FXMenuButton* myButton = nullptr;
162
164 MFXListIcon* myList = nullptr;
165
168
170 FXPopup* myPane = nullptr;
171
173 FXLabel* myNoItemsLabel = nullptr;
174
175private:
178
181};
ComboBox with icon.
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.
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 *)
MFXComboBoxIcon(const MFXComboBoxIcon &)
invalidate copy constructor
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.
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 setText(const FXString &text)
Set the text in the textField.
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 *)
long onFocusUp(FXObject *, FXSelector, void *)
Commands.
A list item which allows for custom coloring.
Definition MFXListIcon.h:30
FXTextFieldIcon (based on FXTextFieldIcon)