Kaydet (Commit) 13917e07 authored tarafından Caolán McNamara's avatar Caolán McNamara

mark checkable toolbox menu entries as checkable

e.g. the toplevel toolbars put excess entries in
menus. If the entry is not marked as checkable then
a native gtk menu entry will appear to be stateless
when it actually does have a toggle state

Change-Id: I7168b44d59fd64dfe264ed8ca26355252d697251
üst 736f265c
......@@ -1790,6 +1790,20 @@ bool ToolBox::ImplHasClippedItems()
return false;
}
namespace
{
MenuItemBits ConvertBitsFromToolBoxToMenu(ToolBoxItemBits nToolItemBits)
{
MenuItemBits nMenuItemBits = MenuItemBits::NONE;
if ((nToolItemBits & ToolBoxItemBits::CHECKABLE) ||
(nToolItemBits & ToolBoxItemBits::DROPDOWN))
{
nMenuItemBits |= MenuItemBits::CHECKABLE;
}
return nMenuItemBits;
}
}
void ToolBox::UpdateCustomMenu()
{
// fill clipped items into menu
......@@ -1825,7 +1839,8 @@ void ToolBox::UpdateCustomMenu()
if( it->IsClipped() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString());
MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(it->mnBits);
pMenu->InsertItem( id, it->maText, it->maImageOriginal, nMenuItemBits, OString());
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem ( id, it->meState == TRISTATE_TRUE );
......@@ -1842,7 +1857,8 @@ void ToolBox::UpdateCustomMenu()
if( it->IsItemHidden() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString() );
MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(it->mnBits);
pMenu->InsertItem( id, it->maText, it->maImageOriginal, nMenuItemBits, OString() );
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem( id, it->meState == TRISTATE_TRUE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment