weld LicenseDialogImpl
Change-Id: I4b2dbd2446779e7179d2b79bf81cc2ff879377bf Reviewed-on: https://gerrit.libreoffice.org/68389 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -208,9 +208,9 @@ public:
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
|
||||
void UpdateBitmap();
|
||||
void ShowPosition( const Point& rPos, bool bUpdate );
|
||||
@@ -418,27 +418,30 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
|
||||
}
|
||||
}
|
||||
|
||||
void ColorFieldControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool ColorFieldControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
CaptureMouse();
|
||||
mbMouseCaptured = true;
|
||||
ShowPosition(rMEvt.GetPosPixel(), true);
|
||||
Modify();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorFieldControl::MouseMove(const MouseEvent& rMEvt)
|
||||
bool ColorFieldControl::MouseMove(const MouseEvent& rMEvt)
|
||||
{
|
||||
if (mbMouseCaptured)
|
||||
{
|
||||
ShowPosition(rMEvt.GetPosPixel(), true);
|
||||
Modify();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorFieldControl::MouseButtonUp(const MouseEvent&)
|
||||
bool ColorFieldControl::MouseButtonUp(const MouseEvent&)
|
||||
{
|
||||
ReleaseMouse();
|
||||
mbMouseCaptured = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorFieldControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
|
||||
@@ -507,9 +510,9 @@ public:
|
||||
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
|
||||
virtual void Resize() override;
|
||||
|
||||
@@ -641,25 +644,28 @@ void ColorSliderControl::ChangePosition(long nY)
|
||||
mdValue = double(nHeight - nY) / double(nHeight);
|
||||
}
|
||||
|
||||
void ColorSliderControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool ColorSliderControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
CaptureMouse();
|
||||
ChangePosition(rMEvt.GetPosPixel().Y());
|
||||
Modify();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorSliderControl::MouseMove(const MouseEvent& rMEvt)
|
||||
bool ColorSliderControl::MouseMove(const MouseEvent& rMEvt)
|
||||
{
|
||||
if (IsMouseCaptured())
|
||||
{
|
||||
ChangePosition(rMEvt.GetPosPixel().Y());
|
||||
Modify();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorSliderControl::MouseButtonUp(const MouseEvent&)
|
||||
bool ColorSliderControl::MouseButtonUp(const MouseEvent&)
|
||||
{
|
||||
ReleaseMouse();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColorSliderControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
|
||||
|
||||
@@ -396,7 +396,7 @@ Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, double
|
||||
return aRet;
|
||||
}
|
||||
|
||||
void EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
|
||||
bool EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
|
||||
{
|
||||
const RectPoint eOldRP = GetActualRP();
|
||||
|
||||
@@ -404,6 +404,8 @@ void EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
|
||||
|
||||
if( GetActualRP() != eOldRP )
|
||||
maModifyHdl.Call( nullptr );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmbossControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
|
||||
|
||||
@@ -157,7 +157,7 @@ class EmbossControl : public SvxRectCtl
|
||||
{
|
||||
private:
|
||||
Link<LinkParamNone*, void> maModifyHdl;
|
||||
virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rEvt ) override;
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
public:
|
||||
EmbossControl()
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <unotools/configmgr.hxx>
|
||||
#include <comphelper/unwrapargs.hxx>
|
||||
#include <i18nlangtag/mslangid.hxx>
|
||||
#include <vcl/event.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <toolkit/helper/vclunohelper.hxx>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
@@ -32,6 +33,7 @@
|
||||
#include <vcl/scrbar.hxx>
|
||||
#include <vcl/threadex.hxx>
|
||||
#include <vcl/builderfactory.hxx>
|
||||
#include <vcl/weld.hxx>
|
||||
|
||||
#include "license_dialog.hxx"
|
||||
|
||||
@@ -43,234 +45,161 @@ using namespace ::com::sun::star::uno;
|
||||
|
||||
namespace dp_gui {
|
||||
|
||||
class LicenseView : public MultiLineEdit, public SfxListener
|
||||
struct LicenseDialogImpl : public weld::GenericDialogController
|
||||
{
|
||||
bool mbEndReached;
|
||||
Link<LicenseView&,void> maEndReachedHdl;
|
||||
Link<LicenseView&,void> maScrolledHdl;
|
||||
bool m_bLicenseRead;
|
||||
Idle m_aResized;
|
||||
AutoTimer m_aRepeat;
|
||||
|
||||
public:
|
||||
LicenseView( vcl::Window* pParent, WinBits nStyle );
|
||||
virtual ~LicenseView() override;
|
||||
virtual void dispose() override;
|
||||
std::unique_ptr<weld::Label> m_xFtHead;
|
||||
std::unique_ptr<weld::Widget> m_xArrow1;
|
||||
std::unique_ptr<weld::Widget> m_xArrow2;
|
||||
std::unique_ptr<weld::TextView> m_xLicense;
|
||||
std::unique_ptr<weld::Button> m_xDown;
|
||||
std::unique_ptr<weld::Button> m_xAcceptButton;
|
||||
std::unique_ptr<weld::Button> m_xDeclineButton;
|
||||
|
||||
void ScrollDown( ScrollType eScroll );
|
||||
void PageDown();
|
||||
DECL_LINK(ScrollTimerHdl, Timer*, void);
|
||||
DECL_LINK(ScrolledHdl, weld::TextView&, void);
|
||||
DECL_LINK(ResizedHdl, Timer*, void);
|
||||
DECL_LINK(CancelHdl, weld::Button&, void);
|
||||
DECL_LINK(AcceptHdl, weld::Button&, void);
|
||||
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
|
||||
DECL_STATIC_LINK(LicenseDialogImpl, KeyReleaseHdl, const KeyEvent&, bool);
|
||||
DECL_LINK(MousePressHdl, const MouseEvent&, bool);
|
||||
DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
|
||||
DECL_LINK(SizeAllocHdl, const Size&, void);
|
||||
|
||||
LicenseDialogImpl(weld::Window * pParent,
|
||||
const OUString & sExtensionName,
|
||||
const OUString & sLicenseText);
|
||||
|
||||
bool IsEndReached() const;
|
||||
bool EndReached() const { return mbEndReached; }
|
||||
|
||||
void SetEndReachedHdl( const Link<LicenseView&,void>& rHdl ) { maEndReachedHdl = rHdl; }
|
||||
|
||||
void SetScrolledHdl( const Link<LicenseView&,void>& rHdl ) { maScrolledHdl = rHdl; }
|
||||
|
||||
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
|
||||
};
|
||||
|
||||
struct LicenseDialogImpl : public ModalDialog
|
||||
{
|
||||
VclPtr<FixedText> m_pFtHead;
|
||||
VclPtr<FixedImage> m_pArrow1;
|
||||
VclPtr<FixedImage> m_pArrow2;
|
||||
VclPtr<LicenseView> m_pLicense;
|
||||
VclPtr<PushButton> m_pDown;
|
||||
|
||||
VclPtr<PushButton> m_pAcceptButton;
|
||||
VclPtr<PushButton> m_pDeclineButton;
|
||||
|
||||
DECL_LINK(PageDownHdl, Button*, void);
|
||||
DECL_LINK(ScrolledHdl, LicenseView&, void);
|
||||
DECL_LINK(EndReachedHdl, LicenseView&, void);
|
||||
DECL_LINK(CancelHdl, Button*, void);
|
||||
DECL_LINK(AcceptHdl, Button*, void);
|
||||
|
||||
bool m_bLicenseRead;
|
||||
|
||||
LicenseDialogImpl(
|
||||
vcl::Window * pParent,
|
||||
const OUString & sExtensionName,
|
||||
const OUString & sLicenseText);
|
||||
virtual ~LicenseDialogImpl() override { disposeOnce(); }
|
||||
virtual void dispose() override;
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
};
|
||||
|
||||
void LicenseDialogImpl::dispose()
|
||||
{
|
||||
m_pFtHead.clear();
|
||||
m_pArrow1.clear();
|
||||
m_pArrow2.clear();
|
||||
m_pLicense.clear();
|
||||
m_pDown.clear();
|
||||
m_pAcceptButton.clear();
|
||||
m_pDeclineButton.clear();
|
||||
ModalDialog::dispose();
|
||||
}
|
||||
|
||||
|
||||
LicenseView::LicenseView( vcl::Window* pParent, WinBits nStyle )
|
||||
: MultiLineEdit( pParent, nStyle )
|
||||
{
|
||||
SetLeftMargin( 5 );
|
||||
mbEndReached = IsEndReached();
|
||||
StartListening( *GetTextEngine() );
|
||||
}
|
||||
|
||||
VCL_BUILDER_FACTORY_CONSTRUCTOR(LicenseView, WB_CLIPCHILDREN|WB_LEFT|WB_VSCROLL)
|
||||
|
||||
LicenseView::~LicenseView()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
void LicenseView::dispose()
|
||||
{
|
||||
maEndReachedHdl = Link<LicenseView&,void>();
|
||||
maScrolledHdl = Link<LicenseView&,void>();
|
||||
EndListeningAll();
|
||||
MultiLineEdit::dispose();
|
||||
}
|
||||
|
||||
void LicenseView::ScrollDown( ScrollType eScroll )
|
||||
{
|
||||
ScrollBar* pScroll = GetVScrollBar();
|
||||
if ( pScroll )
|
||||
pScroll->DoScrollAction( eScroll );
|
||||
}
|
||||
|
||||
bool LicenseView::IsEndReached() const
|
||||
{
|
||||
bool bEndReached;
|
||||
|
||||
TextView* pView = GetTextView();
|
||||
ExtTextEngine* pEdit = GetTextEngine();
|
||||
const long nHeight = pEdit->GetTextHeight();
|
||||
Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
|
||||
Point aBottom( 0, aOutSize.Height() );
|
||||
|
||||
bEndReached = pView->GetDocPos( aBottom ).Y() >= nHeight - 1;
|
||||
|
||||
return bEndReached;
|
||||
}
|
||||
|
||||
void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
||||
{
|
||||
const TextHint* pTextHint = dynamic_cast<const TextHint*>(&rHint);
|
||||
if ( pTextHint )
|
||||
{
|
||||
bool bLastVal = EndReached();
|
||||
const SfxHintId nId = pTextHint->GetId();
|
||||
|
||||
if ( nId == SfxHintId::TextParaInserted )
|
||||
{
|
||||
if ( bLastVal )
|
||||
mbEndReached = IsEndReached();
|
||||
}
|
||||
else if ( nId == SfxHintId::TextViewScrolled )
|
||||
{
|
||||
if ( ! mbEndReached )
|
||||
mbEndReached = IsEndReached();
|
||||
maScrolledHdl.Call( *this );
|
||||
}
|
||||
|
||||
if ( EndReached() && !bLastVal )
|
||||
{
|
||||
maEndReachedHdl.Call( *this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LicenseDialogImpl::LicenseDialogImpl(
|
||||
vcl::Window * pParent,
|
||||
weld::Window * pParent,
|
||||
const OUString & sExtensionName,
|
||||
const OUString & sLicenseText)
|
||||
: ModalDialog(pParent, "LicenseDialog", "desktop/ui/licensedialog.ui")
|
||||
: GenericDialogController(pParent, "desktop/ui/licensedialog.ui", "LicenseDialog")
|
||||
, m_bLicenseRead(false)
|
||||
, m_xFtHead(m_xBuilder->weld_label("head"))
|
||||
, m_xArrow1(m_xBuilder->weld_widget("arrow1"))
|
||||
, m_xArrow2(m_xBuilder->weld_widget("arrow2"))
|
||||
, m_xLicense(m_xBuilder->weld_text_view("textview"))
|
||||
, m_xDown(m_xBuilder->weld_button("down"))
|
||||
, m_xAcceptButton(m_xBuilder->weld_button("ok"))
|
||||
, m_xDeclineButton(m_xBuilder->weld_button("cancel"))
|
||||
{
|
||||
get(m_pFtHead, "head");
|
||||
get(m_pArrow1, "arrow1");
|
||||
get(m_pArrow2, "arrow2");
|
||||
get(m_pDown, "down");
|
||||
get(m_pAcceptButton, "accept");
|
||||
get(m_pDeclineButton, "decline");
|
||||
m_pArrow1->Show();
|
||||
m_pArrow2->Show(false);
|
||||
get(m_pLicense, "textview");
|
||||
m_xArrow1->show();
|
||||
m_xArrow2->hide();
|
||||
|
||||
Size aSize(m_pLicense->LogicToPixel(Size(290, 170), MapMode(MapUnit::MapAppFont)));
|
||||
m_pLicense->set_width_request(aSize.Width());
|
||||
m_pLicense->set_height_request(aSize.Height());
|
||||
m_xLicense->connect_size_allocate(LINK(this, LicenseDialogImpl, SizeAllocHdl));
|
||||
m_xLicense->set_size_request(m_xLicense->get_approximate_digit_width() * 72,
|
||||
m_xLicense->get_height_rows(21));
|
||||
|
||||
m_pLicense->SetText(sLicenseText);
|
||||
m_pFtHead->SetText(m_pFtHead->GetText() + "\n" + sExtensionName);
|
||||
m_xLicense->set_text(sLicenseText);
|
||||
m_xFtHead->set_label(m_xFtHead->get_label() + "\n" + sExtensionName);
|
||||
|
||||
m_pAcceptButton->SetClickHdl( LINK(this, LicenseDialogImpl, AcceptHdl) );
|
||||
m_pDeclineButton->SetClickHdl( LINK(this, LicenseDialogImpl, CancelHdl) );
|
||||
m_xAcceptButton->connect_clicked( LINK(this, LicenseDialogImpl, AcceptHdl) );
|
||||
m_xDeclineButton->connect_clicked( LINK(this, LicenseDialogImpl, CancelHdl) );
|
||||
|
||||
m_pLicense->SetEndReachedHdl( LINK(this, LicenseDialogImpl, EndReachedHdl) );
|
||||
m_pLicense->SetScrolledHdl( LINK(this, LicenseDialogImpl, ScrolledHdl) );
|
||||
m_pDown->SetClickHdl( LINK(this, LicenseDialogImpl, PageDownHdl) );
|
||||
m_xLicense->connect_vadjustment_changed(LINK(this, LicenseDialogImpl, ScrolledHdl));
|
||||
m_xDown->connect_mouse_press(LINK(this, LicenseDialogImpl, MousePressHdl));
|
||||
m_xDown->connect_mouse_release(LINK(this, LicenseDialogImpl, MouseReleaseHdl));
|
||||
m_xDown->connect_key_press(LINK(this, LicenseDialogImpl, KeyInputHdl));
|
||||
m_xDown->connect_key_release(LINK(this, LicenseDialogImpl, KeyReleaseHdl));
|
||||
|
||||
// We want a automatic repeating page down button
|
||||
WinBits aStyle = m_pDown->GetStyle();
|
||||
aStyle |= WB_REPEAT;
|
||||
m_pDown->SetStyle( aStyle );
|
||||
m_aRepeat.SetTimeout(Application::GetSettings().GetMouseSettings().GetButtonRepeat());
|
||||
m_aRepeat.SetInvokeHandler(LINK(this, LicenseDialogImpl, ScrollTimerHdl));
|
||||
|
||||
m_aResized.SetPriority(TaskPriority::LOWEST);
|
||||
m_aResized.SetInvokeHandler(LINK(this, LicenseDialogImpl, ResizedHdl));
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, AcceptHdl, Button*, void)
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, SizeAllocHdl, const Size&, void)
|
||||
{
|
||||
EndDialog(RET_OK);
|
||||
m_aResized.Start();
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, CancelHdl, Button*, void)
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, AcceptHdl, weld::Button&, void)
|
||||
{
|
||||
EndDialog();
|
||||
m_xDialog->response(RET_OK);
|
||||
}
|
||||
|
||||
void LicenseDialogImpl::Activate()
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, CancelHdl, weld::Button&, void)
|
||||
{
|
||||
if (!m_bLicenseRead)
|
||||
m_xDialog->response(RET_CANCEL);
|
||||
}
|
||||
|
||||
bool LicenseDialogImpl::IsEndReached() const
|
||||
{
|
||||
return m_xLicense->vadjustment_get_value() + m_xLicense->vadjustment_get_page_size() >= m_xLicense->vadjustment_get_upper();
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, ScrolledHdl, weld::TextView&, void)
|
||||
{
|
||||
if (IsEndReached())
|
||||
{
|
||||
//Only enable the scroll down button if the license text does not fit into the window
|
||||
if (m_pLicense->IsEndReached())
|
||||
m_xDown->set_sensitive(false);
|
||||
m_aRepeat.Stop();
|
||||
|
||||
if (!m_bLicenseRead)
|
||||
{
|
||||
m_pDown->Disable();
|
||||
m_pAcceptButton->Enable();
|
||||
m_pAcceptButton->GrabFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pDown->Enable();
|
||||
m_pDown->GrabFocus();
|
||||
m_pAcceptButton->Disable();
|
||||
m_xAcceptButton->set_sensitive(true);
|
||||
m_xAcceptButton->grab_focus();
|
||||
m_xArrow1->hide();
|
||||
m_xArrow2->show();
|
||||
m_bLicenseRead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, ScrolledHdl, LicenseView&, void)
|
||||
{
|
||||
if (m_pLicense->IsEndReached())
|
||||
m_pDown->Disable();
|
||||
else
|
||||
m_pDown->Enable();
|
||||
m_xDown->set_sensitive(true);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, PageDownHdl, Button*, void)
|
||||
void LicenseDialogImpl::PageDown()
|
||||
{
|
||||
m_pLicense->ScrollDown( ScrollType::PageDown );
|
||||
m_xLicense->vadjustment_set_value(m_xLicense->vadjustment_get_value() +
|
||||
m_xLicense->vadjustment_get_page_size());
|
||||
ScrolledHdl(*m_xLicense);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, EndReachedHdl, LicenseView&, void)
|
||||
IMPL_LINK(LicenseDialogImpl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
{
|
||||
m_pAcceptButton->Enable();
|
||||
m_pAcceptButton->GrabFocus();
|
||||
m_pArrow1->Show(false);
|
||||
m_pArrow2->Show();
|
||||
m_bLicenseRead = true;
|
||||
vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
|
||||
if (aKeyCode.GetCode() == KEY_RETURN || aKeyCode.GetCode() == KEY_SPACE)
|
||||
PageDown();
|
||||
return false;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, ResizedHdl, Timer*, void)
|
||||
{
|
||||
ScrolledHdl(*m_xLicense);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, ScrollTimerHdl, Timer*, void)
|
||||
{
|
||||
PageDown();
|
||||
}
|
||||
|
||||
IMPL_STATIC_LINK_NOARG(LicenseDialogImpl, KeyReleaseHdl, const KeyEvent&, bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, MousePressHdl, const MouseEvent&, bool)
|
||||
{
|
||||
PageDown();
|
||||
m_aRepeat.Start();
|
||||
return false;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(LicenseDialogImpl, MouseReleaseHdl, const MouseEvent&, bool)
|
||||
{
|
||||
m_aRepeat.Stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
LicenseDialog::LicenseDialog( Sequence<Any> const& args,
|
||||
Reference<XComponentContext> const& )
|
||||
@@ -282,10 +211,8 @@ LicenseDialog::LicenseDialog( Sequence<Any> const& args,
|
||||
|
||||
void LicenseDialog::setTitle( OUString const & )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
sal_Int16 LicenseDialog::execute()
|
||||
{
|
||||
return vcl::solarthread::syncExecute(
|
||||
@@ -294,10 +221,8 @@ sal_Int16 LicenseDialog::execute()
|
||||
|
||||
sal_Int16 LicenseDialog::solar_execute()
|
||||
{
|
||||
ScopedVclPtrInstance<LicenseDialogImpl> dlg(
|
||||
VCLUnoHelper::GetWindow(m_parent), m_sExtensionName, m_sLicenseText);
|
||||
|
||||
return dlg->Execute();
|
||||
LicenseDialogImpl dlg(Application::GetFrameWeld(m_parent), m_sExtensionName, m_sLicenseText);
|
||||
return dlg.run();
|
||||
}
|
||||
|
||||
} // namespace dp_gui
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface domain="dkt">
|
||||
<requires lib="gtk+" version="3.18"/>
|
||||
<requires lib="LibreOffice" version="1.0"/>
|
||||
<object class="GtkDialog" id="LicenseDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes" context="licensedialog|LicenseDialog">Extension Software License Agreement</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
@@ -17,7 +20,7 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="accept">
|
||||
<object class="GtkButton" id="ok">
|
||||
<property name="label" translatable="yes" context="licensedialog|accept">Accept</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
@@ -32,7 +35,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="decline">
|
||||
<object class="GtkButton" id="cancel">
|
||||
<property name="label" translatable="yes" context="licensedialog|decline">Decline</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
@@ -63,14 +66,12 @@
|
||||
<object class="GtkLabel" id="head">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes" context="licensedialog|head">Please follow these steps to proceed with the installation of the extension:</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -86,14 +87,12 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes" context="licensedialog|label2">1.</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -101,14 +100,12 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes" context="licensedialog|label3">2.</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -116,13 +113,11 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="pixbuf">res/sc06300.png</property>
|
||||
<property name="icon_name">res/sc06300.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -130,13 +125,11 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="pixbuf">res/sc06300.png</property>
|
||||
<property name="icon_name">res/sc06300.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -145,16 +138,15 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes" context="licensedialog|label4">Read the complete License Agreement. Use the scroll bar or the 'Scroll Down' button in this dialog to view the entire license text.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="width_chars">55</property>
|
||||
<property name="max_width_chars">55</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -163,16 +155,15 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes" context="licensedialog|label5">Accept the License Agreement for the extension by pressing the 'Accept' button.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="width_chars">55</property>
|
||||
<property name="max_width_chars">55</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -181,13 +172,13 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -195,23 +186,28 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="deploymentgui-LicenseView" id="textview:border">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="editable">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@@ -224,8 +220,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">accept</action-widget>
|
||||
<action-widget response="0">decline</action-widget>
|
||||
<action-widget response="-5">ok</action-widget>
|
||||
<action-widget response="-6">cancel</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -172,9 +172,6 @@
|
||||
<glade-widget-class title="Cui Custom MultiLine Edit" name="cuilo-CuiCustomMultilineEdit"
|
||||
generic-name="CuiCustomMultiLineEdit" parent="GtkTextView"
|
||||
icon-name="widget-gtk-textview"/>
|
||||
<glade-widget-class title="LicenseView" name="deploymentgui-LicenseView"
|
||||
generic-name="LicenseView" parent="GtkTextView"
|
||||
icon-name="widget-gtk-textview"/>
|
||||
<glade-widget-class title="SvtValueSet" name="svtlo-ValueSet"
|
||||
generic-name="Set of Value Options" parent="GtkDrawingArea"
|
||||
icon-name="widget-gtk-drawingarea"/>
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent&) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent&) override;
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
virtual bool KeyInput(const KeyEvent&) override;
|
||||
|
||||
@@ -478,8 +478,8 @@ public:
|
||||
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual void MouseMove( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseMove( const MouseEvent& rMEvt ) override;
|
||||
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void GetFocus() override;
|
||||
|
||||
@@ -112,9 +112,9 @@ private:
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseMove(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
virtual bool KeyInput(const KeyEvent&) override;
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
|
||||
void SetAttributes( const SfxItemSet& rInAttrs );
|
||||
sal_uInt16 GetLineDeltaCount();
|
||||
|
||||
@@ -149,9 +149,9 @@ public:
|
||||
|
||||
virtual void StyleUpdated() override;
|
||||
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual void MouseMove( const MouseEvent& rMEvt ) override;
|
||||
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseMove( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
|
||||
virtual bool KeyInput(const KeyEvent& rKEvt) override;
|
||||
virtual void LoseFocus() override;
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent&) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent&) override;
|
||||
virtual bool KeyInput(const KeyEvent&) override;
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual void Resize() override;
|
||||
virtual tools::Rectangle GetFocusRect() override;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void Resize() override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
|
||||
void SetAttributes(const SfxItemSet& rInAttrs);
|
||||
};
|
||||
|
||||
@@ -27,9 +27,9 @@ public:
|
||||
}
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) = 0;
|
||||
virtual void Resize() {}
|
||||
virtual void MouseButtonDown(const MouseEvent&) {}
|
||||
virtual void MouseMove(const MouseEvent&) {}
|
||||
virtual void MouseButtonUp(const MouseEvent&) {}
|
||||
virtual bool MouseButtonDown(const MouseEvent&) { return false; }
|
||||
virtual bool MouseMove(const MouseEvent&) { return false; }
|
||||
virtual bool MouseButtonUp(const MouseEvent&) { return false; }
|
||||
virtual void GetFocus() {}
|
||||
virtual void LoseFocus() {}
|
||||
virtual void StyleUpdated() { Invalidate(); }
|
||||
@@ -94,9 +94,9 @@ private:
|
||||
|
||||
DECL_LINK(DoResize, const Size& rSize, void);
|
||||
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
|
||||
DECL_LINK(DoMouseButtonDown, const MouseEvent&, void);
|
||||
DECL_LINK(DoMouseMove, const MouseEvent&, void);
|
||||
DECL_LINK(DoMouseButtonUp, const MouseEvent&, void);
|
||||
DECL_LINK(DoMouseButtonDown, const MouseEvent&, bool);
|
||||
DECL_LINK(DoMouseMove, const MouseEvent&, bool);
|
||||
DECL_LINK(DoMouseButtonUp, const MouseEvent&, bool);
|
||||
DECL_LINK(DoGetFocus, weld::Widget&, void);
|
||||
DECL_LINK(DoLoseFocus, weld::Widget&, void);
|
||||
DECL_LINK(DoKeyPress, const KeyEvent&, bool);
|
||||
|
||||
+12
-9
@@ -614,9 +614,9 @@ private:
|
||||
void* m_pUserData;
|
||||
Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl;
|
||||
Link<const Size&, void> m_aResizeHdl;
|
||||
Link<const MouseEvent&, void> m_aMousePressHdl;
|
||||
Link<const MouseEvent&, void> m_aMouseMotionHdl;
|
||||
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
|
||||
Link<const MouseEvent&, bool> m_aMousePressHdl;
|
||||
Link<const MouseEvent&, bool> m_aMouseMotionHdl;
|
||||
Link<const MouseEvent&, bool> m_aMouseReleaseHdl;
|
||||
Link<const KeyEvent&, bool> m_aKeyPressHdl;
|
||||
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
|
||||
Link<VclDrawingArea&, void> m_aStyleUpdatedHdl;
|
||||
@@ -633,15 +633,18 @@ private:
|
||||
}
|
||||
virtual void MouseMove(const MouseEvent& rMEvt) override
|
||||
{
|
||||
m_aMouseMotionHdl.Call(rMEvt);
|
||||
if (!m_aMouseMotionHdl.Call(rMEvt))
|
||||
Control::MouseMove(rMEvt);
|
||||
}
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override
|
||||
{
|
||||
m_aMousePressHdl.Call(rMEvt);
|
||||
if (!m_aMousePressHdl.Call(rMEvt))
|
||||
Control::MouseButtonDown(rMEvt);
|
||||
}
|
||||
virtual void MouseButtonUp(const MouseEvent& rMEvt) override
|
||||
{
|
||||
m_aMouseReleaseHdl.Call(rMEvt);
|
||||
if (!m_aMouseReleaseHdl.Call(rMEvt))
|
||||
Control::MouseButtonUp(rMEvt);
|
||||
}
|
||||
virtual void KeyInput(const KeyEvent& rKEvt) override
|
||||
{
|
||||
@@ -728,15 +731,15 @@ public:
|
||||
{
|
||||
m_aResizeHdl = rLink;
|
||||
}
|
||||
void SetMousePressHdl(const Link<const MouseEvent&, void>& rLink)
|
||||
void SetMousePressHdl(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
m_aMousePressHdl = rLink;
|
||||
}
|
||||
void SetMouseMoveHdl(const Link<const MouseEvent&, void>& rLink)
|
||||
void SetMouseMoveHdl(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
m_aMouseMotionHdl = rLink;
|
||||
}
|
||||
void SetMouseReleaseHdl(const Link<const MouseEvent&, void>& rLink)
|
||||
void SetMouseReleaseHdl(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
m_aMouseReleaseHdl = rLink;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ protected:
|
||||
|
||||
TextView* GetTextView() const;
|
||||
ExtTextEngine* GetTextEngine() const;
|
||||
ScrollBar* GetVScrollBar() const;
|
||||
|
||||
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
|
||||
public:
|
||||
@@ -170,7 +169,10 @@ public:
|
||||
|
||||
void EnableCursor( bool bEnable );
|
||||
|
||||
ScrollBar& GetVScrollBar() const;
|
||||
|
||||
TextWindow* GetTextWindow();
|
||||
|
||||
virtual FactoryFunction GetUITestFactory() const override;
|
||||
|
||||
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
|
||||
|
||||
+30
-15
@@ -71,6 +71,9 @@ protected:
|
||||
Link<const Size&, void> m_aSizeAllocateHdl;
|
||||
Link<const KeyEvent&, bool> m_aKeyPressHdl;
|
||||
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
|
||||
Link<const MouseEvent&, bool> m_aMousePressHdl;
|
||||
Link<const MouseEvent&, bool> m_aMouseMotionHdl;
|
||||
Link<const MouseEvent&, bool> m_aMouseReleaseHdl;
|
||||
|
||||
public:
|
||||
virtual void set_sensitive(bool sensitive) = 0;
|
||||
@@ -156,6 +159,24 @@ public:
|
||||
m_aKeyReleaseHdl = rLink;
|
||||
}
|
||||
|
||||
virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
assert(!m_aMousePressHdl.IsSet() || !rLink.IsSet());
|
||||
m_aMousePressHdl = rLink;
|
||||
}
|
||||
|
||||
virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
assert(!m_aMouseMotionHdl.IsSet() || !rLink.IsSet());
|
||||
m_aMouseMotionHdl = rLink;
|
||||
}
|
||||
|
||||
virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink)
|
||||
{
|
||||
assert(!m_aMouseReleaseHdl.IsSet() || !rLink.IsSet());
|
||||
m_aMouseReleaseHdl = rLink;
|
||||
}
|
||||
|
||||
virtual void grab_add() = 0;
|
||||
virtual bool has_grab() const = 0;
|
||||
virtual void grab_remove() = 0;
|
||||
@@ -1318,8 +1339,10 @@ private:
|
||||
|
||||
protected:
|
||||
Link<TextView&, void> m_aChangeHdl;
|
||||
Link<TextView&, void> m_aVChangeHdl;
|
||||
|
||||
void signal_changed() { m_aChangeHdl.Call(*this); }
|
||||
void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
|
||||
|
||||
public:
|
||||
virtual void set_text(const OUString& rText) = 0;
|
||||
@@ -1339,6 +1362,13 @@ public:
|
||||
bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
|
||||
|
||||
void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; }
|
||||
|
||||
virtual int vadjustment_get_value() const = 0;
|
||||
virtual int vadjustment_get_upper() const = 0;
|
||||
virtual int vadjustment_get_lower() const = 0;
|
||||
virtual int vadjustment_get_page_size() const = 0;
|
||||
virtual void vadjustment_set_value(int value) = 0;
|
||||
void connect_vadjustment_changed(const Link<TextView&, void>& rLink) { m_aVChangeHdl = rLink; }
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC Expander : virtual public Container
|
||||
@@ -1362,9 +1392,6 @@ public:
|
||||
|
||||
protected:
|
||||
Link<draw_args, void> m_aDrawHdl;
|
||||
Link<const MouseEvent&, void> m_aMousePressHdl;
|
||||
Link<const MouseEvent&, void> m_aMouseMotionHdl;
|
||||
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
|
||||
Link<Widget&, void> m_aStyleUpdatedHdl;
|
||||
Link<const Point&, bool> m_aPopupMenuHdl;
|
||||
Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl;
|
||||
@@ -1377,18 +1404,6 @@ protected:
|
||||
|
||||
public:
|
||||
void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
|
||||
void connect_mouse_press(const Link<const MouseEvent&, void>& rLink)
|
||||
{
|
||||
m_aMousePressHdl = rLink;
|
||||
}
|
||||
void connect_mouse_move(const Link<const MouseEvent&, void>& rLink)
|
||||
{
|
||||
m_aMouseMotionHdl = rLink;
|
||||
}
|
||||
void connect_mouse_release(const Link<const MouseEvent&, void>& rLink)
|
||||
{
|
||||
m_aMouseReleaseHdl = rLink;
|
||||
}
|
||||
void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
|
||||
void connect_popup_menu(const Link<const Point&, bool>& rLink) { m_aPopupMenuHdl = rLink; }
|
||||
void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink)
|
||||
|
||||
@@ -62,7 +62,7 @@ void SvxCharView::LoseFocus()
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvxCharView::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SvxCharView::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
if ( rMEvt.IsLeft() )
|
||||
{
|
||||
@@ -82,6 +82,8 @@ void SvxCharView::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
Invalidate();
|
||||
createContextMenu();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SvxCharView::KeyInput(const KeyEvent& rKEvt)
|
||||
|
||||
@@ -10,7 +10,6 @@ desktop/uiconfig/ui/licensedialog.ui://GtkImage[@id='arrow1'] no-labelled-by
|
||||
desktop/uiconfig/ui/licensedialog.ui://GtkImage[@id='arrow2'] no-labelled-by
|
||||
desktop/uiconfig/ui/licensedialog.ui://GtkLabel[@id='label4'] orphan-label
|
||||
desktop/uiconfig/ui/licensedialog.ui://GtkLabel[@id='label5'] orphan-label
|
||||
desktop/uiconfig/ui/licensedialog.ui://deploymentgui-LicenseView[@id='textview:border'] no-labelled-by
|
||||
desktop/uiconfig/ui/updatedialog.ui://GtkLabel[@id='UPDATE_LABEL'] orphan-label
|
||||
desktop/uiconfig/ui/updatedialog.ui://GtkLabel[@id='UPDATE_CHECKING'] orphan-label
|
||||
desktop/uiconfig/ui/updatedialog.ui://GtkSpinner[@id='THROBBER'] no-labelled-by
|
||||
|
||||
@@ -257,7 +257,7 @@ class SmShowSymbolSet : public weld::CustomWidgetController
|
||||
Point OffsetPoint(const Point &rPoint) const;
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool KeyInput(const KeyEvent& rKEvt) override;
|
||||
|
||||
DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
|
||||
@@ -289,7 +289,7 @@ private:
|
||||
Link<SmShowSymbol&,void> aDblClickHdlLink;
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
|
||||
void setFontSize(vcl::Font &rFont) const;
|
||||
|
||||
|
||||
@@ -1001,7 +1001,7 @@ void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
|
||||
rRenderContext.Pop();
|
||||
}
|
||||
|
||||
void SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
GrabFocus();
|
||||
|
||||
@@ -1023,6 +1023,8 @@ void SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
if (rMEvt.GetClicks() > 1)
|
||||
aDblClickHdlLink.Call(*this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt)
|
||||
@@ -1159,10 +1161,11 @@ void SmShowSymbol::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
|
||||
(rRenderContext.GetOutputSize().Height() * 7 / 10)), rText);
|
||||
}
|
||||
|
||||
void SmShowSymbol::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SmShowSymbol::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
if (rMEvt.GetClicks() > 1)
|
||||
aDblClickHdlLink.Call(*this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SmShowSymbol::SetSymbol(const SmSym *pSymbol)
|
||||
|
||||
@@ -2588,7 +2588,7 @@ void SvtValueSet::ImplTracking(const Point& rPos)
|
||||
}
|
||||
}
|
||||
|
||||
void SvtValueSet::MouseButtonDown( const MouseEvent& rMouseEvent )
|
||||
bool SvtValueSet::MouseButtonDown( const MouseEvent& rMouseEvent )
|
||||
{
|
||||
if ( rMouseEvent.IsLeft() )
|
||||
{
|
||||
@@ -2605,19 +2605,19 @@ void SvtValueSet::MouseButtonDown( const MouseEvent& rMouseEvent )
|
||||
else if ( rMouseEvent.GetClicks() == 2 )
|
||||
maDoubleClickHdl.Call( this );
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
CustomWidgetController::MouseButtonDown( rMouseEvent );
|
||||
return CustomWidgetController::MouseButtonDown( rMouseEvent );
|
||||
}
|
||||
|
||||
void SvtValueSet::MouseMove(const MouseEvent& rMouseEvent)
|
||||
bool SvtValueSet::MouseMove(const MouseEvent& rMouseEvent)
|
||||
{
|
||||
// because of SelectionMode
|
||||
if ((GetStyle() & WB_MENUSTYLEVALUESET) || (GetStyle() & WB_FLATVALUESET))
|
||||
ImplTracking(rMouseEvent.GetPosPixel());
|
||||
CustomWidgetController::MouseMove(rMouseEvent);
|
||||
return CustomWidgetController::MouseMove(rMouseEvent);
|
||||
}
|
||||
|
||||
void SvtValueSet::RemoveItem( sal_uInt16 nItemId )
|
||||
|
||||
@@ -123,7 +123,7 @@ void SvxShowCharSet::LoseFocus()
|
||||
SelectIndex(nSelectedIndex);
|
||||
}
|
||||
|
||||
void SvxShowCharSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SvxShowCharSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
if ( rMEvt.IsLeft() )
|
||||
{
|
||||
@@ -151,9 +151,11 @@ void SvxShowCharSet::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
SelectIndex( nIndex, true);
|
||||
createContextMenu();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SvxShowCharSet::MouseButtonUp(const MouseEvent& rMEvt)
|
||||
bool SvxShowCharSet::MouseButtonUp(const MouseEvent& rMEvt)
|
||||
{
|
||||
if ( bDrag && rMEvt.IsLeft() )
|
||||
{
|
||||
@@ -163,9 +165,11 @@ void SvxShowCharSet::MouseButtonUp(const MouseEvent& rMEvt)
|
||||
ReleaseMouse();
|
||||
bDrag = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SvxShowCharSet::MouseMove(const MouseEvent& rMEvt)
|
||||
bool SvxShowCharSet::MouseMove(const MouseEvent& rMEvt)
|
||||
{
|
||||
if ( rMEvt.IsLeft() && bDrag )
|
||||
{
|
||||
@@ -185,6 +189,8 @@ void SvxShowCharSet::MouseMove(const MouseEvent& rMEvt)
|
||||
// Fire the focus event.
|
||||
SelectIndex( nIndex, true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos)
|
||||
|
||||
@@ -253,7 +253,7 @@ sal_uInt16 SvxXConnectionPreview::GetLineDeltaCount()
|
||||
return nCount;
|
||||
}
|
||||
|
||||
void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
bool SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
|
||||
bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
|
||||
@@ -305,6 +305,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -531,7 +531,7 @@ void SvxDialControl::StyleUpdated()
|
||||
InvalidateControl();
|
||||
}
|
||||
|
||||
void SvxDialControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SvxDialControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
if( rMEvt.IsLeft() )
|
||||
{
|
||||
@@ -540,15 +540,17 @@ void SvxDialControl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
mpImpl->mnOldAngle = mpImpl->mnAngle;
|
||||
HandleMouseEvent( rMEvt.GetPosPixel(), true );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SvxDialControl::MouseMove( const MouseEvent& rMEvt )
|
||||
bool SvxDialControl::MouseMove( const MouseEvent& rMEvt )
|
||||
{
|
||||
if( IsMouseCaptured() && rMEvt.IsLeft() )
|
||||
HandleMouseEvent( rMEvt.GetPosPixel(), false );
|
||||
return true;
|
||||
}
|
||||
|
||||
void SvxDialControl::MouseButtonUp(const MouseEvent&)
|
||||
bool SvxDialControl::MouseButtonUp(const MouseEvent&)
|
||||
{
|
||||
if( IsMouseCaptured() )
|
||||
{
|
||||
@@ -556,6 +558,7 @@ void SvxDialControl::MouseButtonUp(const MouseEvent&)
|
||||
if( mpImpl->mpLinkField )
|
||||
mpImpl->mpLinkField->grab_focus();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SvxDialControl::KeyInput( const KeyEvent& rKEvt )
|
||||
|
||||
@@ -188,7 +188,7 @@ void SvxRectCtl::InitSettings(vcl::RenderContext& rRenderContext)
|
||||
|
||||
// The clicked rectangle (3 x 3) is determined and the parent (dialog)
|
||||
// is notified that the item was changed
|
||||
void SvxRectCtl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SvxRectCtl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
// CompletelyDisabled() added to have a disabled state for SvxRectCtl
|
||||
if(!IsCompletelyDisabled())
|
||||
@@ -200,6 +200,7 @@ void SvxRectCtl::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
if (m_pPage)
|
||||
m_pPage->PointChanged(GetDrawingArea(), eRP);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SvxRectCtl::KeyInput(const KeyEvent& rKeyEvt)
|
||||
@@ -668,10 +669,10 @@ void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
|
||||
|
||||
// The clicked rectangle is identified, to change its color
|
||||
|
||||
void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
bool SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
if (!aRectSize.Width() || !aRectSize.Height())
|
||||
return;
|
||||
return true;
|
||||
|
||||
//Grab focus when click in window
|
||||
if (!HasFocus())
|
||||
@@ -685,6 +686,8 @@ void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
m_xAccess->NotifyChild(nIndex,true, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
tools::Rectangle SvxPixelCtl::GetFocusRect()
|
||||
|
||||
@@ -1065,7 +1065,7 @@ void FrameSelector::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
|
||||
mxImpl->DrawAllTrackingRects(rRenderContext);
|
||||
}
|
||||
|
||||
void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
bool FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
/* Mouse handling:
|
||||
* Click on an unselected frame border:
|
||||
@@ -1149,6 +1149,8 @@ void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
GetSelectHdl().Call( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FrameSelector::KeyInput( const KeyEvent& rKEvt )
|
||||
|
||||
@@ -94,7 +94,7 @@ void SvxXMeasurePreview::SetAttributes(const SfxItemSet& rInAttrs)
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void SvxXMeasurePreview::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
bool SvxXMeasurePreview::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
|
||||
bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
|
||||
@@ -147,6 +147,8 @@ void SvxXMeasurePreview::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -660,7 +660,7 @@ void AddressPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
|
||||
rRenderContext.SetClipRegion();
|
||||
}
|
||||
|
||||
void AddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
bool AddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
if (rMEvt.IsLeft() && pImpl->nRows && pImpl->nColumns)
|
||||
{
|
||||
@@ -683,6 +683,7 @@ void AddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddressPreview::KeyInput( const KeyEvent& rKEvt )
|
||||
|
||||
@@ -119,7 +119,7 @@ class SW_DLLPUBLIC AddressPreview : public weld::CustomWidgetController
|
||||
const Point& rTopLeft, const Size& rSize, bool bIsSelected);
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
|
||||
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
|
||||
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
|
||||
void UpdateScrollBar();
|
||||
|
||||
|
||||
@@ -46,19 +46,19 @@ IMPL_LINK(CustomWeld, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
|
||||
m_rWidgetController.Paint(aPayload.first, aPayload.second);
|
||||
}
|
||||
|
||||
IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, void)
|
||||
IMPL_LINK(CustomWeld, DoMouseButtonDown, const MouseEvent&, rMEvt, bool)
|
||||
{
|
||||
m_rWidgetController.MouseButtonDown(rMEvt);
|
||||
return m_rWidgetController.MouseButtonDown(rMEvt);
|
||||
}
|
||||
|
||||
IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, void)
|
||||
IMPL_LINK(CustomWeld, DoMouseMove, const MouseEvent&, rMEvt, bool)
|
||||
{
|
||||
m_rWidgetController.MouseMove(rMEvt);
|
||||
return m_rWidgetController.MouseMove(rMEvt);
|
||||
}
|
||||
|
||||
IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, void)
|
||||
IMPL_LINK(CustomWeld, DoMouseButtonUp, const MouseEvent&, rMEvt, bool)
|
||||
{
|
||||
m_rWidgetController.MouseButtonUp(rMEvt);
|
||||
return m_rWidgetController.MouseButtonUp(rMEvt);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(CustomWeld, DoGetFocus, weld::Widget&, void) { m_rWidgetController.GetFocus(); }
|
||||
|
||||
@@ -499,6 +499,24 @@ public:
|
||||
weld::Widget::connect_size_allocate(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
ensure_event_listener();
|
||||
weld::Widget::connect_mouse_press(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
ensure_event_listener();
|
||||
weld::Widget::connect_mouse_move(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
ensure_event_listener();
|
||||
weld::Widget::connect_mouse_release(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
|
||||
{
|
||||
ensure_key_listener();
|
||||
@@ -604,6 +622,21 @@ void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
|
||||
m_aFocusOutHdl.Call(*this);
|
||||
else if (rEvent.GetId() == VclEventId::WindowResize)
|
||||
m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel());
|
||||
else if (rEvent.GetId() == VclEventId::WindowMouseButtonDown)
|
||||
{
|
||||
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rEvent.GetData());
|
||||
m_aMousePressHdl.Call(*pMouseEvent);
|
||||
}
|
||||
else if (rEvent.GetId() == VclEventId::WindowMouseButtonUp)
|
||||
{
|
||||
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rEvent.GetData());
|
||||
m_aMouseReleaseHdl.Call(*pMouseEvent);
|
||||
}
|
||||
else if (rEvent.GetId() == VclEventId::WindowMouseMove)
|
||||
{
|
||||
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rEvent.GetData());
|
||||
m_aMouseMotionHdl.Call(*pMouseEvent);
|
||||
}
|
||||
}
|
||||
|
||||
bool SalInstanceWidget::HandleKeyEventListener(VclWindowEvent& rEvent)
|
||||
@@ -624,7 +657,6 @@ bool SalInstanceWidget::HandleKeyEventListener(VclWindowEvent& rEvent)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
IMPL_LINK(SalInstanceWidget, EventListener, VclWindowEvent&, rEvent, void)
|
||||
{
|
||||
HandleEventListener(rEvent);
|
||||
@@ -1256,11 +1288,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
IMPL_LINK_NOARG(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, void)
|
||||
IMPL_LINK(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, pScrollBar, void)
|
||||
{
|
||||
signal_vadjustment_changed();
|
||||
if (!m_bUserManagedScrolling)
|
||||
m_aOrigVScrollHdl.Call(&m_xScrolledWindow->getVertScrollBar());
|
||||
m_aOrigVScrollHdl.Call(pScrollBar);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SalInstanceScrolledWindow, HscrollHdl, ScrollBar*, void)
|
||||
@@ -3241,14 +3273,19 @@ class SalInstanceTextView : public SalInstanceContainer, public virtual weld::Te
|
||||
{
|
||||
private:
|
||||
VclPtr<VclMultiLineEdit> m_xTextView;
|
||||
Link<ScrollBar*,void> m_aOrigVScrollHdl;
|
||||
|
||||
DECL_LINK(ChangeHdl, Edit&, void);
|
||||
DECL_LINK(VscrollHdl, ScrollBar*, void);
|
||||
public:
|
||||
SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||
: SalInstanceContainer(pTextView, pBuilder, bTakeOwnership)
|
||||
, m_xTextView(pTextView)
|
||||
{
|
||||
m_xTextView->SetModifyHdl(LINK(this, SalInstanceTextView, ChangeHdl));
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
m_aOrigVScrollHdl = rVertScrollBar.GetScrollHdl();
|
||||
rVertScrollBar.SetScrollHdl(LINK(this, SalInstanceTextView, VscrollHdl));
|
||||
}
|
||||
|
||||
virtual void set_text(const OUString& rText) override
|
||||
@@ -3299,12 +3336,54 @@ public:
|
||||
m_xTextView->SetControlFont(aFont);
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_value() const override
|
||||
{
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
return rVertScrollBar.GetThumbPos();
|
||||
}
|
||||
|
||||
virtual void vadjustment_set_value(int value) override
|
||||
{
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
rVertScrollBar.SetThumbPos(value);
|
||||
m_aOrigVScrollHdl.Call(&rVertScrollBar);
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_upper() const override
|
||||
{
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
return rVertScrollBar.GetRangeMax();
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_lower() const override
|
||||
{
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
return rVertScrollBar.GetRangeMin();
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_page_size() const override
|
||||
{
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
return rVertScrollBar.GetVisibleSize();
|
||||
}
|
||||
|
||||
virtual ~SalInstanceTextView() override
|
||||
{
|
||||
m_xTextView->SetModifyHdl(Link<Edit&, void>());
|
||||
if (!m_xTextView->IsDisposed())
|
||||
{
|
||||
m_xTextView->SetModifyHdl(Link<Edit&, void>());
|
||||
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
|
||||
rVertScrollBar.SetScrollHdl(m_aOrigVScrollHdl);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
IMPL_LINK(SalInstanceTextView, VscrollHdl, ScrollBar*, pScrollBar, void)
|
||||
{
|
||||
signal_vadjustment_changed();
|
||||
m_aOrigVScrollHdl.Call(pScrollBar);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SalInstanceTextView, ChangeHdl, Edit&, void)
|
||||
{
|
||||
signal_changed();
|
||||
@@ -3354,9 +3433,9 @@ private:
|
||||
typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
|
||||
DECL_LINK(PaintHdl, target_and_area, void);
|
||||
DECL_LINK(ResizeHdl, const Size&, void);
|
||||
DECL_LINK(MousePressHdl, const MouseEvent&, void);
|
||||
DECL_LINK(MouseMoveHdl, const MouseEvent&, void);
|
||||
DECL_LINK(MouseReleaseHdl, const MouseEvent&, void);
|
||||
DECL_LINK(MousePressHdl, const MouseEvent&, bool);
|
||||
DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
|
||||
DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
|
||||
DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
|
||||
DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
|
||||
DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
|
||||
@@ -3368,7 +3447,10 @@ private:
|
||||
// in VclDrawingArea
|
||||
virtual void HandleEventListener(VclWindowEvent& rEvent) override
|
||||
{
|
||||
if (rEvent.GetId() == VclEventId::WindowResize)
|
||||
if (rEvent.GetId() == VclEventId::WindowResize ||
|
||||
rEvent.GetId() == VclEventId::WindowMouseButtonDown ||
|
||||
rEvent.GetId() == VclEventId::WindowMouseButtonUp ||
|
||||
rEvent.GetId() == VclEventId::WindowMouseMove)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3471,9 +3553,9 @@ public:
|
||||
m_xDrawingArea->SetQueryTooltipHdl(Link<tools::Rectangle&, OUString>());
|
||||
m_xDrawingArea->SetPopupMenuHdl(Link<const Point&, bool>());
|
||||
m_xDrawingArea->SetStyleUpdatedHdl(Link<VclDrawingArea&, void>());
|
||||
m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, void>());
|
||||
m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, void>());
|
||||
m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, void>());
|
||||
m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, bool>());
|
||||
m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, bool>());
|
||||
m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, bool>());
|
||||
m_xDrawingArea->SetKeyPressHdl(Link<const KeyEvent&, bool>());
|
||||
m_xDrawingArea->SetKeyReleaseHdl(Link<const KeyEvent&, bool>());
|
||||
m_xDrawingArea->SetResizeHdl(Link<const Size&, void>());
|
||||
@@ -3499,19 +3581,19 @@ IMPL_LINK(SalInstanceDrawingArea, ResizeHdl, const Size&, rSize, void)
|
||||
m_aSizeAllocateHdl.Call(rSize);
|
||||
}
|
||||
|
||||
IMPL_LINK(SalInstanceDrawingArea, MousePressHdl, const MouseEvent&, rEvent, void)
|
||||
IMPL_LINK(SalInstanceDrawingArea, MousePressHdl, const MouseEvent&, rEvent, bool)
|
||||
{
|
||||
m_aMousePressHdl.Call(rEvent);
|
||||
return m_aMousePressHdl.Call(rEvent);
|
||||
}
|
||||
|
||||
IMPL_LINK(SalInstanceDrawingArea, MouseMoveHdl, const MouseEvent&, rEvent, void)
|
||||
IMPL_LINK(SalInstanceDrawingArea, MouseMoveHdl, const MouseEvent&, rEvent, bool)
|
||||
{
|
||||
m_aMouseMotionHdl.Call(rEvent);
|
||||
return m_aMouseMotionHdl.Call(rEvent);
|
||||
}
|
||||
|
||||
IMPL_LINK(SalInstanceDrawingArea, MouseReleaseHdl, const MouseEvent&, rEvent, void)
|
||||
IMPL_LINK(SalInstanceDrawingArea, MouseReleaseHdl, const MouseEvent&, rEvent, bool)
|
||||
{
|
||||
m_aMouseReleaseHdl.Call(rEvent);
|
||||
return m_aMouseReleaseHdl.Call(rEvent);
|
||||
}
|
||||
|
||||
IMPL_LINK(SalInstanceDrawingArea, KeyPressHdl, const KeyEvent&, rEvent, bool)
|
||||
|
||||
@@ -107,15 +107,20 @@ public:
|
||||
void InitFromStyle( WinBits nWinStyle );
|
||||
|
||||
TextWindow* GetTextWindow() { return mpTextWindow; }
|
||||
ScrollBar* GetHScrollBar() { return mpHScrollBar; }
|
||||
ScrollBar* GetVScrollBar() { return mpVScrollBar; }
|
||||
ScrollBar& GetHScrollBar() { return *mpHScrollBar; }
|
||||
ScrollBar& GetVScrollBar() { return *mpVScrollBar; }
|
||||
};
|
||||
|
||||
ImpVclMEdit::ImpVclMEdit( VclMultiLineEdit* pEdt, WinBits nWinStyle )
|
||||
: pVclMultiLineEdit(pEdt)
|
||||
, mpTextWindow(VclPtr<TextWindow>::Create(pEdt))
|
||||
, mpHScrollBar(VclPtr<ScrollBar>::Create(pVclMultiLineEdit, WB_HSCROLL|WB_DRAG))
|
||||
, mpVScrollBar(VclPtr<ScrollBar>::Create(pVclMultiLineEdit, WB_VSCROLL|WB_DRAG))
|
||||
, mpScrollBox(VclPtr<ScrollBarBox>::Create(pVclMultiLineEdit, WB_SIZEABLE))
|
||||
, mnTextWidth(0)
|
||||
{
|
||||
mpVScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
|
||||
mpHScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
|
||||
mpTextWindow->Show();
|
||||
InitFromStyle( nWinStyle );
|
||||
StartListening( *mpTextWindow->GetTextEngine() );
|
||||
@@ -123,9 +128,9 @@ ImpVclMEdit::ImpVclMEdit( VclMultiLineEdit* pEdt, WinBits nWinStyle )
|
||||
|
||||
void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
|
||||
{
|
||||
const bool bHaveVScroll = (nullptr != mpVScrollBar);
|
||||
const bool bHaveHScroll = (nullptr != mpHScrollBar);
|
||||
const bool bHaveScrollBox = (nullptr != mpScrollBox);
|
||||
const bool bHaveVScroll = mpVScrollBar->IsVisible();
|
||||
const bool bHaveHScroll = mpHScrollBar->IsVisible();
|
||||
const bool bHaveScrollBox = mpScrollBox->IsVisible();
|
||||
|
||||
bool bNeedVScroll = ( nWinStyle & WB_VSCROLL ) == WB_VSCROLL;
|
||||
const bool bNeedHScroll = ( nWinStyle & WB_HSCROLL ) == WB_HSCROLL;
|
||||
@@ -146,39 +151,19 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
|
||||
bool bScrollbarsChanged = false;
|
||||
if ( bHaveVScroll != bNeedVScroll )
|
||||
{
|
||||
mpVScrollBar.disposeAndClear();
|
||||
mpVScrollBar = bNeedVScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_VSCROLL|WB_DRAG ) : nullptr;
|
||||
|
||||
if ( bNeedVScroll )
|
||||
{
|
||||
mpVScrollBar->Show();
|
||||
mpVScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
|
||||
}
|
||||
|
||||
mpVScrollBar->Show(bNeedVScroll);
|
||||
bScrollbarsChanged = true;
|
||||
}
|
||||
|
||||
if ( bHaveHScroll != bNeedHScroll )
|
||||
{
|
||||
mpHScrollBar.disposeAndClear();
|
||||
mpHScrollBar = bNeedHScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_HSCROLL|WB_DRAG ) : nullptr;
|
||||
|
||||
if ( bNeedHScroll )
|
||||
{
|
||||
mpHScrollBar->Show();
|
||||
mpHScrollBar->SetScrollHdl( LINK( this, ImpVclMEdit, ScrollHdl ) );
|
||||
}
|
||||
|
||||
mpHScrollBar->Show(bNeedHScroll);
|
||||
bScrollbarsChanged = true;
|
||||
}
|
||||
|
||||
if ( bHaveScrollBox != bNeedScrollBox )
|
||||
{
|
||||
mpScrollBox.disposeAndClear();
|
||||
mpScrollBox = bNeedScrollBox ? VclPtr<ScrollBarBox>::Create( pVclMultiLineEdit, WB_SIZEABLE ) : nullptr;
|
||||
|
||||
if ( bNeedScrollBox )
|
||||
mpScrollBox->Show();
|
||||
mpScrollBox->Show(bNeedScrollBox);
|
||||
}
|
||||
|
||||
if ( bScrollbarsChanged )
|
||||
@@ -229,46 +214,32 @@ ImpVclMEdit::~ImpVclMEdit()
|
||||
|
||||
void ImpVclMEdit::ImpSetScrollBarRanges()
|
||||
{
|
||||
if ( mpVScrollBar )
|
||||
{
|
||||
const long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
|
||||
mpVScrollBar->SetRange( Range( 0, nTextHeight-1 ) );
|
||||
}
|
||||
if ( mpHScrollBar )
|
||||
{
|
||||
// sal_uLong nTextWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
|
||||
// there is no Notify by width change
|
||||
// sal_uLong nW = Max( (sal_uLong)mpTextWindow->GetOutputSizePixel().Width()*5, (sal_uLong)nTextWidth );
|
||||
// mpHScrollBar->SetRange( Range( 0, (long)nW ) );
|
||||
mpHScrollBar->SetRange( Range( 0, mnTextWidth-1 ) );
|
||||
}
|
||||
const long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
|
||||
mpVScrollBar->SetRange( Range( 0, nTextHeight-1 ) );
|
||||
|
||||
mpHScrollBar->SetRange( Range( 0, mnTextWidth-1 ) );
|
||||
}
|
||||
|
||||
void ImpVclMEdit::ImpInitScrollBars()
|
||||
{
|
||||
static const sal_Unicode sampleChar = { 'x' };
|
||||
if ( mpHScrollBar || mpVScrollBar )
|
||||
{
|
||||
ImpSetScrollBarRanges();
|
||||
Size aCharBox;
|
||||
aCharBox.setWidth( mpTextWindow->GetTextWidth( OUString(sampleChar) ) );
|
||||
aCharBox.setHeight( mpTextWindow->GetTextHeight() );
|
||||
Size aOutSz = mpTextWindow->GetOutputSizePixel();
|
||||
if ( mpHScrollBar )
|
||||
{
|
||||
mpHScrollBar->SetVisibleSize( aOutSz.Width() );
|
||||
mpHScrollBar->SetPageSize( aOutSz.Width() * 8 / 10 );
|
||||
mpHScrollBar->SetLineSize( aCharBox.Width()*10 );
|
||||
ImpSetHScrollBarThumbPos();
|
||||
}
|
||||
if ( mpVScrollBar )
|
||||
{
|
||||
mpVScrollBar->SetVisibleSize( aOutSz.Height() );
|
||||
mpVScrollBar->SetPageSize( aOutSz.Height() * 8 / 10 );
|
||||
mpVScrollBar->SetLineSize( aCharBox.Height() );
|
||||
mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
|
||||
}
|
||||
}
|
||||
|
||||
ImpSetScrollBarRanges();
|
||||
|
||||
Size aCharBox;
|
||||
aCharBox.setWidth( mpTextWindow->GetTextWidth( OUString(sampleChar) ) );
|
||||
aCharBox.setHeight( mpTextWindow->GetTextHeight() );
|
||||
Size aOutSz = mpTextWindow->GetOutputSizePixel();
|
||||
|
||||
mpHScrollBar->SetVisibleSize( aOutSz.Width() );
|
||||
mpHScrollBar->SetPageSize( aOutSz.Width() * 8 / 10 );
|
||||
mpHScrollBar->SetLineSize( aCharBox.Width()*10 );
|
||||
ImpSetHScrollBarThumbPos();
|
||||
|
||||
mpVScrollBar->SetVisibleSize( aOutSz.Height() );
|
||||
mpVScrollBar->SetPageSize( aOutSz.Height() * 8 / 10 );
|
||||
mpVScrollBar->SetLineSize( aCharBox.Height() );
|
||||
mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
|
||||
}
|
||||
|
||||
void ImpVclMEdit::ImpSetHScrollBarThumbPos()
|
||||
@@ -372,18 +343,18 @@ void ImpVclMEdit::Resize()
|
||||
long nSBWidth = pVclMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize();
|
||||
nSBWidth = pVclMultiLineEdit->CalcZoom( nSBWidth );
|
||||
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
aSz.AdjustHeight( -(nSBWidth+1) );
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
aSz.AdjustWidth( -(nSBWidth+1) );
|
||||
|
||||
if ( !mpHScrollBar )
|
||||
if (!mpHScrollBar->IsVisible())
|
||||
mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() );
|
||||
else
|
||||
mpHScrollBar->setPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth );
|
||||
|
||||
Point aTextWindowPos;
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
{
|
||||
if( AllSettings::GetLayoutRTL() )
|
||||
{
|
||||
@@ -394,7 +365,7 @@ void ImpVclMEdit::Resize()
|
||||
mpVScrollBar->setPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() );
|
||||
}
|
||||
|
||||
if ( mpScrollBox )
|
||||
if (mpScrollBox->IsVisible())
|
||||
mpScrollBox->setPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
|
||||
|
||||
Size aTextWindowSize( aSz );
|
||||
@@ -478,9 +449,9 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
||||
switch (pTextHint->GetId())
|
||||
{
|
||||
case SfxHintId::TextViewScrolled:
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
ImpSetHScrollBarThumbPos();
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
|
||||
break;
|
||||
|
||||
@@ -496,7 +467,7 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
|
||||
break;
|
||||
|
||||
case SfxHintId::TextFormatted:
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
{
|
||||
const long nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
|
||||
if ( nWidth != mnTextWidth )
|
||||
@@ -598,9 +569,9 @@ Size ImpVclMEdit::CalcMinimumSize() const
|
||||
Size aSz( mpTextWindow->GetTextEngine()->CalcTextWidth(),
|
||||
mpTextWindow->GetTextEngine()->GetTextHeight() );
|
||||
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
aSz.AdjustHeight(mpHScrollBar->GetSizePixel().Height() );
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
aSz.AdjustWidth(mpVScrollBar->GetSizePixel().Width() );
|
||||
|
||||
return aSz;
|
||||
@@ -625,9 +596,9 @@ Size ImpVclMEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
|
||||
else
|
||||
aSz.setWidth( mpTextWindow->GetTextEngine()->CalcTextWidth() );
|
||||
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
aSz.AdjustHeight(mpHScrollBar->GetSizePixel().Height() );
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
aSz.AdjustWidth(mpVScrollBar->GetSizePixel().Width() );
|
||||
|
||||
return aSz;
|
||||
@@ -645,9 +616,9 @@ void ImpVclMEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLi
|
||||
void ImpVclMEdit::Enable( bool bEnable )
|
||||
{
|
||||
mpTextWindow->Enable( bEnable );
|
||||
if ( mpHScrollBar )
|
||||
if (mpHScrollBar->IsVisible())
|
||||
mpHScrollBar->Enable( bEnable );
|
||||
if ( mpVScrollBar )
|
||||
if (mpVScrollBar->IsVisible())
|
||||
mpVScrollBar->Enable( bEnable );
|
||||
}
|
||||
|
||||
@@ -658,7 +629,9 @@ bool ImpVclMEdit::HandleCommand( const CommandEvent& rCEvt )
|
||||
( rCEvt.GetCommand() == CommandEventId::StartAutoScroll ) ||
|
||||
( rCEvt.GetCommand() == CommandEventId::AutoScroll ) )
|
||||
{
|
||||
(void)mpTextWindow->HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar );
|
||||
ScrollBar* pHScrollBar = mpHScrollBar->IsVisible() ? mpHScrollBar.get() : nullptr;
|
||||
ScrollBar* pVScrollBar = mpVScrollBar->IsVisible() ? mpVScrollBar.get() : nullptr;
|
||||
(void)mpTextWindow->HandleScrollCommand(rCEvt, pHScrollBar, pVScrollBar);
|
||||
bDone = true;
|
||||
}
|
||||
return bDone;
|
||||
@@ -1437,38 +1410,38 @@ bool VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt )
|
||||
{
|
||||
case KEY_UP:
|
||||
{
|
||||
if ( pImpVclMEdit->GetVScrollBar() )
|
||||
pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::LineUp );
|
||||
if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineUp );
|
||||
}
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
{
|
||||
if ( pImpVclMEdit->GetVScrollBar() )
|
||||
pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::LineDown );
|
||||
if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::LineDown );
|
||||
}
|
||||
break;
|
||||
case KEY_PAGEUP :
|
||||
{
|
||||
if ( pImpVclMEdit->GetVScrollBar() )
|
||||
pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::PageUp );
|
||||
if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageUp );
|
||||
}
|
||||
break;
|
||||
case KEY_PAGEDOWN:
|
||||
{
|
||||
if ( pImpVclMEdit->GetVScrollBar() )
|
||||
pImpVclMEdit->GetVScrollBar()->DoScrollAction( ScrollType::PageDown );
|
||||
if ( pImpVclMEdit->GetVScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetVScrollBar().DoScrollAction( ScrollType::PageDown );
|
||||
}
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
{
|
||||
if ( pImpVclMEdit->GetHScrollBar() )
|
||||
pImpVclMEdit->GetHScrollBar()->DoScrollAction( ScrollType::LineUp );
|
||||
if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineUp );
|
||||
}
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
{
|
||||
if ( pImpVclMEdit->GetHScrollBar() )
|
||||
pImpVclMEdit->GetHScrollBar()->DoScrollAction( ScrollType::LineDown );
|
||||
if ( pImpVclMEdit->GetHScrollBar().IsVisible() )
|
||||
pImpVclMEdit->GetHScrollBar().DoScrollAction( ScrollType::LineDown );
|
||||
}
|
||||
break;
|
||||
case KEY_HOME:
|
||||
@@ -1509,7 +1482,7 @@ TextView* VclMultiLineEdit::GetTextView() const
|
||||
return pImpVclMEdit->GetTextWindow()->GetTextView();
|
||||
}
|
||||
|
||||
ScrollBar* VclMultiLineEdit::GetVScrollBar() const
|
||||
ScrollBar& VclMultiLineEdit::GetVScrollBar() const
|
||||
{
|
||||
return pImpVclMEdit->GetVScrollBar();
|
||||
}
|
||||
|
||||
+228
-145
@@ -1219,6 +1219,34 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
static MouseEventModifiers ImplGetMouseButtonMode(sal_uInt16 nButton, sal_uInt16 nCode)
|
||||
{
|
||||
MouseEventModifiers nMode = MouseEventModifiers::NONE;
|
||||
if ( nButton == MOUSE_LEFT )
|
||||
nMode |= MouseEventModifiers::SIMPLECLICK;
|
||||
if ( (nButton == MOUSE_LEFT) && !(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) )
|
||||
nMode |= MouseEventModifiers::SELECT;
|
||||
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_MOD1) &&
|
||||
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_SHIFT)) )
|
||||
nMode |= MouseEventModifiers::MULTISELECT;
|
||||
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_SHIFT) &&
|
||||
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_MOD1)) )
|
||||
nMode |= MouseEventModifiers::RANGESELECT;
|
||||
return nMode;
|
||||
}
|
||||
|
||||
static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
|
||||
{
|
||||
MouseEventModifiers nMode = MouseEventModifiers::NONE;
|
||||
if ( !nCode )
|
||||
nMode |= MouseEventModifiers::SIMPLEMOVE;
|
||||
if ( (nCode & MOUSE_LEFT) && !(nCode & KEY_MOD1) )
|
||||
nMode |= MouseEventModifiers::DRAGMOVE;
|
||||
if ( (nCode & MOUSE_LEFT) && (nCode & KEY_MOD1) )
|
||||
nMode |= MouseEventModifiers::DRAGCOPY;
|
||||
return nMode;
|
||||
}
|
||||
|
||||
class GtkInstanceWidget : public virtual weld::Widget
|
||||
{
|
||||
protected:
|
||||
@@ -1252,11 +1280,15 @@ protected:
|
||||
private:
|
||||
bool m_bTakeOwnership;
|
||||
bool m_bFrozen;
|
||||
sal_uInt16 m_nLastMouseButton;
|
||||
gulong m_nFocusInSignalId;
|
||||
gulong m_nFocusOutSignalId;
|
||||
gulong m_nKeyPressSignalId;
|
||||
gulong m_nKeyReleaseSignalId;
|
||||
gulong m_nSizeAllocateSignalId;
|
||||
gulong m_nButtonPressSignalId;
|
||||
gulong m_nMotionSignalId;
|
||||
gulong m_nButtonReleaseSignalId;
|
||||
|
||||
static void signalSizeAllocate(GtkWidget*, GdkRectangle* allocation, gpointer widget)
|
||||
{
|
||||
@@ -1278,25 +1310,164 @@ private:
|
||||
return pThis->signal_key(pEvent);
|
||||
}
|
||||
|
||||
virtual bool signal_popup_menu(const Point&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static gboolean signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer widget)
|
||||
{
|
||||
GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
|
||||
SolarMutexGuard aGuard;
|
||||
return pThis->signal_button(pEvent);
|
||||
}
|
||||
|
||||
bool signal_button(GdkEventButton* pEvent)
|
||||
{
|
||||
int nClicks = 1;
|
||||
|
||||
SalEvent nEventType = SalEvent::NONE;
|
||||
switch (pEvent->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
if (GdkEvent* pPeekEvent = gdk_event_peek())
|
||||
{
|
||||
bool bSkip = pPeekEvent->type == GDK_2BUTTON_PRESS ||
|
||||
pPeekEvent->type == GDK_3BUTTON_PRESS;
|
||||
gdk_event_free(pPeekEvent);
|
||||
if (bSkip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_2BUTTON_PRESS:
|
||||
nClicks = 2;
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_3BUTTON_PRESS:
|
||||
nClicks = 3;
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
nEventType = SalEvent::MouseButtonUp;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pEvent->button)
|
||||
{
|
||||
case 1:
|
||||
m_nLastMouseButton = MOUSE_LEFT;
|
||||
break;
|
||||
case 2:
|
||||
m_nLastMouseButton = MOUSE_MIDDLE;
|
||||
break;
|
||||
case 3:
|
||||
m_nLastMouseButton = MOUSE_RIGHT;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Point aPos(pEvent->x, pEvent->y);
|
||||
if (AllSettings::GetLayoutRTL())
|
||||
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
|
||||
|
||||
if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
//if handled for context menu, stop processing
|
||||
if (signal_popup_menu(aPos))
|
||||
return true;
|
||||
}
|
||||
|
||||
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
|
||||
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
|
||||
MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
|
||||
|
||||
if (nEventType == SalEvent::MouseButtonDown)
|
||||
{
|
||||
if (!m_aMousePressHdl.IsSet())
|
||||
return false;
|
||||
return m_aMousePressHdl.Call(aMEvt);
|
||||
}
|
||||
|
||||
if (!m_aMouseReleaseHdl.IsSet())
|
||||
return false;
|
||||
return m_aMouseReleaseHdl.Call(aMEvt);
|
||||
}
|
||||
|
||||
static gboolean signalMotion(GtkWidget*, GdkEventMotion* pEvent, gpointer widget)
|
||||
{
|
||||
GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
|
||||
SolarMutexGuard aGuard;
|
||||
return pThis->signal_motion(pEvent);
|
||||
}
|
||||
|
||||
bool signal_motion(const GdkEventMotion* pEvent)
|
||||
{
|
||||
if (!m_aMouseMotionHdl.IsSet())
|
||||
return false;
|
||||
|
||||
Point aPos(pEvent->x, pEvent->y);
|
||||
if (AllSettings::GetLayoutRTL())
|
||||
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
|
||||
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
|
||||
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
|
||||
MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, nCode);
|
||||
|
||||
m_aMouseMotionHdl.Call(aMEvt);
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
GtkInstanceWidget(GtkWidget* pWidget, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||
: m_pWidget(pWidget)
|
||||
, m_pBuilder(pBuilder)
|
||||
, m_bTakeOwnership(bTakeOwnership)
|
||||
, m_bFrozen(false)
|
||||
, m_nLastMouseButton(0)
|
||||
, m_nFocusInSignalId(0)
|
||||
, m_nFocusOutSignalId(0)
|
||||
, m_nKeyPressSignalId(0)
|
||||
, m_nKeyReleaseSignalId(0)
|
||||
, m_nSizeAllocateSignalId(0)
|
||||
, m_nButtonPressSignalId(0)
|
||||
, m_nMotionSignalId(0)
|
||||
, m_nButtonReleaseSignalId(0)
|
||||
{
|
||||
GdkEventMask eEventMask(static_cast<GdkEventMask>(gtk_widget_get_events(pWidget)));
|
||||
if (eEventMask & GDK_BUTTON_PRESS_MASK)
|
||||
m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKey), this);
|
||||
else
|
||||
m_nKeyPressSignalId = 0;
|
||||
if (eEventMask & GDK_BUTTON_RELEASE_MASK)
|
||||
m_nKeyReleaseSignalId = g_signal_connect(pWidget, "key-release-event", G_CALLBACK(signalKey), this);
|
||||
else
|
||||
m_nKeyReleaseSignalId = 0;
|
||||
}
|
||||
|
||||
virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override
|
||||
{
|
||||
m_nKeyPressSignalId = g_signal_connect(m_pWidget, "key-press-event", G_CALLBACK(signalKey), this);
|
||||
weld::Widget::connect_key_press(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override
|
||||
{
|
||||
m_nKeyReleaseSignalId = g_signal_connect(m_pWidget, "key-release-event", G_CALLBACK(signalKey), this);
|
||||
weld::Widget::connect_key_release(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
m_nButtonPressSignalId = g_signal_connect(m_pWidget, "button-press-event", G_CALLBACK(signalButton), this);
|
||||
weld::Widget::connect_mouse_press(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
m_nMotionSignalId = g_signal_connect(m_pWidget, "motion-notify-event", G_CALLBACK(signalMotion), this);
|
||||
weld::Widget::connect_mouse_move(rLink);
|
||||
}
|
||||
|
||||
virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) override
|
||||
{
|
||||
m_nButtonReleaseSignalId = g_signal_connect(m_pWidget, "button-release-event", G_CALLBACK(signalButton), this);
|
||||
weld::Widget::connect_mouse_release(rLink);
|
||||
}
|
||||
|
||||
virtual void set_sensitive(bool sensitive) override
|
||||
@@ -1650,6 +1821,12 @@ public:
|
||||
g_signal_handler_disconnect(m_pWidget, m_nKeyPressSignalId);
|
||||
if (m_nKeyReleaseSignalId)
|
||||
g_signal_handler_disconnect(m_pWidget, m_nKeyReleaseSignalId);
|
||||
if (m_nButtonPressSignalId)
|
||||
g_signal_handler_disconnect(m_pWidget, m_nButtonPressSignalId);
|
||||
if (m_nMotionSignalId)
|
||||
g_signal_handler_disconnect(m_pWidget, m_nMotionSignalId);
|
||||
if (m_nButtonReleaseSignalId)
|
||||
g_signal_handler_disconnect(m_pWidget, m_nButtonReleaseSignalId);
|
||||
if (m_nFocusInSignalId)
|
||||
g_signal_handler_disconnect(m_pWidget, m_nFocusInSignalId);
|
||||
if (m_nFocusOutSignalId)
|
||||
@@ -6626,7 +6803,9 @@ class GtkInstanceTextView : public GtkInstanceContainer, public virtual weld::Te
|
||||
private:
|
||||
GtkTextView* m_pTextView;
|
||||
GtkTextBuffer* m_pTextBuffer;
|
||||
GtkAdjustment* m_pVAdjustment;
|
||||
gulong m_nChangedSignalId;
|
||||
gulong m_nVAdjustChangedSignalId;
|
||||
|
||||
static void signalChanged(GtkTextView*, gpointer widget)
|
||||
{
|
||||
@@ -6635,12 +6814,21 @@ private:
|
||||
pThis->signal_changed();
|
||||
}
|
||||
|
||||
static void signalVAdjustValueChanged(GtkAdjustment*, gpointer widget)
|
||||
{
|
||||
GtkInstanceTextView* pThis = static_cast<GtkInstanceTextView*>(widget);
|
||||
SolarMutexGuard aGuard;
|
||||
pThis->signal_vadjustment_changed();
|
||||
}
|
||||
|
||||
public:
|
||||
GtkInstanceTextView(GtkTextView* pTextView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||
: GtkInstanceContainer(GTK_CONTAINER(pTextView), pBuilder, bTakeOwnership)
|
||||
, m_pTextView(pTextView)
|
||||
, m_pTextBuffer(gtk_text_view_get_buffer(pTextView))
|
||||
, m_pVAdjustment(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pTextView)))
|
||||
, m_nChangedSignalId(g_signal_connect(m_pTextBuffer, "changed", G_CALLBACK(signalChanged), this))
|
||||
, m_nVAdjustChangedSignalId(g_signal_connect(m_pVAdjustment, "value-changed", G_CALLBACK(signalVAdjustValueChanged), this))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6715,6 +6903,7 @@ public:
|
||||
|
||||
virtual void disable_notify_events() override
|
||||
{
|
||||
g_signal_handler_block(m_pVAdjustment, m_nVAdjustChangedSignalId);
|
||||
g_signal_handler_block(m_pTextBuffer, m_nChangedSignalId);
|
||||
GtkInstanceContainer::disable_notify_events();
|
||||
}
|
||||
@@ -6723,42 +6912,43 @@ public:
|
||||
{
|
||||
GtkInstanceContainer::enable_notify_events();
|
||||
g_signal_handler_unblock(m_pTextBuffer, m_nChangedSignalId);
|
||||
g_signal_handler_unblock(m_pVAdjustment, m_nVAdjustChangedSignalId);
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_value() const override
|
||||
{
|
||||
return gtk_adjustment_get_value(m_pVAdjustment);
|
||||
}
|
||||
|
||||
virtual void vadjustment_set_value(int value) override
|
||||
{
|
||||
disable_notify_events();
|
||||
gtk_adjustment_set_value(m_pVAdjustment, value);
|
||||
enable_notify_events();
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_upper() const override
|
||||
{
|
||||
return gtk_adjustment_get_upper(m_pVAdjustment);
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_lower() const override
|
||||
{
|
||||
return gtk_adjustment_get_lower(m_pVAdjustment);
|
||||
}
|
||||
|
||||
virtual int vadjustment_get_page_size() const override
|
||||
{
|
||||
return gtk_adjustment_get_page_size(m_pVAdjustment);
|
||||
}
|
||||
|
||||
virtual ~GtkInstanceTextView() override
|
||||
{
|
||||
g_signal_handler_disconnect(m_pVAdjustment, m_nVAdjustChangedSignalId);
|
||||
g_signal_handler_disconnect(m_pTextBuffer, m_nChangedSignalId);
|
||||
}
|
||||
};
|
||||
|
||||
static MouseEventModifiers ImplGetMouseButtonMode(sal_uInt16 nButton, sal_uInt16 nCode)
|
||||
{
|
||||
MouseEventModifiers nMode = MouseEventModifiers::NONE;
|
||||
if ( nButton == MOUSE_LEFT )
|
||||
nMode |= MouseEventModifiers::SIMPLECLICK;
|
||||
if ( (nButton == MOUSE_LEFT) && !(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) )
|
||||
nMode |= MouseEventModifiers::SELECT;
|
||||
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_MOD1) &&
|
||||
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_SHIFT)) )
|
||||
nMode |= MouseEventModifiers::MULTISELECT;
|
||||
if ( (nButton == MOUSE_LEFT) && (nCode & KEY_SHIFT) &&
|
||||
!(nCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_MOD1)) )
|
||||
nMode |= MouseEventModifiers::RANGESELECT;
|
||||
return nMode;
|
||||
}
|
||||
|
||||
static MouseEventModifiers ImplGetMouseMoveMode(sal_uInt16 nCode)
|
||||
{
|
||||
MouseEventModifiers nMode = MouseEventModifiers::NONE;
|
||||
if ( !nCode )
|
||||
nMode |= MouseEventModifiers::SIMPLEMOVE;
|
||||
if ( (nCode & MOUSE_LEFT) && !(nCode & KEY_MOD1) )
|
||||
nMode |= MouseEventModifiers::DRAGMOVE;
|
||||
if ( (nCode & MOUSE_LEFT) && (nCode & KEY_MOD1) )
|
||||
nMode |= MouseEventModifiers::DRAGCOPY;
|
||||
return nMode;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
|
||||
@@ -6772,11 +6962,7 @@ private:
|
||||
AtkObject *m_pAccessible;
|
||||
ScopedVclPtrInstance<VirtualDevice> m_xDevice;
|
||||
cairo_surface_t* m_pSurface;
|
||||
sal_uInt16 m_nLastMouseButton;
|
||||
gulong m_nDrawSignalId;
|
||||
gulong m_nButtonPressSignalId;
|
||||
gulong m_nMotionSignalId;
|
||||
gulong m_nButtonReleaseSignalId;
|
||||
gulong m_nStyleUpdatedSignalId;
|
||||
gulong m_nQueryTooltip;
|
||||
gulong m_nPopupMenu;
|
||||
@@ -6844,7 +7030,7 @@ private:
|
||||
gtk_tooltip_set_tip_area(tooltip, &aGdkHelpArea);
|
||||
return true;
|
||||
}
|
||||
bool signal_popup_menu(const Point& rPos)
|
||||
virtual bool signal_popup_menu(const Point& rPos) override
|
||||
{
|
||||
return m_aPopupMenuHdl.Call(rPos);
|
||||
}
|
||||
@@ -6857,102 +7043,6 @@ private:
|
||||
gtk_widget_get_allocated_height(pWidget) / 2);
|
||||
return pThis->signal_popup_menu(aPos);
|
||||
}
|
||||
static gboolean signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer widget)
|
||||
{
|
||||
GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
|
||||
SolarMutexGuard aGuard;
|
||||
return pThis->signal_button(pEvent);
|
||||
}
|
||||
bool signal_button(GdkEventButton* pEvent)
|
||||
{
|
||||
int nClicks = 1;
|
||||
|
||||
SalEvent nEventType = SalEvent::NONE;
|
||||
switch (pEvent->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
if (GdkEvent* pPeekEvent = gdk_event_peek())
|
||||
{
|
||||
bool bSkip = pPeekEvent->type == GDK_2BUTTON_PRESS ||
|
||||
pPeekEvent->type == GDK_3BUTTON_PRESS;
|
||||
gdk_event_free(pPeekEvent);
|
||||
if (bSkip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_2BUTTON_PRESS:
|
||||
nClicks = 2;
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_3BUTTON_PRESS:
|
||||
nClicks = 3;
|
||||
nEventType = SalEvent::MouseButtonDown;
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
nEventType = SalEvent::MouseButtonUp;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pEvent->button)
|
||||
{
|
||||
case 1:
|
||||
m_nLastMouseButton = MOUSE_LEFT;
|
||||
break;
|
||||
case 2:
|
||||
m_nLastMouseButton = MOUSE_MIDDLE;
|
||||
break;
|
||||
case 3:
|
||||
m_nLastMouseButton = MOUSE_RIGHT;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Point aPos(pEvent->x, pEvent->y);
|
||||
if (AllSettings::GetLayoutRTL())
|
||||
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
|
||||
|
||||
if (gdk_event_triggers_context_menu(reinterpret_cast<GdkEvent*>(pEvent)) && pEvent->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
//if handled for context menu, stop processing
|
||||
if (signal_popup_menu(aPos))
|
||||
return true;
|
||||
}
|
||||
|
||||
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
|
||||
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
|
||||
MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
|
||||
|
||||
if (nEventType == SalEvent::MouseButtonDown)
|
||||
m_aMousePressHdl.Call(aMEvt);
|
||||
else
|
||||
m_aMouseReleaseHdl.Call(aMEvt);
|
||||
|
||||
return true;
|
||||
}
|
||||
static gboolean signalMotion(GtkWidget*, GdkEventMotion* pEvent, gpointer widget)
|
||||
{
|
||||
GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
|
||||
SolarMutexGuard aGuard;
|
||||
return pThis->signal_motion(pEvent);
|
||||
}
|
||||
bool signal_motion(const GdkEventMotion* pEvent)
|
||||
{
|
||||
Point aPos(pEvent->x, pEvent->y);
|
||||
if (AllSettings::GetLayoutRTL())
|
||||
aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - aPos.X());
|
||||
sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
|
||||
sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
|
||||
MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, nCode);
|
||||
|
||||
m_aMouseMotionHdl.Call(aMEvt);
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* pBuilder, const a11yref& rA11y, bool bTakeOwnership)
|
||||
: GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
|
||||
@@ -6961,11 +7051,7 @@ public:
|
||||
, m_pAccessible(nullptr)
|
||||
, m_xDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT)
|
||||
, m_pSurface(nullptr)
|
||||
, m_nLastMouseButton(0)
|
||||
, m_nDrawSignalId(g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(signalDraw), this))
|
||||
, m_nButtonPressSignalId(g_signal_connect(m_pDrawingArea, "button-press-event", G_CALLBACK(signalButton), this))
|
||||
, m_nMotionSignalId(g_signal_connect(m_pDrawingArea, "motion-notify-event", G_CALLBACK(signalMotion), this))
|
||||
, m_nButtonReleaseSignalId(g_signal_connect(m_pDrawingArea, "button-release-event", G_CALLBACK(signalButton), this))
|
||||
, m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this))
|
||||
, m_nQueryTooltip(g_signal_connect(m_pDrawingArea, "query-tooltip", G_CALLBACK(signalQueryTooltip), this))
|
||||
, m_nPopupMenu(g_signal_connect(m_pDrawingArea, "popup-menu", G_CALLBACK(signalPopupMenu), this))
|
||||
@@ -7060,9 +7146,6 @@ public:
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nPopupMenu);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nButtonPressSignalId);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nMotionSignalId);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nButtonReleaseSignalId);
|
||||
g_signal_handler_disconnect(m_pDrawingArea, m_nDrawSignalId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user