41 #if !defined(GLS_MENUSET_H)
45 #pragma warning (disable:4786)
50 #include <FL/filename.H>
67 template <
class MenuType_t,
class DataFactory_t>
133 std::map<std::string, GlsMenuAction::ActionHandler_t*>::iterator iter;
140 delete actionHandler;
141 actionHandler = NULL;
168 const std::string& name,
194 virtual void Show(
const std::string& menuName =
"")
197 std::string::size_type start(menuName.find_first_not_of(
' '));
199 if (start == std::string::npos)
204 disti::AttributeName newMenuName(
206 _showMenuName : disti::DecodeString(menuName.substr(start)));
236 virtual void Read(std::istream& instr)
248 void Read(
const std::string& filename)
251 fstr.open(filename.c_str());
255 fprintf(stderr,
"Unable to open file: %s\n", filename.c_str());
274 const std::string& directory,
275 const std::string& ext =
"menu")
277 const std::string MENU_EXT(disti::Uppercase(ext));
280 std::string fileDir(directory);
281 disti::AppendTrailingSlash(fileDir);
283 fileCount = fl_filename_list(fileDir.c_str(), &flist);
287 for (
int fileNum = 0; fileNum < fileCount; ++fileNum)
289 std::string fileExt = disti::GetExtension(flist[fileNum]->d_name);
290 if( !fileExt.empty() )
292 fileExt = disti::Uppercase(fileExt);
294 if (fileExt == MENU_EXT)
296 std::string menuFile(fileDir + flist[fileNum]->d_name);
305 for (
int i = fileCount - 1; i >= 0; --i)
307 free((
void*)(flist[i]));
333 void Write(
const std::string& filename)
336 fstr.open(filename.c_str(), std::ios::out);
340 fprintf(stderr,
"Unable to open file: %s\n",filename);
345 fstr.setf(std::ios_base::fixed, std::ios::floatfield);
382 std::string menuName;
383 std::getline(args, menuName);
402 disti::AttributeName name(nameStr);
404 if (_menuData.ValueString(name) == val1)
405 _menuData.ValueString(name, val2);
407 _menuData.ValueString(name, val1);
425 _menuData.ValueString(
426 disti::AttributeName(name), val);
443 _menuData.ValueString(
444 disti::AttributeName(name), val);
465 _menuData.Get(disti::AttributeName(name)));
478 #endif // GLS_MENUSET_H
GlsStaticMemberFunctor_T< T > * GlsFunctor(T(*f)())
T * Item(const std::string &name) const