Eclipse SUMO - Simulation of Urban MObility
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-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 <vector>
25 
26 #include "fxheader.h"
27 
28 
29 class FXTreeItemDynamic : public FXTreeItem {
30 
31 public:
33  FXTreeItemDynamic(const FXString& text, FXIcon* oi = nullptr, FXIcon* ci = nullptr, void* ptr = nullptr);
34 
36  void setTextColor(FXColor clr);
37 
38 protected:
40  void draw(const FXTreeList* list, FXDC& dc, FXint xx, FXint yy, FXint, FXint hh) const;
41 
42 private:
44  FXColor myTextColor = FXRGB(0, 0, 0);
45 };
46 
48 class MFXTreeListDynamic : protected FXTreeList {
50  FXDECLARE(MFXTreeListDynamic)
51 
52 public:
54  MFXTreeListDynamic(FXComposite* p, FXObject* tgt, FXSelector sel, FXuint opts);
55 
57  void show();
58 
60  void hide();
61 
63  void update();
64 
66  void clearItems();
67 
69  FXint getNumItems();
70 
72  FXint getSelectedIndex();
73 
75  FXTreeItem* prependItem(FXTreeItem* father, const FXString& text, FXIcon* oi, FXColor tColor = FXRGB(0, 0, 0));
76 
78  FXTreeItem* appendItem(FXTreeItem* father, const FXString& text, FXIcon* oi, FXColor tColor = FXRGB(0, 0, 0));
79 
81  FXWindow* getFXWindow();
82 
84  FXTreeItem* getItemAt(FXint x, FXint y) const;
85 
87  FXTreeItemDynamic* getItem(FXint index) const;
88 
90  void resetSelectedItem();
91 
94  long onLeftBtnPress(FXObject*, FXSelector, void*);
96 
97 protected:
100 
102  std::vector<FXTreeItemDynamic*> myFXTreeItemDynamicItems;
103 
105  FXint mySelectedItem = -1;
106 
107 private:
110 
113 };
FXTreeItemDynamic(const FXString &text, FXIcon *oi=nullptr, FXIcon *ci=nullptr, void *ptr=nullptr)
Constructor.
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.
void show()
Show MFXTreeListDynamic.
std::vector< FXTreeItemDynamic * > myFXTreeItemDynamicItems
list with current FXTreeItemDynamic elements
void clearItems()
clear items
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
MFXTreeListDynamic & operator=(const MFXTreeListDynamic &)=delete
Invalidated assignment operator.
FXTreeItem * getItemAt(FXint x, FXint y) const
Get item at x,y, if any.
FXTreeItem * appendItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=FXRGB(0, 0, 0))
append item with given text and icon
FXint getSelectedIndex()
getSelected item index
FXTreeItemDynamic * getItem(FXint index) const
Get item.
FXTreeItem * prependItem(FXTreeItem *father, const FXString &text, FXIcon *oi, FXColor tColor=FXRGB(0, 0, 0))
prepend item with given text and icon