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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // missing_desc
18 /****************************************************************************/
19 #ifndef MFXAddEditTypedTable_h
20 #define MFXAddEditTypedTable_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "MFXEditableTable.h"
33 #include <vector>
35 
36 enum CellType {
38  CT_REAL = 0,
39  CT_STRING = 1,
40  CT_INT = 2,
41  CT_BOOL = 3,
42  CT_ENUM = 4,
44 };
45 
46 
47 
48 class MFXAddEditTypedTable : public FXTable {
49  FXDECLARE(MFXAddEditTypedTable)
50 public:
51  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);
53 
54 public:
56  int pos;
57  double min;
58  double max;
59  double steps1;
60  double steps2;
61  double steps3;
62  std::string format;
63  };
64 
65  struct EditedTableItem {
66  FXTableItem* item;
67  int row;
68  int col;
69  bool updateOnly;
70  };
71 
72 
73  CellType getCellType(int pos) const;
74  void setCellType(int pos, CellType t);
75  void setNumberCellParams(int pos, double min, double max,
76  double steps1, double steps2, double steps3,
77  const std::string& format);
79  void setEnums(int pos, const std::vector<std::string>& params);
80  void addEnum(int pos, const std::string& e);
81  const std::vector<std::string>& getEnums(int pos) const;
82  /*
83  class FXTableItem_Int : public FXTableItem {
84  public:
85  FXTableItem_Int(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
86  ~FXTableItem_Int();
87  protected:
89  virtual FXWindow *getControlFor(FXTable* table);
90 
92  virtual void setFromControl(FXWindow *control);
93 
94  };
95 
96  class FXTableItem_Real : public FXTableItem {
97  public:
98  FXTableItem_Real(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
99  ~FXTableItem_Real();
100  protected:
102  virtual FXWindow *getControlFor(FXTable* table);
103 
105  virtual void setFromControl(FXWindow *control);
106 
107  };
108 
109  class FXTableItem_Enum : public FXTableItem {
110  public:
111  FXTableItem_Enum(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
112  ~FXTableItem_Enum();
113  protected:
115  virtual FXWindow *getControlFor(FXTable* table);
116 
118  virtual void setFromControl(FXWindow *control);
119 
120  };
121 
122  class FXTableItem_Bool : public FXTableItem {
123  public:
124  FXTableItem_Bool(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
125  ~FXTableItem_Bool();
126  protected:
128  virtual FXWindow *getControlFor(FXTable* table);
129 
131  virtual void setFromControl(FXWindow *control);
132 
133  };
134  */
135 
136  enum {
137  ID_TEXT_CHANGED = FXTable::ID_LAST,
139  };
140 
141  void cancelInput();
142  long onClicked(FXObject*, FXSelector, void* ptr);
143  long onDoubleClicked(FXObject*, FXSelector, void* ptr);
144  long onLeftBtnRelease(FXObject*, FXSelector, void* ptr);
145  long onLeftBtnPress(FXObject*, FXSelector, void* ptr);
146 
147 protected:
148  virtual FXWindow* getControlForItem(FXint r, FXint c);
149  virtual void setItemFromControl(FXint r, FXint c, FXWindow* control);
150  void acceptInput(FXbool notify);
151  void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow* control);
152 
153 protected:
154  std::vector<CellType> myCellTypes;
155  std::vector<NumberCellParams> myNumberCellParams;
156  std::vector<std::vector<std::string> > myEnums;
157 
158 protected:
160 
161 };
162 
163 
164 #endif
165 
166 /****************************************************************************/
167 
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)