summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svtools/tabbar.hxx1
-rw-r--r--svtools/source/control/tabbar.cxx26
2 files changed, 26 insertions, 1 deletions
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 87cdb9b3ea07..1fb7efb85831 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -400,6 +400,7 @@ public:
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
+ virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void Select();
virtual void DoubleClick();
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 217174cc960e..c3a983e01fb1 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1519,7 +1519,31 @@ void TabBar::Resize()
ImplEnableControls();
}
-
+bool TabBar::PreNotify( NotifyEvent& rNEvt )
+{
+ if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
+ {
+ if (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL)
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ sal_uInt16 nNewPos = mnFirstPos;
+ if (pData->GetNotchDelta() > 0)
+ {
+ if (mnFirstPos)
+ nNewPos = mnFirstPos - 1;
+ }
+ else if (pData->GetNotchDelta() < 0)
+ {
+ sal_uInt16 nCount = GetPageCount();
+ if (mnFirstPos < nCount)
+ nNewPos = mnFirstPos + 1;
+ }
+ if (nNewPos != mnFirstPos)
+ SetFirstPageId(GetPageId(nNewPos));
+ }
+ }
+ return Window::PreNotify( rNEvt );
+}
void TabBar::RequestHelp( const HelpEvent& rHEvt )
{