Kaydet (Commit) 5e8a2c64 authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Michael Meeks

Resolves: #i122254# Process mouse wheel events over sidebar scroll bar

(cherry picked from commit db9602cb)

Change-Id: I272763eb24e58443d8c8a980eca9b0f654a9e899
üst d35884ef
......@@ -215,6 +215,56 @@ void Deck::DataChanged (const DataChangedEvent& rEvent)
long Deck::Notify (NotifyEvent& rEvent)
{
if (rEvent.GetType() != EVENT_COMMAND)
return sal_False;
CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData());
if (pCommandEvent == NULL)
return sal_False;
switch (pCommandEvent->GetCommand())
{
case COMMAND_WHEEL:
{
if ( ! mpVerticalScrollBar
|| ! mpVerticalScrollBar->IsVisible())
return sal_False;
// Ignore all wheel commands from outside the vertical
// scroll bar. Otherwise after a scroll we might land on
// a spin field and subsequent wheel events would change
// the value of that control.
if (rEvent.GetWindow() != mpVerticalScrollBar.get())
return sal_True;
// Get the wheel data and check that it describes a valid
// vertical scroll.
const CommandWheelData* pData = pCommandEvent->GetWheelData();
if (pData==NULL
|| pData->GetModifier()
|| pData->GetMode() != COMMAND_WHEEL_SCROLL
|| pData->IsHorz())
return sal_False;
// Execute the actual scroll action.
long nDelta = pData->GetDelta();
mpVerticalScrollBar->DoScroll(
mpVerticalScrollBar->GetThumbPos() - nDelta);
return sal_True;
}
default:
break;
}
return sal_False;
}
void Deck::SetPanels (const SharedPanelContainer& rPanels)
{
maPanels = rPanels;
......@@ -271,7 +321,6 @@ void Deck::ShowPanel (const Panel& rPanel)
if (rPanel.GetTitleBar() != NULL && rPanel.GetTitleBar()->IsVisible())
nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
// Determine what the new thumb position should be like.
// When the whole panel does not fit then make its top visible
// and it off at the bottom.
......@@ -414,4 +463,5 @@ void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>&
maSeparators = rSeparators;
}
} } // end of namespace sfx2::sidebar
......@@ -69,6 +69,7 @@ public:
virtual void Paint (const Rectangle& rUpdateArea);
virtual void DataChanged (const DataChangedEvent& rEvent);
virtual long Notify (NotifyEvent& rEvent);
void PrintWindowTree (void);
void PrintWindowTree (const ::std::vector<Panel*>& rPanels);
......
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