SUMO - Simulation of Urban MObility
MFXAddEditTypedTable.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // missing_desc
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef MFXAddEditTypedTable_h
21 #define MFXAddEditTypedTable_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "MFXEditableTable.h"
34 #include <vector>
36 
37 enum CellType {
39  CT_REAL = 0,
40  CT_STRING = 1,
41  CT_INT = 2,
42  CT_BOOL = 3,
43  CT_ENUM = 4,
45 };
46 
47 
48 
49 class MFXAddEditTypedTable : public FXTable {
50  FXDECLARE(MFXAddEditTypedTable)
51 public:
52  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);
54 
55 public:
57  int pos;
58  double min;
59  double max;
60  double steps1;
61  double steps2;
62  double steps3;
63  std::string format;
64  };
65 
66  struct EditedTableItem {
67  FXTableItem* item;
68  int row;
69  int col;
70  bool updateOnly;
71  };
72 
73 
74  CellType getCellType(int pos) const;
75  void setCellType(int pos, CellType t);
76  void setNumberCellParams(int pos, double min, double max,
77  double steps1, double steps2, double steps3,
78  const std::string& format);
80  void setEnums(int pos, const std::vector<std::string>& params);
81  void addEnum(int pos, const std::string& e);
82  const std::vector<std::string>& getEnums(int pos) const;
83  /*
84  class FXTableItem_Int : public FXTableItem {
85  public:
86  FXTableItem_Int(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
87  ~FXTableItem_Int();
88  protected:
90  virtual FXWindow *getControlFor(FXTable* table);
91 
93  virtual void setFromControl(FXWindow *control);
94 
95  };
96 
97  class FXTableItem_Real : public FXTableItem {
98  public:
99  FXTableItem_Real(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
100  ~FXTableItem_Real();
101  protected:
103  virtual FXWindow *getControlFor(FXTable* table);
104 
106  virtual void setFromControl(FXWindow *control);
107 
108  };
109 
110  class FXTableItem_Enum : public FXTableItem {
111  public:
112  FXTableItem_Enum(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
113  ~FXTableItem_Enum();
114  protected:
116  virtual FXWindow *getControlFor(FXTable* table);
117 
119  virtual void setFromControl(FXWindow *control);
120 
121  };
122 
123  class FXTableItem_Bool : public FXTableItem {
124  public:
125  FXTableItem_Bool(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
126  ~FXTableItem_Bool();
127  protected:
129  virtual FXWindow *getControlFor(FXTable* table);
130 
132  virtual void setFromControl(FXWindow *control);
133 
134  };
135  */
136 
137  enum {
138  ID_TEXT_CHANGED = FXTable::ID_LAST,
140  };
141 
142  void cancelInput();
143  long onClicked(FXObject*, FXSelector, void* ptr);
144  long onDoubleClicked(FXObject*, FXSelector, void* ptr);
145  long onLeftBtnRelease(FXObject*, FXSelector, void* ptr);
146  long onLeftBtnPress(FXObject*, FXSelector, void* ptr);
147 
148 protected:
149  virtual FXWindow* getControlForItem(FXint r, FXint c);
150  virtual void setItemFromControl(FXint r, FXint c, FXWindow* control);
151  void acceptInput(FXbool notify);
152  void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow* control);
153 
154 protected:
155  std::vector<CellType> myCellTypes;
156  std::vector<NumberCellParams> myNumberCellParams;
157  std::vector<std::vector<std::string> > myEnums;
158 
159 protected:
161 
162 };
163 
164 
165 #endif
166 
167 /****************************************************************************/
168 
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)
CellType getCellType(int pos) const
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)
long onClicked(FXObject *, FXSelector, void *ptr)
long onLeftBtnRelease(FXObject *, FXSelector, void *ptr)
const std::vector< std::string > & getEnums(int pos) const
long onLeftBtnPress(FXObject *, FXSelector, void *ptr)
NumberCellParams getNumberCellParams(int pos) const
void addEnum(int pos, const std::string &e)
virtual FXWindow * getControlForItem(FXint r, FXint c)
virtual void setItemFromControl(FXint r, FXint c, FXWindow *control)