/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
SetPressed(false);
OUString aID = get_id(); // tdf#136678 take a copy if we are destroyed by Select callback if (mnCurItemId)
{
Select();
mnCurItemId = 0;
msCurItemIdent.clear();
}
collectUIInformation(aID,u"OPENLIST"_ustr,u""_ustr,u""_ustr);
}
void MenuButton::CancelMenu()
{ if (!mpMenu && !mpFloatingWindow) return;
if (mpMenu)
{
mpMenu->EndExecute();
} else
{ if (mpFloatingWindow->GetType() == WindowType::FLOATINGWINDOW) static_cast<FloatingWindow*>(mpFloatingWindow.get())->EndPopupMode(); else
vcl::Window::GetDockingManager()->EndPopupMode(mpFloatingWindow);
}
collectUIInformation(get_id(),u"CLOSELIST"_ustr,u""_ustr,u""_ustr);
}
bool MenuButton::InPopupMode() const
{ if (mbStartingMenu) returntrue;
if (!mpMenu && !mpFloatingWindow) returnfalse;
if (mpMenu) return PopupMenu::GetActivePopupMenu() == mpMenu; else
{ if (mpFloatingWindow->GetType() == WindowType::FLOATINGWINDOW) returnstatic_cast<const FloatingWindow*>(mpFloatingWindow.get())->IsInPopupMode(); else return vcl::Window::GetDockingManager()->IsInPopupMode(mpFloatingWindow);
}
}
IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl, Timer *, void)
{ // See if Button Tracking is still active, as it could've been cancelled earlier if ( IsTracking() )
{ if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
GrabFocus();
ExecuteMenu();
}
}
void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
{ bool bExecute = true; if (mbDelayMenu)
{ // If the separated dropdown symbol is not hit, delay the popup execution if( rMEvt.GetPosPixel().X() <= ImplGetSeparatorX() )
{ if ( !mpMenuTimer )
{
mpMenuTimer.reset(new Timer("MenuTimer"));
mpMenuTimer->SetInvokeHandler( LINK( this, MenuButton, ImplMenuTimeoutHdl ) );
}
if (mpMenu)
{ auto aMenuNode = rJsonWriter.startArray("menu"); for (int i = 0; i < mpMenu->GetItemCount(); i++)
{ auto aEntryNode = rJsonWriter.startStruct(); auto sId = mpMenu->GetItemId(i);
rJsonWriter.put("id", mpMenu->GetItemIdent(sId));
rJsonWriter.put("text", mpMenu->GetItemText(sId));
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.