Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXListIconItem.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/****************************************************************************/
18//
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "fxheader.h"
24
25// ===========================================================================
26// class declaration
27// ===========================================================================
28
29class MFXListIcon;
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
35class MFXListIconItem : public FXObject {
37 FXDECLARE(MFXListIconItem)
38
39
41
42public:
43 enum {
45 FOCUS = 2,
49 };
50
52 MFXListIconItem(const FXString& text, FXIcon* ic = NULL, FXColor backGroundColor = 0, void* ptr = NULL);
53
56
58 void setText(const FXString& txt);
59
61 const FXString& getText() const;
62
64 FXIcon* getIcon() const;
65
67 const FXColor& getBackGroundColor() const;
68
70 void setFocus(FXbool focus);
71
73 FXbool hasFocus() const;
74
76 void setSelected(FXbool selected);
77
79 FXbool isSelected() const;
80
82 void setEnabled(FXbool enabled);
83
85 FXbool isEnabled() const;
86
88 void setDraggable(FXbool draggable);
89
91 FXbool isDraggable() const;
92
94 FXint getWidth(const MFXListIcon* list) const;
95
97 FXint getHeight(const MFXListIcon* list) const;
98
100 void create();
101
103 void detach();
104
106 void destroy();
107
108protected:
111
113 void draw(const MFXListIcon* list, FXDC& dc, FXint x, FXint y, FXint w, FXint h);
114
116 FXint hitItem(const MFXListIcon* list, FXint x, FXint y) const;
117
119 FXString label;
120
122 FXIcon* icon = nullptr;
123
125 void* data = nullptr;
126
128 FXuint state = 0;
129
131 FXint x = 0;
132 FXint y = 0;
133
135 FXColor myBackGroundColor = 0;
136
138 bool show = true;
139
140private:
143
146};
A list item which allows for custom coloring.
Definition MFXListIcon.h:38
@ ICONOWNED
Draggable.
@ DRAGGABLE
Disabled.
FXbool isEnabled() const
Return true if this item is enabled.
void detach()
Detach server-side resources.
void setDraggable(FXbool draggable)
Make item draggable.
bool show
flag for show/hidde element
MFXListIconItem & operator=(const MFXListIconItem &)=delete
invalidate assign constructor
MFXListIconItem()
FOX need this.
FXint getHeight(const MFXListIcon *list) const
Return height of item as drawn in list.
friend class MFXListIcon
FOX declaration.
void setText(const FXString &txt)
Change item's text label.
FXString label
label
void create()
Create server-side resources.
void setSelected(FXbool selected)
Select item.
const FXString & getText() const
Return item's text label.
FXint getWidth(const MFXListIcon *list) const
Return width of item as drawn in list.
void setEnabled(FXbool enabled)
Enable or disable item.
FXIcon * getIcon() const
Return item's icon.
void destroy()
Destroy server-side resources.
FXIcon * icon
icon
FXint x
position
const FXColor & getBackGroundColor() const
get background color
FXbool hasFocus() const
Return true if item has focus.
FXColor myBackGroundColor
backGround color
~MFXListIconItem()
Destroy item and free icons if owned.
MFXListIconItem(const MFXListIconItem &)=delete
invalidate copy constructor
FXint hitItem(const MFXListIcon *list, FXint x, FXint y) const
hit item
FXbool isSelected() const
Return true if this item is selected.
MFXListIconItem(const FXString &text, FXIcon *ic=NULL, FXColor backGroundColor=0, void *ptr=NULL)
Construct new item with given text, icon, and user-data.
FXbool isDraggable() const
Return true if this item is draggable.
void setFocus(FXbool focus)
Make item draw as focused.
void draw(const MFXListIcon *list, FXDC &dc, FXint x, FXint y, FXint w, FXint h)
daraw
every row value