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

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6