[Libreoffice-commits] core.git: 3 commits - include/svtools include/vcl svtools/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu Mar 5 19:00:45 PST 2015
include/svtools/tabbar.hxx | 1
include/vcl/decoview.hxx | 4 +-
svtools/source/control/tabbar.cxx | 58 ++++++++++++++++++--------------------
vcl/source/window/decoview.cxx | 47 ++++++++++++++++++++++++++++++
4 files changed, 77 insertions(+), 33 deletions(-)
New commits:
commit cda4c8edc21a92422e3479909d8082cddf16bcae
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Mar 5 21:43:15 2015 +0900
use DrawHandle for drawing of tab sizer in tabbar
Change-Id: I3aacb177d209db74ffadf5284550cdd4972554de
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index c3a983e..216e27f 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -155,12 +155,6 @@ bool ImplTabButton::PreNotify(NotifyEvent& rNotifyEvent)
return PushButton::PreNotify(rNotifyEvent);
}
-
-
-
-// - ImplTabSizer -
-
-
class ImplTabSizer : public vcl::Window
{
public:
@@ -179,8 +173,6 @@ private:
long mnStartWidth;
};
-
-
ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
: Window( pParent, nWinStyle & WB_3DLOOK )
, mnStartWidth(0)
@@ -190,8 +182,6 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
SetSizePixel(Size(7 * nScaleFactor, 0));
}
-
-
void ImplTabSizer::ImplTrack( const Point& rScreenPos )
{
TabBar* pParent = GetParent();
@@ -203,8 +193,6 @@ void ImplTabSizer::ImplTrack( const Point& rScreenPos )
pParent->Update();
}
-
-
void ImplTabSizer::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( GetParent()->IsInEditMode() )
@@ -221,8 +209,6 @@ void ImplTabSizer::MouseButtonDown( const MouseEvent& rMEvt )
}
}
-
-
void ImplTabSizer::Tracking( const TrackingEvent& rTEvt )
{
if ( rTEvt.IsTrackingEnded() )
@@ -235,23 +221,11 @@ void ImplTabSizer::Tracking( const TrackingEvent& rTEvt )
ImplTrack( OutputToScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
}
-
-
void ImplTabSizer::Paint( const Rectangle& )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- DecorationView aDecoView( this );
- long nOffX = 0;
- Size aOutputSize = GetOutputSizePixel();
-
- if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
- {
- SetLineColor( rStyleSettings.GetDarkShadowColor() );
- DrawLine( Point( 0, 0 ), Point( 0, aOutputSize.Height()-1 ) );
- nOffX++;
- aOutputSize.Width()--;
- }
- aDecoView.DrawButton( Rectangle( Point( nOffX, 0 ), aOutputSize ), BUTTON_DRAW_NOLIGHTBORDER );
+ DecorationView aDecoView(this);
+ Rectangle aOutputRect(Point(0, 0), GetOutputSizePixel());
+ aDecoView.DrawHandle(aOutputRect, true);
}
commit b2f76e0e8a81b456f47b677cd881cc105f781cdb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Mar 5 21:41:58 2015 +0900
add DrawHandle to DecorationView
Change-Id: Ie063071cc57d756fd5da20a15533a6857940f676
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index 8cff366..4094f69 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -73,8 +73,7 @@ private:
OutputDevice* mpOutDev;
public:
- DecorationView( OutputDevice* pOutDev )
- { mpOutDev = pOutDev; }
+ DecorationView(OutputDevice* pOutDev);
void DrawSymbol( const Rectangle& rRect, SymbolType eType,
const Color& rColor, sal_uInt16 nStyle = 0 );
@@ -86,6 +85,7 @@ public:
Rectangle DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle = FRAME_DRAW_OUT );
Rectangle DrawButton( const Rectangle& rRect, sal_uInt16 nStyle );
void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true );
+ void DrawHandle(const Rectangle& rRectangle, bool bVertical = true);
};
#endif // INCLUDED_VCL_DECOVIEW_HXX
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 6796a07..8545e87 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -822,7 +822,11 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
}
}
-}
+} // end anonymous namespace
+
+DecorationView::DecorationView(OutputDevice* pOutDev) :
+ mpOutDev(pOutDev)
+{}
void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType,
const Color& rColor, sal_uInt16 nStyle )
@@ -1081,4 +1085,45 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
mpOutDev->Pop();
}
+void DecorationView::DrawHandle(const Rectangle& rRect, bool bVertical)
+{
+ const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+
+ Size aOutputSize = rRect.GetSize();
+
+ mpOutDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
+ mpOutDev->SetFillColor(rStyleSettings.GetDarkShadowColor());
+
+ sal_Int32 nNumberOfPoints = 3;
+
+ long nHalfWidth = aOutputSize.Width() / 2.0f;
+ long nHalfHeight = aOutputSize.Height() / 2.0f;
+
+ float fDistance = bVertical ? aOutputSize.Height() : aOutputSize.Width();
+ fDistance /= (nNumberOfPoints + 1);
+
+ long nRadius = bVertical ? aOutputSize.Width() : aOutputSize.Height();
+ nRadius /= (nNumberOfPoints + 2);
+
+ for (long i = 1; i <= nNumberOfPoints; i++)
+ {
+ Rectangle aLocation;
+ if (bVertical)
+ {
+ aLocation = Rectangle(nHalfWidth - nRadius,
+ std::round(fDistance * i) - nRadius,
+ nHalfWidth + nRadius,
+ std::round(fDistance * i) + nRadius);
+ }
+ else
+ {
+ aLocation = Rectangle(std::round(fDistance * i) - nRadius,
+ nHalfHeight - nRadius,
+ std::round(fDistance * i) + nRadius,
+ nHalfHeight + nRadius);
+ }
+ mpOutDev->DrawEllipse(aLocation);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 19dc7225603284184e04190ed6b6926e5e5a196a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Mar 5 19:36:39 2015 +0900
tabbar: scroll tabs with wheel
Change-Id: I9d7d1e16c34eac75652a1275b6e4ac3f7973cb56
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 87cdb9b..1fb7efb 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 217174c..c3a983e 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 )
{
More information about the Libreoffice-commits
mailing list