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 
std::vector< std::vector< std::string > > myEnums
void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow *control)
long onDoubleClicked(FXObject *, FXSelector, void *ptr)
void setEnums(int pos, const std::vector< std::string > &params)
std::vector< NumberCellParams > myNumberCellParams
std::vector< CellType > myCellTypes
void setNumberCellParams(int pos, double min, double max, double steps1, double steps2, double steps3, const std::string &format)
void acceptInput(FXbool notify)
void setCellType(int pos, CellType t)
CellType getCellType(int pos) const
long onClicked(FXObject *, FXSelector, void *ptr)
long onLeftBtnRelease(FXObject *, FXSelector, void *ptr)
const std::vector< std::string > & getEnums(int pos) const
NumberCellParams getNumberCellParams(int pos) const
long onLeftBtnPress(FXObject *, FXSelector, void *ptr)
void addEnum(int pos, const std::string &e)
virtual FXWindow * getControlForItem(FXint r, FXint c)
virtual void setItemFromControl(FXint r, FXint c, FXWindow *control)