diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 74 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 3 |
3 files changed, 57 insertions, 22 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d95d3de9f92f..b740bad17699 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -212,6 +212,7 @@ private: DECL_LINK(FocusInListener, VclWindowEvent&, void); DECL_LINK(FocusOutListener, VclWindowEvent&, void); + DECL_LINK(ResizeListener, VclWindowEvent&, void); const bool m_bTakeOwnership; int m_nBlockNotify; @@ -424,6 +425,22 @@ public: weld::Widget::connect_focus_out(rLink); } + virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override + { + m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, ResizeListener)); + weld::Widget::connect_size_allocate(rLink); + } + + virtual bool get_extents_relative_to(Widget& rRelative, int& x, int &y, int& width, int &height) override + { + tools::Rectangle aRect(m_xWidget->GetWindowExtentsRelative(dynamic_cast<SalInstanceWidget&>(rRelative).getWidget())); + x = aRect.Left(); + y = aRect.Top(); + width = aRect.GetWidth(); + height = aRect.GetHeight(); + return true; + } + virtual void grab_add() override { m_xWidget->CaptureMouse(); @@ -463,6 +480,8 @@ public: virtual ~SalInstanceWidget() override { + if (m_aSizeAllocateHdl.IsSet()) + m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, ResizeListener)); if (m_aFocusInHdl.IsSet()) m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, FocusInListener)); if (m_aFocusOutHdl.IsSet()) @@ -509,6 +528,14 @@ IMPL_LINK(SalInstanceWidget, FocusOutListener, VclWindowEvent&, rEvent, void) signal_focus_out(); } +IMPL_LINK(SalInstanceWidget, ResizeListener, VclWindowEvent&, rEvent, void) +{ + if (rEvent.GetId() == VclEventId::WindowResize) + { + m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel()); + } +} + namespace { Image createImage(const OUString& rImage) @@ -752,21 +779,6 @@ public: m_xWindow->SetPosPixel(Point(x, y)); } - vcl::Window* getWindow() - { - return m_xWindow.get(); - } - - virtual bool get_extents_relative_to(Window& rRelative, int& x, int &y, int& width, int &height) override - { - tools::Rectangle aRect(m_xWindow->GetWindowExtentsRelative(dynamic_cast<SalInstanceWindow&>(rRelative).getWindow())); - x = aRect.Left(); - y = aRect.Top(); - width = aRect.GetWidth(); - height = aRect.GetHeight(); - return true; - } - virtual Size get_size() const override { return m_xWindow->GetSizePixel(); @@ -1592,6 +1604,7 @@ private: DECL_LINK(ChangeHdl, Edit&, void); DECL_LINK(CursorListener, VclWindowEvent&, void); + DECL_LINK(ActivateHdl, Edit&, bool); class WeldTextFilter : public TextFilter { @@ -1624,6 +1637,7 @@ public: , m_aTextFilter(m_aInsertTextHdl) { m_xEntry->SetModifyHdl(LINK(this, SalInstanceEntry, ChangeHdl)); + m_xEntry->SetActivateHdl(LINK(this, SalInstanceEntry, ActivateHdl)); m_xEntry->SetTextFilter(&m_aTextFilter); } @@ -1744,6 +1758,7 @@ public: if (m_aCursorPositionHdl.IsSet()) m_xEntry->RemoveEventListener(LINK(this, SalInstanceEntry, CursorListener)); m_xEntry->SetTextFilter(nullptr); + m_xEntry->SetActivateHdl(Link<Edit&, bool>()); m_xEntry->SetModifyHdl(Link<Edit&, void>()); } }; @@ -1761,6 +1776,11 @@ IMPL_LINK(SalInstanceEntry, CursorListener, VclWindowEvent&, rEvent, void) signal_cursor_position(); } +IMPL_LINK_NOARG(SalInstanceEntry, ActivateHdl, Edit&, bool) +{ + return m_aActivateHdl.Call(*this); +} + struct SalInstanceTreeIter : public weld::TreeIter { SalInstanceTreeIter(const SalInstanceTreeIter* pOrig) @@ -1937,6 +1957,17 @@ public: enable_notify_events(); } + virtual void set_cursor(int pos) override + { + if (pos == -1) + m_xTreeView->SetCurEntry(nullptr); + else + { + SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos); + m_xTreeView->SetCurEntry(pEntry); + } + } + virtual void scroll_to_row(int pos) override { assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); @@ -2646,6 +2677,11 @@ public: m_xDrawingArea->queue_resize(); } + virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override + { + weld::Widget::connect_size_allocate(rLink); + } + virtual a11yref get_accessible_parent() override { vcl::Window* pParent = m_xDrawingArea->GetParent(); @@ -2980,7 +3016,7 @@ class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox> { private: DECL_LINK(ChangeHdl, Edit&, void); - DECL_LINK(EntryActivateHdl, Edit&, void); + DECL_LINK(EntryActivateHdl, Edit&, bool); public: SalInstanceComboBoxWithEdit(::ComboBox* pComboBox, bool bTakeOwnership) : SalInstanceComboBox<::ComboBox>(pComboBox, bTakeOwnership) @@ -3065,7 +3101,7 @@ public: virtual ~SalInstanceComboBoxWithEdit() override { - m_xComboBox->SetEntryActivateHdl(Link<Edit&, void>()); + m_xComboBox->SetEntryActivateHdl(Link<Edit&, bool>()); m_xComboBox->SetModifyHdl(Link<Edit&, void>()); } }; @@ -3075,9 +3111,9 @@ IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, ChangeHdl, Edit&, void) signal_changed(); } -IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, EntryActivateHdl, Edit&, void) +IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, EntryActivateHdl, Edit&, bool) { - m_aEntryActivateHdl.Call(*this); + return m_aEntryActivateHdl.Call(*this); } class SalInstanceEntryTreeView : public SalInstanceContainer, public virtual weld::EntryTreeView diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 8dee63269d0e..9d34f9001182 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -999,7 +999,7 @@ void ComboBox::SetDoubleClickHdl(const Link<ComboBox&,void>& rLink) { m_pImpl->m const Link<ComboBox&,void>& ComboBox::GetDoubleClickHdl() const { return m_pImpl->m_DoubleClickHdl; } -void ComboBox::SetEntryActivateHdl(const Link<Edit&,void>& rLink) +void ComboBox::SetEntryActivateHdl(const Link<Edit&,bool>& rLink) { if (!m_pImpl->m_pSubEdit) return; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index c1337c5dfe24..6e2667258190 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1672,8 +1672,7 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) case KEY_RETURN: if (maActivateHdl.IsSet()) { - maActivateHdl.Call(*this); - bDone = true; + bDone = maActivateHdl.Call(*this); } break; |