make highlight of get_dest_row_at_pos optional

Change-Id: I280e1a49e938f45402f373896669fd6f7e8a66fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94876
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-05-26 16:37:48 +01:00
parent 7bd3f4a072
commit ef9ac1b987
6 changed files with 22 additions and 14 deletions

View file

@ -528,9 +528,9 @@ IMPL_LINK( SvxMenuConfigPage, ContentContextMenuHdl, const CommandEvent&, rCEvt,
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
// Select clicked entry
std::unique_ptr<weld::TreeIter> rIter(rTreeView.make_iterator());
rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), &*rIter );
rTreeView.select(*rIter);
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xIter.get(), false );
rTreeView.select(*xIter);
SelectMenuEntry( rTreeView );
int nSelectIndex = m_xContentsListBox->get_selected_index();
@ -571,9 +571,9 @@ IMPL_LINK( SvxMenuConfigPage, FunctionContextMenuHdl, const CommandEvent&, rCEvt
weld::TreeView& rTreeView = m_xFunctions->get_widget();
// Select clicked entry
std::unique_ptr<weld::TreeIter> rIter(rTreeView.make_iterator());
rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), &*rIter );
rTreeView.select(*rIter);
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
rTreeView.get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xIter.get(), false );
rTreeView.select(*xIter);
SelectFunctionHdl( rTreeView );
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder( &rTreeView, "cui/ui/entrycontextmenu.ui" ) );

View file

@ -1157,7 +1157,9 @@ public:
virtual void set_column_custom_renderer(int nColumn, bool bEnable) = 0;
// for dnd
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult,
bool bHighLightTarget = true)
= 0;
virtual void unset_drag_dest_row() = 0;
virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
// for dragging and dropping between TreeViews, return the active source

View file

@ -336,7 +336,7 @@ void SfxCommonTemplateDialog_Impl::PrepareMenu(const Point& rPos)
{
weld::TreeView* pTreeView = mxTreeBox->get_visible() ? mxTreeBox.get() : mxFmtLb.get();
std::unique_ptr<weld::TreeIter> xIter(pTreeView->make_iterator());
if (pTreeView->get_dest_row_at_pos(rPos, xIter.get()) && !pTreeView->is_selected(*xIter))
if (pTreeView->get_dest_row_at_pos(rPos, xIter.get(), false) && !pTreeView->is_selected(*xIter))
{
pTreeView->unselect_all();
pTreeView->select(*xIter);

View file

@ -127,7 +127,7 @@ public:
m_aModelChangedHdl.Call(this);
}
virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget)
{
SvTreeListEntry* pOldTargetEntry = pTargetEntry;
pTargetEntry = pImpl->GetEntry(rPos);
@ -150,11 +150,16 @@ public:
}
}
if (pTargetEntry)
if (pTargetEntry && bHighLightTarget)
ImplShowTargetEmphasis(pTargetEntry, true);
return pTargetEntry;
}
virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
{
return GetTargetAtPoint(rPos, true);
}
virtual bool EditingEntry(SvTreeListEntry* pEntry, Selection&) override
{
return m_aEditingEntryHdl.Call(pEntry);

View file

@ -4502,9 +4502,10 @@ public:
SvTabListBox& getTreeView() { return *m_xTreeView; }
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) override
virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bHighLightTarget) override
{
SvTreeListEntry* pTarget = m_xTreeView->GetDropTarget(rPos);
LclTabListBox* pTreeView = !bHighLightTarget ? dynamic_cast<LclTabListBox*>(m_xTreeView.get()) : nullptr;
SvTreeListEntry* pTarget = pTreeView ? pTreeView->GetTargetAtPoint(rPos, false) : m_xTreeView->GetDropTarget(rPos);
if (pTarget && pResult)
{

View file

@ -11134,7 +11134,7 @@ public:
weld::TreeView::connect_popup_menu(rLink);
}
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult) override
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter* pResult, bool bHighLightTarget) override
{
const bool bAsTree = gtk_tree_view_get_enable_tree_lines(m_pTreeView);
@ -11184,7 +11184,7 @@ public:
gtk_tree_model_get_iter(pModel, &rGtkIter.iter, path);
}
if (m_bInDrag)
if (m_bInDrag && bHighLightTarget) // bHighLightTarget alone might be sufficient
{
// highlight the row
gtk_tree_view_set_drag_dest_row(m_pTreeView, path, pos);