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-2023 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 "MFXTextFieldIcon.h"
26#include "MFXListIcon.h"
27
28
30class MFXComboBoxIcon : public FXPacker {
32 FXDECLARE(MFXComboBoxIcon)
33
34public:
36 enum {
37 ID_LIST = FXPacker::ID_LAST,
40 };
41
43 MFXComboBoxIcon(FXComposite* p, FXint cols, const bool haveIcons, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = COMBOBOX_NORMAL, FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0, FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
44
46 virtual ~MFXComboBoxIcon();
47
49 virtual void create();
50
52 virtual void detach();
53
55 virtual void destroy();
56
58 virtual void enable();
59
61 virtual void disable();
62
64 virtual FXint getDefaultWidth();
65
67 virtual FXint getDefaultHeight();
68
70 virtual void layout();
71
73 FXbool isEditable() const;
74
76 void setEditable(FXbool edit = TRUE);
77
79 FXString getText() const;
80
82 void setNumColumns(FXint cols);
83
85 FXint getNumColumns() const;
86
88 void setJustify(FXuint mode);
89
91 FXuint getJustify() const;
92
94 FXint getNumItems() const;
95
97 FXint getNumVisible() const;
98
100 void setText(FXString text);
101
103 void setNumVisible(FXint nvis);
104
106 FXbool isItemCurrent(FXint index) const;
107
109 void setCurrentItem(FXint index, FXbool notify = FALSE);
110
112 FXint getCurrentItem() const;
113
115 FXString getItem(FXint index) const;
116
118 FXint setIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
119
121 FXint insertIconItem(FXint index, const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
122
124 FXint appendIconItem(const FXString& text, FXIcon* icon = nullptr, FXColor bgColor = FXRGB(255, 255, 255), void* ptr = nullptr);
125
127 bool setItem(const FXString& text, FXIcon* icon);
128
130 void setCustomText(const FXString text);
131
133 FXint prependItem(const FXString& text, void* ptr = NULL);
134
136 FXint moveItem(FXint newindex, FXint oldindex);
137
139 void removeItem(FXint index);
140
142 void clearItems();
143
154 FXint findItem(const FXString& text, FXint start = -1, FXuint flags = SEARCH_FORWARD | SEARCH_WRAP) const;
155
163 FXint findItemByData(const void* ptr, FXint start = -1, FXuint flags = SEARCH_FORWARD | SEARCH_WRAP) const;
164
166 FXString getItemText(FXint index) const;
167
169 void setItemData(FXint index, void* ptr) const;
170
172 void* getItemData(FXint index) const;
173
175 FXbool isPaneShown() const;
176
178 void sortItems();
179
181 void setFont(FXFont* fnt);
182
184 FXFont* getFont() const;
185
187 void setComboStyle(FXuint mode);
188
190 FXuint getComboStyle() const;
191
193 virtual void setBackColor(FXColor clr);
194
196 FXColor getBackColor() const;
197
199 void setTextColor(FXColor clr);
200
202 FXColor getTextColor() const;
203
205 void setSelBackColor(FXColor clr);
206
208 FXColor getSelBackColor() const;
209
211 void setSelTextColor(FXColor clr);
212
214 FXColor getSelTextColor() const;
215
217 FXListSortFunc getSortFunc() const;
218
220 void setSortFunc(FXListSortFunc func);
221
223 void setHelpText(const FXString& txt);
224
226 const FXString& getHelpText() const;
227
229 void setTipText(const FXString& txt);
230
232 const FXString& getTipText() const;
233
236 long onFocusUp(FXObject*, FXSelector, void*);
237 long onFocusDown(FXObject*, FXSelector, void*);
238 long onFocusSelf(FXObject*, FXSelector, void*);
239 long onMouseWheel(FXObject*, FXSelector, void*);
240 long onTextButton(FXObject*, FXSelector, void*);
241 long onTextChanged(FXObject*, FXSelector, void*);
242 long onTextCommand(FXObject*, FXSelector, void*);
243 long onListClicked(FXObject*, FXSelector, void*);
244 long onFwdToText(FXObject*, FXSelector, void*);
245 long onUpdFmText(FXObject*, FXSelector, void*);
247
248protected:
251
253 FXLabel* myIconLabel = nullptr;
254
257
259 FXMenuButton* myButton = nullptr;
260
262 MFXListIcon* myList = nullptr;
263
265 FXPopup* myPane = nullptr;
266
268 const bool myHaveIcons;
269
270private:
273
276};
ComboBox with icon.
FXbool isItemCurrent(FXint index) const
Return true if current item.
FXint findItemByData(const void *ptr, FXint start=-1, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
void setSelTextColor(FXColor clr)
Change selected text color.
FXint insertIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
Insert a new item at index.
virtual void layout()
Perform layout.
FXuint getJustify() const
Return text justification mode.
FXint getCurrentItem() const
Get the current item's index.
void setItemData(FXint index, void *ptr) const
Set data pointer for specified item.
virtual void destroy()
Destroy server-side resources.
FXint getNumVisible() const
Return the number of visible items.
FXuint getComboStyle() const
Get the combobox style.
FXint findItem(const FXString &text, FXint start=-1, FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const
long onTextChanged(FXObject *, FXSelector, void *)
const FXString & getHelpText() const
Get the combobox help text.
void removeItem(FXint index)
Remove this item from the list.
long onFwdToText(FXObject *, FXSelector, void *)
void setCurrentItem(FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint getNumItems() const
Return the number of items in the list.
const FXString & getTipText() const
Get the tool tip message for this combobox.
long onMouseWheel(FXObject *, FXSelector, void *)
virtual FXint getDefaultWidth()
Return default width.
FXbool isEditable() const
Return true if combobox is editable.
FXString getItemText(FXint index) const
Get text for specified item.
void * getItemData(FXint index) const
Get data pointer for specified item.
virtual void setBackColor(FXColor clr)
Set window background color.
long onListClicked(FXObject *, FXSelector, void *)
FXFont * getFont() const
Get text font.
void setHelpText(const FXString &txt)
Set the combobox help text.
FXLabel * myIconLabel
label for icon
FXMenuButton * myButton
myButton
MFXListIcon * myList
list
FXString getText() const
Get the text.
MFXComboBoxIcon & operator=(const MFXComboBoxIcon &)=delete
invalidate assignment operator
void setText(FXString text)
Set text.
MFXComboBoxIcon(const MFXComboBoxIcon &)
invalidate copy constructor
FXColor getSelBackColor() const
Return selected background color.
void setNumColumns(FXint cols)
Set the number of columns.
void setTextColor(FXColor clr)
Change text color.
FXPopup * myPane
popup
FXColor getSelTextColor() const
Return selected text color.
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
virtual ~MFXComboBoxIcon()
Destructor.
void clearItems()
Remove all items from the list.
void setSortFunc(FXListSortFunc func)
Change sort function.
virtual FXint getDefaultHeight()
Return default height.
FXString getItem(FXint index) const
Return the item at the given index.
long onTextButton(FXObject *, FXSelector, void *)
FXint prependItem(const FXString &text, void *ptr=NULL)
Prepend an item to the list.
void setTipText(const FXString &txt)
Set the tool tip message for this combobox.
void sortItems()
Sort items using current sort function.
FXbool isPaneShown() const
Is the pane shown.
FXint moveItem(FXint newindex, FXint oldindex)
Move item from oldindex to newindex.
virtual void disable()
Disable combo box.
FXColor getBackColor() const
Get background color.
void setSelBackColor(FXColor clr)
Change selected background color.
void setJustify(FXuint mode)
Change text justification mode; default is JUSTIFY_LEFT.
const bool myHaveIcons
check if this iconComboBox have icons
MFXComboBoxIcon()
FOX need this.
FXColor getTextColor() const
Return text color.
long onUpdFmText(FXObject *, FXSelector, void *)
FXint getNumColumns() const
Get the number of columns.
FXListSortFunc getSortFunc() const
Return sort function.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon
bool setItem(const FXString &text, FXIcon *icon)
set Item
virtual void enable()
Enable combo box.
MFXTextFieldIcon * myTextFieldIcon
textField with icon
void setComboStyle(FXuint mode)
Set the combobox style.
FXint setIconItem(FXint index, const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
Replace the item at index.
long onTextCommand(FXObject *, FXSelector, void *)
void setEditable(FXbool edit=TRUE)
Set editable state.
void setFont(FXFont *fnt)
Set text font.
virtual void detach()
Detach server-side resources.
virtual void create()
Create server-side resources.
long onFocusDown(FXObject *, FXSelector, void *)
long onFocusSelf(FXObject *, FXSelector, void *)
void setCustomText(const FXString text)
set custom text
long onFocusUp(FXObject *, FXSelector, void *)
Commands.
A list item which allows for custom coloring.
Definition MFXListIcon.h:28
FXTextFieldIcon (based on FXTextFieldIcon)