/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
// OImageButtonModel
OImageButtonModel::OImageButtonModel(const Reference<XComponentContext>& _rxFactory)
:OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_IMAGEBUTTON, FRM_SUN_CONTROL_IMAGEBUTTON ) // use the old control name for compatibility reasons
{
m_nClassId = FormComponentType::IMAGEBUTTON;
}
OImageButtonControl::OImageButtonControl(const Reference<XComponentContext>& _rxFactory)
:OClickableImageBaseControl(_rxFactory, VCL_CONTROL_IMAGEBUTTON)
{
osl_atomic_increment(&m_refCount);
{ // Register as MouseListener if (auto xComp = query_aggregation<awt::XWindow>(m_xAggregate))
xComp->addMouseListener( static_cast< awt::XMouseListener* >( this ) );
}
osl_atomic_decrement(&m_refCount);
}
// UNO Binding
Any SAL_CALL OImageButtonControl::queryAggregation(const Type& _rType)
{
Any aReturn = OClickableImageBaseControl::queryAggregation(_rType); if (!aReturn.hasValue())
aReturn = OImageButtonControl_BASE::queryInterface(_rType);
::osl::ClearableMutexGuard aGuard( m_aMutex ); if( m_aApproveActionListeners.getLength() )
{ // if there are listeners, start the action in an own thread, to not allow // them to block us here (we're in the application's main thread)
getImageProducerThread()->OComponentEventThread::addEvent( std::make_unique<awt::MouseEvent>(e) );
} else
{ // Or else don't; we must not notify the listeners in that case. // Even not if it's added later on.
aGuard.clear();
actionPerformed_Impl( false, e );
}
}
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 ist noch experimentell.