source: branches/work_320/doc/menus/DocCharacterMenu.cpp @ 651

Revision 651, 2.1 KB checked in by jls17, 4 years ago (diff)
  • made the inner itemTable a member variable
Line 
1//Copyright (C) 2014 John Luthgers | jls17
2//
3//This file is part of ARInside.
4//
5//    ARInside is free software: you can redistribute it and/or modify
6//    it under the terms of the GNU General Public License as published by
7//    the Free Software Foundation, version 2 of the License.
8//
9//    ARInside is distributed in the hope that it will be useful,
10//    but WITHOUT ANY WARRANTY; without even the implied warranty of
11//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12//    GNU General Public License for more details.
13//
14//    You should have received a copy of the GNU General Public License
15//    along with ARInside.  If not, see <http://www.gnu.org/licenses/>.
16
17#include "stdafx.h"
18#include "DocCharacterMenu.h"
19#include "../../core/ARCharMenu.h"
20#include "../../core/AREnum.h"
21#include "../../output/Table.h"
22
23using namespace OUTPUT;
24
25CDocCharacterMenu::CDocCharacterMenu(CTable &table, CARCharMenu &menuObj)
26: outputTable(table), menu(menuObj), itemTable(new OUTPUT::CTable("menuItems", "TblObjectList"))
27{
28        itemTable->AddColumn(20, "Type");       
29        itemTable->AddColumn(40, "Label");
30        itemTable->AddColumn(40, "Value");
31}
32
33void CDocCharacterMenu::Documentation()
34{
35        try
36        {
37                const ARCharMenuList& menu = this->menu.GetDefinition().u.menuList;
38                for(unsigned int i=0; i< menu.numItems; i++)
39                {
40                        CTableRow row("cssStdRow");             
41                        CTableCell cellItemType(CAREnum::MenuItemType(menu.charMenuList[i].menuType), "");                             
42                        CTableCell cellItemLabel(menu.charMenuList[i].menuLabel, "");
43
44                        string mValue = "";
45                        if(menu.charMenuList[i].menuType == AR_MENU_TYPE_VALUE)
46                                mValue = menu.charMenuList[i]   .u.menuValue;
47                        CTableCell cellItemValue(mValue, "");
48
49                        row.AddCell(cellItemType);
50                        row.AddCell(cellItemLabel);
51                        row.AddCell(cellItemValue);
52                        itemTable->AddRow(row);         
53                }
54               
55                CTableRow row;
56                row.AddCell("Menu Definition");
57                row.AddCell(itemTable->ToXHtml());
58                outputTable.AddRow(row);
59        }
60        catch(exception& e)
61        {
62                cout << "EXCEPTION Menu details doc of '" << this->menu.GetName() << "': " << e.what() << endl;
63        }
64}
Note: See TracBrowser for help on using the repository browser.