sfx2/source/sidebar/TabBar.cxx | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
New commits: commit 8c5e922d66d154405029380374f088cee6578056 Author: Bjoern Michaelsen <bjoern.michael...@canonical.com> Date: Wed Oct 28 01:58:43 2015 +0100 handle scrollwheel events in TabBar of Sidebar - using the scrollwheel in the TabBar used to scroll the document: - even though the deck next to it handles scroll event on its own - thus there are two areas that arent even touching (separated by the deck) scrolling the same area - instead, now we capture mousewheel scrolls and switch through the decks of the sidebar. This should also severely simplify navigating them. Change-Id: Ie2136f4ec67dedf72ff6b56d16356f6a12de74ea diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index f7fd362..a4100ce 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -253,8 +253,41 @@ void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent) Window::DataChanged(rDataChangedEvent); } -bool TabBar::Notify (NotifyEvent&) +bool TabBar::Notify (NotifyEvent& rEvent) { + if(rEvent.GetType() == MouseNotifyEvent::COMMAND) + { + const CommandEvent& rCommandEvent = *rEvent.GetCommandEvent(); + if(rCommandEvent.GetCommand() == CommandEventId::Wheel) + { + const CommandWheelData* pData = rCommandEvent.GetWheelData(); + if(!pData->GetModifier() && (pData->GetMode() == CommandWheelMode::SCROLL)) + { + auto pItem = std::find_if(maItems.begin(), maItems.end(), + [] (Item const& rItem) { return rItem.mpButton->IsChecked(); }); + if(pItem == maItems.end()) + return true; + if(pData->GetNotchDelta()<0) + { + if(pItem+1 == maItems.end()) + return true; + ++pItem; + } + else + { + if(pItem == maItems.begin()) + return true; + --pItem; + } + try + { + pItem->maDeckActivationFunctor(pItem->msDeckId); + } + catch(const css::uno::Exception&) {}; + return true; + } + } + } return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits