summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-05 19:36:39 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-03-06 11:57:02 +0900
commit19dc7225603284184e04190ed6b6926e5e5a196a (patch)
tree44dad16b154a4022f15cf32ff8ad4ea0928aa9a0
parentd59ba6ac9f837f398ee0a212bb2cc612a8a2f20c (diff)
tabbar: scroll tabs with wheel
Change-Id: I9d7d1e16c34eac75652a1275b6e4ac3f7973cb56
-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 )
{