Eclipse SUMO - Simulation of Urban MObility
MFXAddEditTypedTable.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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // missing_desc
16 /****************************************************************************/
17 #ifndef MFXAddEditTypedTable_h
18 #define MFXAddEditTypedTable_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MFXEditableTable.h"
27 #include <vector>
28 
29 enum CellType {
31  CT_REAL = 0,
32  CT_STRING = 1,
33  CT_INT = 2,
34  CT_BOOL = 3,
35  CT_ENUM = 4,
37 };
38 
39 
40 
41 class MFXAddEditTypedTable : public FXTable {
42  FXDECLARE(MFXAddEditTypedTable)
43 public:
44  MFXAddEditTypedTable(FXComposite* p, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = 0, FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0, FXint pl = DEFAULT_MARGIN, FXint pr = DEFAULT_MARGIN, FXint pt = DEFAULT_MARGIN, FXint pb = DEFAULT_MARGIN);
46 
47 public:
49  int pos;
50  double min;
51  double max;
52  double steps1;
53  double steps2;
54  double steps3;
55  std::string format;
56  };
57 
58  struct EditedTableItem {
59  FXTableItem* item;
60  int row;
61  int col;
62  bool updateOnly;
63  };
64 
65 
66  CellType getCellType(int pos) const;
67  void setCellType(int pos, CellType t);
68  void setNumberCellParams(int pos, double min, double max,
69  double steps1, double steps2, double steps3,
70  const std::string& format);
72  void setEnums(int pos, const std::vector<std::string>& params);
73  void addEnum(int pos, const std::string& e);
74  const std::vector<std::string>& getEnums(int pos) const;
75  /*
76  class FXTableItem_Int : public FXTableItem {
77  public:
78  FXTableItem_Int(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
79  ~FXTableItem_Int();
80  protected:
82  virtual FXWindow *getControlFor(FXTable* table);
83 
85  virtual void setFromControl(FXWindow *control);
86 
87  };
88 
89  class FXTableItem_Real : public FXTableItem {
90  public:
91  FXTableItem_Real(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
92  ~FXTableItem_Real();
93  protected:
95  virtual FXWindow *getControlFor(FXTable* table);
96 
98  virtual void setFromControl(FXWindow *control);
99 
100  };
101 
102  class FXTableItem_Enum : public FXTableItem {
103  public:
104  FXTableItem_Enum(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
105  ~FXTableItem_Enum();
106  protected:
108  virtual FXWindow *getControlFor(FXTable* table);
109 
111  virtual void setFromControl(FXWindow *control);
112 
113  };
114 
115  class FXTableItem_Bool : public FXTableItem {
116  public:
117  FXTableItem_Bool(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
118  ~FXTableItem_Bool();
119  protected:
121  virtual FXWindow *getControlFor(FXTable* table);
122 
124  virtual void setFromControl(FXWindow *control);
125 
126  };
127  */
128 
129  enum {
130  ID_TEXT_CHANGED = FXTable::ID_LAST,
132  };
133 
134  void cancelInput();
135  long onClicked(FXObject*, FXSelector, void* ptr);
136  long onDoubleClicked(FXObject*, FXSelector, void* ptr);
137  long onLeftBtnRelease(FXObject*, FXSelector, void* ptr);
138  long onLeftBtnPress(FXObject*, FXSelector, void* ptr);
139 
140 protected:
141  virtual FXWindow* getControlForItem(FXint r, FXint c);
142  virtual void setItemFromControl(FXint r, FXint c, FXWindow* control);
143  void acceptInput(FXbool notify);
144  void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow* control);
145 
146 protected:
147  std::vector<CellType> myCellTypes;
148  std::vector<NumberCellParams> myNumberCellParams;
149  std::vector<std::vector<std::string> > myEnums;
150 
151 protected:
153 
154 };
155 
156 
157 #endif
158 
159 /****************************************************************************/
160 
MFXAddEditTypedTable::addEnum
void addEnum(int pos, const std::string &e)
Definition: MFXAddEditTypedTable.cpp:603
MFXAddEditTypedTable::EditedTableItem::col
int col
Definition: MFXAddEditTypedTable.h:61
MFXAddEditTypedTable::acceptInput
void acceptInput(FXbool notify)
Definition: MFXAddEditTypedTable.cpp:284
MFXAddEditTypedTable::NumberCellParams::min
double min
Definition: MFXAddEditTypedTable.h:50
MFXAddEditTypedTable::setItemFromControl_NoRelease
void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow *control)
Definition: MFXAddEditTypedTable.cpp:364
MFXAddEditTypedTable::setCellType
void setCellType(int pos, CellType t)
Definition: MFXAddEditTypedTable.cpp:550
CT_BOOL
Definition: MFXAddEditTypedTable.h:34
CT_REAL
Definition: MFXAddEditTypedTable.h:31
MFXAddEditTypedTable::ID_LAST
Definition: MFXAddEditTypedTable.h:131
MFXAddEditTypedTable::getNumberCellParams
NumberCellParams getNumberCellParams(int pos) const
Definition: MFXAddEditTypedTable.cpp:581
MFXAddEditTypedTable::onDoubleClicked
long onDoubleClicked(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:522
MFXAddEditTypedTable::NumberCellParams::pos
int pos
Definition: MFXAddEditTypedTable.h:49
CT_UNDEFINED
Definition: MFXAddEditTypedTable.h:30
MFXAddEditTypedTable::setNumberCellParams
void setNumberCellParams(int pos, double min, double max, double steps1, double steps2, double steps3, const std::string &format)
Definition: MFXAddEditTypedTable.cpp:558
MFXAddEditTypedTable::EditedTableItem::item
FXTableItem * item
Definition: MFXAddEditTypedTable.h:59
MFXAddEditTypedTable::NumberCellParams
Definition: MFXAddEditTypedTable.h:48
MFXAddEditTypedTable::NumberCellParams::max
double max
Definition: MFXAddEditTypedTable.h:51
CT_ENUM
Definition: MFXAddEditTypedTable.h:35
MFXAddEditTypedTable::EditedTableItem::updateOnly
bool updateOnly
Definition: MFXAddEditTypedTable.h:62
MFXAddEditTypedTable::EditedTableItem::row
int row
Definition: MFXAddEditTypedTable.h:60
MFXAddEditTypedTable::ID_TEXT_CHANGED
Definition: MFXAddEditTypedTable.h:130
MFXAddEditTypedTable::~MFXAddEditTypedTable
~MFXAddEditTypedTable()
Definition: MFXAddEditTypedTable.cpp:50
MFXAddEditTypedTable::NumberCellParams::steps1
double steps1
Definition: MFXAddEditTypedTable.h:52
MFXAddEditTypedTable::getEnums
const std::vector< std::string > & getEnums(int pos) const
Definition: MFXAddEditTypedTable.cpp:613
MFXAddEditTypedTable::NumberCellParams::steps3
double steps3
Definition: MFXAddEditTypedTable.h:54
CellType
CellType
Definition: MFXAddEditTypedTable.h:29
MFXAddEditTypedTable::cancelInput
void cancelInput()
Definition: MFXAddEditTypedTable.cpp:271
CT_STRING
Definition: MFXAddEditTypedTable.h:32
MFXAddEditTypedTable::myEnums
std::vector< std::vector< std::string > > myEnums
Definition: MFXAddEditTypedTable.h:149
MFXAddEditTypedTable::onLeftBtnRelease
long onLeftBtnRelease(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:401
MFXAddEditTypedTable::setEnums
void setEnums(int pos, const std::vector< std::string > &params)
Definition: MFXAddEditTypedTable.cpp:593
MFXAddEditTypedTable::getControlForItem
virtual FXWindow * getControlForItem(FXint r, FXint c)
Definition: MFXAddEditTypedTable.cpp:191
MFXAddEditTypedTable::EditedTableItem
Definition: MFXAddEditTypedTable.h:58
CT_INT
Definition: MFXAddEditTypedTable.h:33
MFXAddEditTypedTable::NumberCellParams::format
std::string format
Definition: MFXAddEditTypedTable.h:55
MFXAddEditTypedTable::onClicked
long onClicked(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:502
MFXAddEditTypedTable
Definition: MFXAddEditTypedTable.h:41
MFXAddEditTypedTable::NumberCellParams::steps2
double steps2
Definition: MFXAddEditTypedTable.h:53
config.h
MFXAddEditTypedTable::myCellTypes
std::vector< CellType > myCellTypes
Definition: MFXAddEditTypedTable.h:147
MFXEditableTable.h
CT_MAX
Definition: MFXAddEditTypedTable.h:36
MFXAddEditTypedTable::MFXAddEditTypedTable
MFXAddEditTypedTable()
Definition: MFXAddEditTypedTable.h:152
MFXAddEditTypedTable::onLeftBtnPress
long onLeftBtnPress(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:441
MFXAddEditTypedTable::setItemFromControl
virtual void setItemFromControl(FXint r, FXint c, FXWindow *control)
Definition: MFXAddEditTypedTable.cpp:309
MFXAddEditTypedTable::getCellType
CellType getCellType(int pos) const
Definition: MFXAddEditTypedTable.cpp:541
MFXAddEditTypedTable::myNumberCellParams
std::vector< NumberCellParams > myNumberCellParams
Definition: MFXAddEditTypedTable.h:148