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