summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-10-28 01:58:43 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-10-28 02:11:58 +0100
commit8c5e922d66d154405029380374f088cee6578056 (patch)
treee1bf8d288f4ed637cffeb31d1f021075aa760ee0 /sfx2
parent048bc383f1d2c15f690364d0001045cdf7090f6f (diff)
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
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/TabBar.cxx35
1 files changed, 34 insertions, 1 deletions
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;
}