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 /****************************************************************************/
14 // missing_desc
15 /****************************************************************************/
16 #ifndef MFXAddEditTypedTable_h
17 #define MFXAddEditTypedTable_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include "MFXEditableTable.h"
26 #include <vector>
27 
28 enum CellType {
30  CT_REAL = 0,
31  CT_STRING = 1,
32  CT_INT = 2,
33  CT_BOOL = 3,
34  CT_ENUM = 4,
36 };
37 
38 
39 
40 class MFXAddEditTypedTable : public FXTable {
41  FXDECLARE(MFXAddEditTypedTable)
42 public:
43  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);
45 
46 public:
48  int pos;
49  double min;
50  double max;
51  double steps1;
52  double steps2;
53  double steps3;
54  std::string format;
55  };
56 
57  struct EditedTableItem {
58  FXTableItem* item;
59  int row;
60  int col;
61  bool updateOnly;
62  };
63 
64 
65  CellType getCellType(int pos) const;
66  void setCellType(int pos, CellType t);
67  void setNumberCellParams(int pos, double min, double max,
68  double steps1, double steps2, double steps3,
69  const std::string& format);
71  void setEnums(int pos, const std::vector<std::string>& params);
72  void addEnum(int pos, const std::string& e);
73  const std::vector<std::string>& getEnums(int pos) const;
74  /*
75  class FXTableItem_Int : public FXTableItem {
76  public:
77  FXTableItem_Int(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
78  ~FXTableItem_Int();
79  protected:
81  virtual FXWindow *getControlFor(FXTable* table);
82 
84  virtual void setFromControl(FXWindow *control);
85 
86  };
87 
88  class FXTableItem_Real : public FXTableItem {
89  public:
90  FXTableItem_Real(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
91  ~FXTableItem_Real();
92  protected:
94  virtual FXWindow *getControlFor(FXTable* table);
95 
97  virtual void setFromControl(FXWindow *control);
98 
99  };
100 
101  class FXTableItem_Enum : public FXTableItem {
102  public:
103  FXTableItem_Enum(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
104  ~FXTableItem_Enum();
105  protected:
107  virtual FXWindow *getControlFor(FXTable* table);
108 
110  virtual void setFromControl(FXWindow *control);
111 
112  };
113 
114  class FXTableItem_Bool : public FXTableItem {
115  public:
116  FXTableItem_Bool(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
117  ~FXTableItem_Bool();
118  protected:
120  virtual FXWindow *getControlFor(FXTable* table);
121 
123  virtual void setFromControl(FXWindow *control);
124 
125  };
126  */
127 
128  enum {
129  ID_TEXT_CHANGED = FXTable::ID_LAST,
131  };
132 
133  void cancelInput();
134  long onClicked(FXObject*, FXSelector, void* ptr);
135  long onDoubleClicked(FXObject*, FXSelector, void* ptr);
136  long onLeftBtnRelease(FXObject*, FXSelector, void* ptr);
137  long onLeftBtnPress(FXObject*, FXSelector, void* ptr);
138 
139 protected:
140  virtual FXWindow* getControlForItem(FXint r, FXint c);
141  virtual void setItemFromControl(FXint r, FXint c, FXWindow* control);
142  void acceptInput(FXbool notify);
143  void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow* control);
144 
145 protected:
146  std::vector<CellType> myCellTypes;
147  std::vector<NumberCellParams> myNumberCellParams;
148  std::vector<std::vector<std::string> > myEnums;
149 
150 protected:
152 
153 };
154 
155 
156 #endif
157 
158 /****************************************************************************/
159 
MFXAddEditTypedTable::addEnum
void addEnum(int pos, const std::string &e)
Definition: MFXAddEditTypedTable.cpp:602
MFXAddEditTypedTable::EditedTableItem::col
int col
Definition: MFXAddEditTypedTable.h:60
MFXAddEditTypedTable::acceptInput
void acceptInput(FXbool notify)
Definition: MFXAddEditTypedTable.cpp:283
MFXAddEditTypedTable::NumberCellParams::min
double min
Definition: MFXAddEditTypedTable.h:49
MFXAddEditTypedTable::setItemFromControl_NoRelease
void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow *control)
Definition: MFXAddEditTypedTable.cpp:363
MFXAddEditTypedTable::setCellType
void setCellType(int pos, CellType t)
Definition: MFXAddEditTypedTable.cpp:549
CT_BOOL
Definition: MFXAddEditTypedTable.h:33
CT_REAL
Definition: MFXAddEditTypedTable.h:30
MFXAddEditTypedTable::ID_LAST
Definition: MFXAddEditTypedTable.h:130
MFXAddEditTypedTable::getNumberCellParams
NumberCellParams getNumberCellParams(int pos) const
Definition: MFXAddEditTypedTable.cpp:580
MFXAddEditTypedTable::onDoubleClicked
long onDoubleClicked(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:521
MFXAddEditTypedTable::NumberCellParams::pos
int pos
Definition: MFXAddEditTypedTable.h:48
CT_UNDEFINED
Definition: MFXAddEditTypedTable.h:29
MFXAddEditTypedTable::setNumberCellParams
void setNumberCellParams(int pos, double min, double max, double steps1, double steps2, double steps3, const std::string &format)
Definition: MFXAddEditTypedTable.cpp:557
MFXAddEditTypedTable::EditedTableItem::item
FXTableItem * item
Definition: MFXAddEditTypedTable.h:58
MFXAddEditTypedTable::NumberCellParams
Definition: MFXAddEditTypedTable.h:47
MFXAddEditTypedTable::NumberCellParams::max
double max
Definition: MFXAddEditTypedTable.h:50
CT_ENUM
Definition: MFXAddEditTypedTable.h:34
MFXAddEditTypedTable::EditedTableItem::updateOnly
bool updateOnly
Definition: MFXAddEditTypedTable.h:61
MFXAddEditTypedTable::EditedTableItem::row
int row
Definition: MFXAddEditTypedTable.h:59
MFXAddEditTypedTable::ID_TEXT_CHANGED
Definition: MFXAddEditTypedTable.h:129
MFXAddEditTypedTable::~MFXAddEditTypedTable
~MFXAddEditTypedTable()
Definition: MFXAddEditTypedTable.cpp:49
MFXAddEditTypedTable::NumberCellParams::steps1
double steps1
Definition: MFXAddEditTypedTable.h:51
MFXAddEditTypedTable::getEnums
const std::vector< std::string > & getEnums(int pos) const
Definition: MFXAddEditTypedTable.cpp:612
MFXAddEditTypedTable::NumberCellParams::steps3
double steps3
Definition: MFXAddEditTypedTable.h:53
CellType
CellType
Definition: MFXAddEditTypedTable.h:28
MFXAddEditTypedTable::cancelInput
void cancelInput()
Definition: MFXAddEditTypedTable.cpp:270
CT_STRING
Definition: MFXAddEditTypedTable.h:31
MFXAddEditTypedTable::myEnums
std::vector< std::vector< std::string > > myEnums
Definition: MFXAddEditTypedTable.h:148
MFXAddEditTypedTable::onLeftBtnRelease
long onLeftBtnRelease(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:400
MFXAddEditTypedTable::setEnums
void setEnums(int pos, const std::vector< std::string > &params)
Definition: MFXAddEditTypedTable.cpp:592
MFXAddEditTypedTable::getControlForItem
virtual FXWindow * getControlForItem(FXint r, FXint c)
Definition: MFXAddEditTypedTable.cpp:190
MFXAddEditTypedTable::EditedTableItem
Definition: MFXAddEditTypedTable.h:57
CT_INT
Definition: MFXAddEditTypedTable.h:32
MFXAddEditTypedTable::NumberCellParams::format
std::string format
Definition: MFXAddEditTypedTable.h:54
MFXAddEditTypedTable::onClicked
long onClicked(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:501
MFXAddEditTypedTable
Definition: MFXAddEditTypedTable.h:40
MFXAddEditTypedTable::NumberCellParams::steps2
double steps2
Definition: MFXAddEditTypedTable.h:52
config.h
MFXAddEditTypedTable::myCellTypes
std::vector< CellType > myCellTypes
Definition: MFXAddEditTypedTable.h:146
MFXEditableTable.h
CT_MAX
Definition: MFXAddEditTypedTable.h:35
MFXAddEditTypedTable::MFXAddEditTypedTable
MFXAddEditTypedTable()
Definition: MFXAddEditTypedTable.h:151
MFXAddEditTypedTable::onLeftBtnPress
long onLeftBtnPress(FXObject *, FXSelector, void *ptr)
Definition: MFXAddEditTypedTable.cpp:440
MFXAddEditTypedTable::setItemFromControl
virtual void setItemFromControl(FXint r, FXint c, FXWindow *control)
Definition: MFXAddEditTypedTable.cpp:308
MFXAddEditTypedTable::getCellType
CellType getCellType(int pos) const
Definition: MFXAddEditTypedTable.cpp:540
MFXAddEditTypedTable::myNumberCellParams
std::vector< NumberCellParams > myNumberCellParams
Definition: MFXAddEditTypedTable.h:147