SUMO - Simulation of Urban MObility
MFXAddEditTypedTable.h
Go to the documentation of this file.
00001 /****************************************************************************/
00007 // missing_desc
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This file is part of SUMO.
00014 //   SUMO is free software: you can redistribute it and/or modify
00015 //   it under the terms of the GNU General Public License as published by
00016 //   the Free Software Foundation, either version 3 of the License, or
00017 //   (at your option) any later version.
00018 //
00019 /****************************************************************************/
00020 #ifndef MFXAddEditTypedTable_h
00021 #define MFXAddEditTypedTable_h
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 #include "MFXEditableTable.h"
00034 #include <vector>
00035 #include <utils/foxtools/FXRealSpinDial.h>
00036 
00037 enum CellType {
00038     CT_UNDEFINED = -1,
00039     CT_REAL = 0,
00040     CT_STRING = 1,
00041     CT_INT = 2,
00042     CT_BOOL = 3,
00043     CT_ENUM = 4,
00044     CT_MAX
00045 };
00046 
00047 
00048 
00049 class MFXAddEditTypedTable : public FXTable {
00050     FXDECLARE(MFXAddEditTypedTable)
00051 public:
00052     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);
00053     ~MFXAddEditTypedTable();
00054 
00055 public:
00056     struct NumberCellParams {
00057         int pos;
00058         double min;
00059         double max;
00060         double steps1;
00061         double steps2;
00062         double steps3;
00063         std::string format;
00064     };
00065 
00066     struct EditedTableItem {
00067         FXTableItem* item;
00068         int row;
00069         int col;
00070         bool updateOnly;
00071     };
00072 
00073 
00074     CellType getCellType(size_t pos) const;
00075     void setCellType(size_t pos, CellType t);
00076     void setNumberCellParams(size_t pos, double min, double max,
00077                              double steps1, double steps2, double steps3,
00078                              const std::string& format);
00079     NumberCellParams getNumberCellParams(size_t pos) const;
00080     void setEnums(size_t pos, const std::vector<std::string> &params);
00081     void addEnum(size_t pos, const std::string& e);
00082     const std::vector<std::string> &getEnums(size_t pos) const;
00083     /*
00084         class FXTableItem_Int : public FXTableItem {
00085         public:
00086             FXTableItem_Int(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
00087             ~FXTableItem_Int();
00088         protected:
00090             virtual FXWindow *getControlFor(FXTable* table);
00091 
00093             virtual void setFromControl(FXWindow *control);
00094 
00095         };
00096 
00097         class FXTableItem_Real : public FXTableItem {
00098         public:
00099             FXTableItem_Real(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
00100             ~FXTableItem_Real();
00101         protected:
00103             virtual FXWindow *getControlFor(FXTable* table);
00104 
00106             virtual void setFromControl(FXWindow *control);
00107 
00108         };
00109 
00110         class FXTableItem_Enum : public FXTableItem {
00111         public:
00112             FXTableItem_Enum(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
00113             ~FXTableItem_Enum();
00114         protected:
00116             virtual FXWindow *getControlFor(FXTable* table);
00117 
00119             virtual void setFromControl(FXWindow *control);
00120 
00121         };
00122 
00123         class FXTableItem_Bool : public FXTableItem {
00124         public:
00125             FXTableItem_Bool(const FXString& text,FXIcon* ic=NULL,void* ptr=NULL);
00126             ~FXTableItem_Bool();
00127         protected:
00129             virtual FXWindow *getControlFor(FXTable* table);
00130 
00132             virtual void setFromControl(FXWindow *control);
00133 
00134         };
00135     */
00136 
00137     enum {
00138         ID_TEXT_CHANGED = FXTable::ID_LAST,
00139         ID_LAST
00140     };
00141 
00142     void cancelInput();
00143     long onClicked(FXObject*, FXSelector, void* ptr);
00144     long onDoubleClicked(FXObject*, FXSelector, void* ptr);
00145     long onLeftBtnRelease(FXObject*, FXSelector, void* ptr);
00146     long onLeftBtnPress(FXObject*, FXSelector, void* ptr);
00147 
00148 protected:
00149     virtual FXWindow* getControlForItem(FXint r, FXint c);
00150     virtual void setItemFromControl(FXint r, FXint c, FXWindow* control);
00151     void acceptInput(FXbool notify);
00152     void setItemFromControl_NoRelease(FXint r, FXint c, FXWindow* control);
00153 
00154 protected:
00155     std::vector<CellType> myCellTypes;
00156     std::vector<NumberCellParams> myNumberCellParams;
00157     std::vector<std::vector<std::string> > myEnums;
00158 
00159 protected:
00160     MFXAddEditTypedTable() { }
00161 
00162 };
00163 
00164 
00165 #endif
00166 
00167 /****************************************************************************/
00168 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines