diff options
author | Antonio Fernandez <antonio.fernandez@aentos.es> | 2012-07-19 17:40:17 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-14 13:52:39 +0100 |
commit | a09c7f8e2b4d717bb488040ca096ee79c3e07609 (patch) | |
tree | 62e2f655db4f0e38b87576e5425088ed18a17acc /vcl/source | |
parent | 8dfd4a3a342dcd4ccc1cd8cdf874cf322422962f (diff) |
Added a "freeze" method to Menu. Menus are now displayed on console.
Change-Id: I71bfc2c0272154b9ff5c2dabe7508a98950e199c
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/menu.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index c272df3fa104..a759dfe03727 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -6039,4 +6039,37 @@ ImplMenuDelData::~ImplMenuDelData() const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this ); } +#include <iostream> +using namespace std; + +void printMenu( AbstractMenu* pMenu ) { + if ( pMenu ) { + sal_uInt16 itemCount = pMenu->GetItemCount(); + MenuItemList *items = ((Menu*)pMenu)->GetItemList(); + + for (int i=0; i < itemCount; i++) { + MenuItemData *itemData = items->GetDataFromPos(i); + sal_uInt16 itemId = pMenu->GetItemId(i); + + if (itemData->eType == MENUITEM_SEPARATOR) { + cout << "---------------" << endl; + } else { + rtl::OUString itemText = itemData->aText; + rtl::OUString cmdString = itemData->aCommandStr; + cout << "Item ID: " << itemId << " Text: " << itemText << " CMD: " << cmdString << endl; + + if (itemData->pSubMenu) { + cout << ">> SUBMENU <<" << endl; + printMenu( itemData->pSubMenu ); + } + } + } + } +} + +void Menu::Freeze() { + printMenu( this ); + cout << "============================================================" << endl; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |