vcl/source/window/menu.cxx | 68 +++++--------------------------------- vcl/unx/gtk/window/gtksalmenu.cxx | 24 ++++++++++--- 2 files changed, 27 insertions(+), 65 deletions(-)
New commits: commit 8af3f23b0632beec4147329877717d431c6942c0 Author: Antonio Fernandez <antonio.fernan...@aentos.es> Date: Mon Aug 13 22:19:30 2012 +0100 All menu labels are now displayed. There are some issues with repeated labels. Change-Id: I1b92b91f34003f20aaa56558c1c0e231d1de6f94 diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 3a14ca6..e921805 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -3244,6 +3244,15 @@ void Menu::HighlightItem( sal_uInt16 nItemPos ) } } +void Menu::Freeze() { + SalMenu *pSalMenu = ImplGetSalMenu(); + + if ( pSalMenu ) { + pSalMenu->Freeze(); + } +} + + // ----------- // - MenuBar - // ----------- @@ -6069,63 +6078,4 @@ 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; - //FIXME: This callback would introduce some noise in accessibility software. - itemData->pSubMenu->Activate(); - printMenu( itemData->pSubMenu ); - } - } - } - } -} - -void generateMenuHierarchy( 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); - - if (itemData->pSubMenu) { - itemData->pSubMenu->Activate(); - generateMenuHierarchy( itemData->pSubMenu ); - } - } - } -} - -void Menu::Freeze() { -// printMenu( this ); - generateMenuHierarchy( this ); -// cout << "============================================================" << endl; - - SalMenu *pSalMenu = ImplGetSalMenu(); - - if ( pSalMenu ) { - pSalMenu->Freeze(); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index c0a69c1..163564a 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -451,20 +451,32 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRe return TRUE; } +void updateNativeMenu( GtkSalMenu* pMenu ) { + if ( pMenu ) { + for (int i=0; i < pMenu->maItems.size(); i++) { + GtkSalMenuItem* pSalMenuItem = pMenu->maItems[ i ]; + String aText = pSalMenuItem->mpVCLMenu->GetItemText( pSalMenuItem->mnId ); + + // Force updating of native menu labels. + pMenu->SetItemText( i, pSalMenuItem, aText ); + + if ( pSalMenuItem->mpSubMenu && pSalMenuItem->mpSubMenu->mpVCLMenu ) { + pSalMenuItem->mpSubMenu->mpVCLMenu->Activate(); + updateNativeMenu( pSalMenuItem->mpSubMenu ); + } + } + } +} void GtkSalMenu::Freeze() { - cout << __FUNCTION__ << endl; - GLOActionGroup *mpActionGroup = g_lo_action_group_new(); + updateNativeMenu( this ); -// GMenuModel *pMenuModel = generateMenuModelAndActions( this, mpActionGroup ); + GLOActionGroup *mpActionGroup = g_lo_action_group_new(); generateActions( this, mpActionGroup ); -// this->publishMenu( mpMenuModel, G_ACTION_GROUP( mpActionGroup ) ); - // Menubar would have one section only. this->publishMenu( mpMenuModel, G_ACTION_GROUP( mpActionGroup ) ); -// g_object_unref( pMenuModel ); } // ======================================================================= _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits