diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-13 20:13:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-13 20:14:24 +0100 |
commit | f4bfce94abc10fbd2d8b37113e27b36c1e79fc61 (patch) | |
tree | 87f31b265a76abed74c917a9c8cf9cf324c9205c /svtools | |
parent | d90fa3890d18ca554ec48cb78fcc7bf410dabb85 (diff) |
select sheet menu as a right-click popup to the prev/next sheet dingus
Change-Id: Ifc9baeabedeab526d040220e9e45f171b5353bcf
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/tabbar.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 4152f9d01764..c0b8059e8d1c 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -100,13 +100,33 @@ class ImplTabButton : public PushButton { public: ImplTabButton( TabBar* pParent, WinBits nWinStyle = 0 ) : - PushButton( pParent, nWinStyle | WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOLIGHTBORDER | WB_NOPOINTERFOCUS ) {} + PushButton( pParent, nWinStyle | WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOLIGHTBORDER | WB_NOPOINTERFOCUS ) {} TabBar* GetParent() const { return (TabBar*)Window::GetParent(); } virtual long PreNotify( NotifyEvent& rNEvt ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + + virtual void Command( const CommandEvent& rCEvt ); }; +void ImplTabButton::MouseButtonDown( const MouseEvent& rMEvt ) +{ + PushButton::MouseButtonDown(rMEvt); +} + +void ImplTabButton::Command( const CommandEvent& rCEvt ) +{ + sal_uInt16 nCmd = rCEvt.GetCommand(); + if ( nCmd == COMMAND_CONTEXTMENU ) + { + TabBar *pParent = GetParent(); + pParent->maScrollAreaContextHdl.Call((void*)&rCEvt); + } + PushButton::Command(rCEvt); +} + // ======================================================================= long ImplTabButton::PreNotify( NotifyEvent& rNEvt ) @@ -398,6 +418,8 @@ void TabBar::ImplInit( WinBits nWinStyle ) mbSelColor = sal_False; mbSelTextColor = sal_False; mbMirrored = sal_False; + mbMirrored = sal_False; + mbScrollAlwaysEnabled = false; if ( nWinStyle & WB_3DTAB ) mnOffY++; @@ -752,19 +774,25 @@ void TabBar::ImplEnableControls() return; // Buttons enablen/disblen - sal_Bool bEnableBtn = mnFirstPos > 0; + sal_Bool bEnableBtn = mbScrollAlwaysEnabled || mnFirstPos > 0; if ( mpFirstBtn ) mpFirstBtn->Enable( bEnableBtn ); if ( mpPrevBtn ) mpPrevBtn->Enable( bEnableBtn ); - bEnableBtn = mnFirstPos < ImplGetLastFirstPos(); + bEnableBtn = mbScrollAlwaysEnabled || mnFirstPos < ImplGetLastFirstPos(); if ( mpNextBtn ) mpNextBtn->Enable( bEnableBtn ); if ( mpLastBtn ) mpLastBtn->Enable( bEnableBtn ); } +void TabBar::SetScrollAlwaysEnabled(bool bScrollAlwaysEnabled) +{ + mbScrollAlwaysEnabled = bScrollAlwaysEnabled; + ImplEnableControls(); +} + // ----------------------------------------------------------------------- void TabBar::ImplShowPage( sal_uInt16 nPos ) |