Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "gui/auxiliary/old_markup.hpp"
00017
00018 namespace gui2 {
00019
00020 tlegacy_menu_item::tlegacy_menu_item(const std::string& str)
00021 : icon_(), label_(str), desc_(), default_(false)
00022 {
00023 if(label_.empty()) {
00024 return;
00025 }
00026
00027
00028 if(label_[0] == '*') {
00029 default_ = true;
00030 label_.erase(0, 1);
00031 }
00032
00033
00034 std::string::size_type pos = label_.find('=');
00035 if (pos != std::string::npos && (label_[0] == '&' || pos == 0)) {
00036 if (pos) icon_ = label_.substr(1, pos - 1);
00037 label_.erase(0, pos + 1);
00038 }
00039
00040
00041 std::string::size_type prev = 0;
00042 bool open = false;
00043 while ((pos = label_.find('=', prev)) != std::string::npos) {
00044 for (std::string::size_type i = prev; i != pos; ++i) {
00045 switch (label_[i]) {
00046 case '<': open = true; break;
00047 case '>': open = false; break;
00048 }
00049 }
00050 if (!open) break;
00051 prev = pos + 1;
00052 }
00053 if (pos != std::string::npos) {
00054 desc_ = label_.substr(pos + 1);
00055 label_.erase(pos);
00056 }
00057
00058 }
00059
00060 }
00061