NIREP
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 #pragma once 00014 00015 00016 /* +-----------+ 00017 | Libraries | 00018 +-----------+ */ 00019 #include "wx/wxprec.h" 00020 00021 #ifndef WX_PRECOMP 00022 #include "wx/wx.h" 00023 #endif 00024 00025 00026 #include <map> 00027 #include <string> 00028 #include <vector> 00029 00030 #include <iostream> 00031 #include <fstream> 00032 #include "../VariableList/VariableList.h" 00033 #include "./DisplayAttributes/DisplayAttributes.h" 00034 00035 using namespace std; 00036 00037 /* +---------+ 00038 | Classes | 00039 +---------+ */ 00055 class WidgetList { 00056 public: 00057 typedef std::vector< std::string> Type; 00058 typedef Type* Pointer; 00059 typedef Type::iterator Iterator; 00060 00061 00064 WidgetList(const std::string& fileName, VariableList* vList, DisplayAttributes *da); //Constructor 00065 00068 WidgetList(VariableList* vList, DisplayAttributes *da); //Constructor 00069 00072 ~WidgetList(); 00073 00076 bool Read(const std::string& fileName); //read in text description and populate the widget list 00077 00080 void Write(const std::string& fileName); //take the entries in the widget list and write them out to 00081 //a text file, make sure that you place "WidgetList" at the 00082 //beginning of the block of entries written out to file to 00083 //indicate that this is the WidgetList in the file. 00084 00087 std::string GetWidgetType(int row, int col); //this will return the type of widget at the row & col 00088 //specified 00089 00092 std::string GetWidgetType(std::string widgetName); 00093 00096 std::string GetWidgetType(int location); 00097 00098 void Resize(){ 00099 if(displayAttributes != NULL) { 00100 this->widget.resize(displayAttributes->GetColDimension()*displayAttributes->GetRowDimension()); 00101 } 00102 }; 00103 00104 void SetWidget(int row, int col, std::string widget) { 00105 this->widget[(row)*this->displayAttributes->GetColDimension()+col] = widget; 00106 }; 00109 void SetWidgetType(int row, int col, std::string type); //this will set the type of widget at row 00110 //and col 00111 00114 void SetWidgetType(std::string widgetName, std::string type); 00115 00118 std::vector<std::string> GetWidgetParameters (int row, int col); 00119 00122 std::vector<std::string> GetWidgetParameters (std::string widgetName); 00123 00126 std::vector<std::string> GetWidgetParameters(int location); 00127 00130 void SetWidgetParameters(int row, int col, std::vector<std::string>); 00131 00134 Pointer GetList() { return &widget; } //this returns the reference to widget 00135 00138 void SetVarList(VariableList* list); 00139 00142 void SetDisplayAttributes(DisplayAttributes* da); 00143 00144 bool AnyError(){return error;}; 00145 00148 std::string GetTitle(int row, int col); 00149 00152 int GetLocation(std::string line); 00153 00154 protected: 00157 WidgetList(){vars = NULL; displayAttributes = NULL; error = true;}; 00158 00159 private: 00160 Type widget; //Container of the widget list <widgetName, widgetDescription> 00161 VariableList* vars; // variable list 00162 DisplayAttributes *displayAttributes; 00163 bool error; 00164 };