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-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/****************************************************************************/
18//
19/****************************************************************************/
20
21#pragma once
22#include <config.h>
23
24#include "fxheader.h"
25
26// ===========================================================================
27// class declaration
28// ===========================================================================
29
30class MFXListIcon;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
36class MFXListIconItem : public FXObject {
38 FXDECLARE(MFXListIconItem)
39
40
42
43public:
44 enum {
46 FOCUS = 2,
49 ICONOWNED = 16
50 };
51
53 MFXListIconItem(const FXString& text, FXIcon* ic = NULL, FXColor backGroundColor = 0, void* ptr = NULL);
54
57
59 void setText(const FXString& txt);
60
62 const FXString& getText() const;
63
65 FXIcon* getIcon() const;
66
68 const FXColor& getBackGroundColor() const;
69
71 void setFocus(FXbool focus);
72
74 FXbool hasFocus() const;
75
77 void setSelected(FXbool selected);
78
80 FXbool isSelected() const;
81
83 void setEnabled(FXbool enabled);
84
86 FXbool isEnabled() const;
87
89 void setDraggable(FXbool draggable);
90
92 FXbool isDraggable() const;
93
95 FXint getWidth(const MFXListIcon* list) const;
96
98 FXint getHeight(const MFXListIcon* list) const;
99
101 void create();
102
104 void detach();
105
107 void destroy();
108
109protected:
112
114 void draw(const MFXListIcon* list, FXDC& dc, FXint x, FXint y, FXint w, FXint h);
115
117 FXint hitItem(const MFXListIcon* list, FXint x, FXint y) const;
118
120 FXString label;
121
123 FXIcon* icon = nullptr;
124
126 void* data = nullptr;
127
129 FXuint state = 0;
130
132 FXint x = 0;
133 FXint y = 0;
134
136 FXColor myBackGroundColor = 0;
137
139 bool show = true;
140
141private:
144
147};
A list item which allows for custom coloring.
Definition MFXListIcon.h:30
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.
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.
FXbool isDraggable() const
Return true if this item is draggable.
void setFocus(FXbool focus)
Make item draw as focused.
@ ICONOWNED
Draggable.
@ DRAGGABLE
Disabled.
void draw(const MFXListIcon *list, FXDC &dc, FXint x, FXint y, FXint w, FXint h)
daraw
every row value