Eclipse SUMO - Simulation of Urban MObility
FXTreeListDinamic.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-2022 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 FXTreeListDinamic : protected FXTreeList {
50  FXDECLARE(FXTreeListDinamic)
51 
52 public:
54  FXTreeListDinamic(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* insertItem(FXTreeItem* father, const FXString& text, FXIcon* oi);
76 
78  FXWindow* getFXWindow();
79 
81  FXTreeItem* getItemAt(FXint x,FXint y) const;
82 
84  FXTreeItemDynamic* getItem(FXint index) const;
85 
87  void resetSelectedItem();
88 
91  long onLeftBtnPress(FXObject*, FXSelector, void*);
93 
94 protected:
97 
99  std::vector<FXTreeItemDynamic*> myFXTreeItemDynamicItems;
100 
102  FXint mySelectedItem = -1;
103 
104 private:
106  FXTreeListDinamic(const FXTreeListDinamic&) = delete;
107 
110 };
FXTreeListDinamic::myFXTreeItemDynamicItems
std::vector< FXTreeItemDynamic * > myFXTreeItemDynamicItems
list with current FXTreeItemDynamic elements
Definition: FXTreeListDinamic.h:99
FXTreeListDinamic::getItem
FXTreeItemDynamic * getItem(FXint index) const
Get item.
Definition: FXTreeListDinamic.cpp:164
fxheader.h
FXTreeItemDynamic::setTextColor
void setTextColor(FXColor clr)
Change text color.
Definition: FXTreeListDinamic.cpp:51
FXTreeListDinamic::getFXWindow
FXWindow * getFXWindow()
get FXWindows associated with this FXTreeListDinamic
Definition: FXTreeListDinamic.cpp:152
FXTreeListDinamic::resetSelectedItem
void resetSelectedItem()
reset selected item
Definition: FXTreeListDinamic.cpp:170
FXTreeListDinamic::FXTreeListDinamic
FXTreeListDinamic()
default constructor
Definition: FXTreeListDinamic.cpp:194
FXTreeListDinamic::operator=
FXTreeListDinamic & operator=(const FXTreeListDinamic &)=delete
Invalidated assignment operator.
FXTreeListDinamic::show
void show()
Show FXTreeListDinamic.
Definition: FXTreeListDinamic.cpp:98
FXTreeListDinamic::getItemAt
FXTreeItem * getItemAt(FXint x, FXint y) const
Get item at x,y, if any.
Definition: FXTreeListDinamic.cpp:158
FXTreeListDinamic::update
void update()
update
Definition: FXTreeListDinamic.cpp:114
FXTreeListDinamic::getNumItems
FXint getNumItems()
get num items
Definition: FXTreeListDinamic.cpp:128
FXTreeItemDynamic::FXTreeItemDynamic
FXTreeItemDynamic(const FXString &text, FXIcon *oi=nullptr, FXIcon *ci=nullptr, void *ptr=nullptr)
Constructor.
Definition: FXTreeListDinamic.cpp:45
FXTreeListDinamic
FXTreeListDinamic.
Definition: FXTreeListDinamic.h:48
FXTreeListDinamic::clearItems
void clearItems()
clear items
Definition: FXTreeListDinamic.cpp:121
config.h
FXTreeListDinamic::insertItem
FXTreeItem * insertItem(FXTreeItem *father, const FXString &text, FXIcon *oi)
Insert item with given text and icon.
Definition: FXTreeListDinamic.cpp:140
FXTreeItemDynamic::myTextColor
FXColor myTextColor
set text color
Definition: FXTreeListDinamic.h:44
FXTreeListDinamic::onLeftBtnPress
long onLeftBtnPress(FXObject *, FXSelector, void *)
Definition: FXTreeListDinamic.cpp:179
FXTreeListDinamic::getSelectedIndex
FXint getSelectedIndex()
getSelected item index
Definition: FXTreeListDinamic.cpp:134
FXTreeItemDynamic::draw
void draw(const FXTreeList *list, FXDC &dc, FXint xx, FXint yy, FXint, FXint hh) const
draw tree item
Definition: FXTreeListDinamic.cpp:57
FXTreeListDinamic::hide
void hide()
Hide FXTreeListDinamic.
Definition: FXTreeListDinamic.cpp:107
FXTreeItemDynamic
Definition: FXTreeListDinamic.h:29
FXTreeListDinamic::mySelectedItem
FXint mySelectedItem
selected item
Definition: FXTreeListDinamic.h:102