diff options
author | Andre Fischer <af@apache.org> | 2013-05-08 07:21:37 +0000 |
---|---|---|
committer | Andre Fischer <af@apache.org> | 2013-05-08 07:21:37 +0000 |
commit | db9602cbf627e1a7af56f3a419ec7c7445dcfb85 (patch) | |
tree | 31d3bb8e4e42f813f6a48e377190a3546811bc1c | |
parent | 0fabc9a7be629ca150e83b5b69dc5e44b4b2a476 (diff) |
122254: Process mouse wheel events over sidebar scroll bar.
Notes
Notes:
merged as: 77c85da8b7cbad2e2904af81554d65afcd868a23
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 52 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.hxx | 1 |
2 files changed, 52 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 59946f640680..eb620587be57 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -220,6 +220,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; @@ -276,7 +326,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. @@ -419,4 +468,5 @@ void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& maSeparators = rSeparators; } + } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx index 33cb09a602f8..89f5e4bd9da6 100644 --- a/sfx2/source/sidebar/Deck.hxx +++ b/sfx2/source/sidebar/Deck.hxx @@ -73,6 +73,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); |