From 8c5e922d66d154405029380374f088cee6578056 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Wed, 28 Oct 2015 01:58:43 +0100 Subject: 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 --- sfx2/source/sidebar/TabBar.cxx | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index f7fd36207686..a4100cebef04 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; } -- cgit