Kaydet (Commit) 8c5e922d authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

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
üst 048bc383
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment