MFXAddEditTypedTable.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MFXAddEditTypedTable_h
00020 #define MFXAddEditTypedTable_h
00021
00022
00023
00024
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> ¶ms);
00080 void addEnum(size_t pos, const std::string &e);
00081 const std::vector<std::string> &getEnums(size_t pos) const;
00082
00083
00084
00085
00086
00087
00089
00090
00092
00093
00094
00095
00096
00097
00098
00099
00100
00102
00103
00105
00106
00107
00108
00109
00110
00111
00112
00113
00115
00116
00118
00119
00120
00121
00122
00123
00124
00125
00126
00128
00129
00131
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