Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXTreeListDynamic.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2004-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
21#pragma once
22#include <config.h>
23
24#include <vector>
26
27#include "fxheader.h"
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
32
33class FXTreeItemDynamic : public FXTreeItem {
34
35public:
37 FXTreeItemDynamic(const FXString& text, FXIcon* oi = nullptr, FXIcon* ci = nullptr, void* ptr = nullptr);
38
40 void setTextColor(FXColor clr);
41
42protected:
44 void draw(const FXTreeList* list, FXDC& dc, FXint xx, FXint yy, FXint, FXint hh) const;
45
46private:
49};
50
52class MFXTreeListDynamic : protected FXTreeList {
54 FXDECLARE(MFXTreeListDynamic)
55
56public:
58 MFXTreeListDynamic(FXComposite* p, FXObject* tgt, FXSelector sel, FXuint opts);
59
61 void show();
62
64 void hide();
65
67 void update();
68
70 void clearItems();
71
73 FXint getNumItems();
74
76 FXint getSelectedIndex();
77
79 FXTreeItem* prependItem(FXTreeItem* father, const FXString& text, FXIcon* oi, FXColor tColor = GUIDesignTextColorBlack);
80
82 FXTreeItem* appendItem(FXTreeItem* father, const FXString& text, FXIcon* oi, FXColor tColor = GUIDesignTextColorBlack);
83
85 FXWindow* getFXWindow();
86
88 FXTreeItem* getItemAt(FXint x, FXint y) const;
89
91 FXTreeItemDynamic* getItem(FXint index) const;
92
94 void resetSelectedItem();
95
98 long onLeftBtnPress(FXObject*, FXSelector, void*);
100
101protected:
104
106 std::vector<FXTreeItemDynamic*> myFXTreeItemDynamicItems;
107
109 FXint mySelectedItem = -1;
110
111private:
114
117};
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
FXColor myTextColor
set text color
void setTextColor(FXColor clr)
Change text color.
void draw(const FXTreeList *list, FXDC &dc, FXint xx, FXint yy, FXint, FXint hh) const
draw tree item
MFXTreeListDynamic.
FXTreeItem * prependItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=GUIDesignTextColorBlack)
prepend item with given text and icon
void show()
Show MFXTreeListDynamic.
std::vector< FXTreeItemDynamic * > myFXTreeItemDynamicItems
list with current FXTreeItemDynamic elements
void clearItems()
clear items
FXTreeItem * appendItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=GUIDesignTextColorBlack)
append item with given text and icon
FXint getNumItems()
get num items
FXint mySelectedItem
selected item
long onLeftBtnPress(FXObject *, FXSelector, void *)
void resetSelectedItem()
reset selected item
MFXTreeListDynamic(const MFXTreeListDynamic &)=delete
Invalidated copy constructor.
MFXTreeListDynamic()
default constructor
void hide()
Hide MFXTreeListDynamic.
FXWindow * getFXWindow()
get FXWindows associated with this MFXTreeListDynamic
FXTreeItem * getItemAt(FXint x, FXint y) const
Get item at x,y, if any.
MFXTreeListDynamic & operator=(const MFXTreeListDynamic &)=delete
Invalidated assignment operator.
FXint getSelectedIndex()
getSelected item index
FXTreeItemDynamic * getItem(FXint index) const
Get item.