[Libreoffice-commits] core.git: vcl/inc vcl/source
Noel Grandin
noel at peralex.com
Wed May 11 06:53:14 UTC 2016
vcl/inc/brdwin.hxx | 44 +++++++++++++++++++------------------------
vcl/source/window/brdwin.cxx | 34 ++++++++++++++++-----------------
2 files changed, 37 insertions(+), 41 deletions(-)
New commits:
commit eff219140f5dc81424b3281438dc5ed0a9dd6a9a
Author: Noel Grandin <noel at peralex.com>
Date: Tue May 10 13:13:23 2016 +0200
Convert BORDERWINDOW_DRAW to scoped enum
Change-Id: I25d8c8921445749be05974af5c00e9fde82382a3
Reviewed-on: https://gerrit.libreoffice.org/24837
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index 2a00923..ccab7c8 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -52,26 +52,22 @@ enum class DrawButtonFlags;
#define BORDERWINDOW_HITTEST_HELP ((sal_uInt16)0x4000)
#define BORDERWINDOW_HITTEST_PIN ((sal_uInt16)0x8000)
-#define BORDERWINDOW_DRAW_TITLE ((sal_uInt16)0x0001)
-#define BORDERWINDOW_DRAW_BORDER ((sal_uInt16)0x0002)
-#define BORDERWINDOW_DRAW_FRAME ((sal_uInt16)0x0004)
-#define BORDERWINDOW_DRAW_CLOSE ((sal_uInt16)0x0008)
-#define BORDERWINDOW_DRAW_ROLL ((sal_uInt16)0x0010)
-#define BORDERWINDOW_DRAW_DOCK ((sal_uInt16)0x0020)
-#define BORDERWINDOW_DRAW_HIDE ((sal_uInt16)0x0040)
-#define BORDERWINDOW_DRAW_HELP ((sal_uInt16)0x0080)
-#define BORDERWINDOW_DRAW_PIN ((sal_uInt16)0x0100)
-#define BORDERWINDOW_DRAW_MENU ((sal_uInt16)0x0200)
-#define BORDERWINDOW_DRAW_ALL (BORDERWINDOW_DRAW_TITLE | \
- BORDERWINDOW_DRAW_BORDER | \
- BORDERWINDOW_DRAW_FRAME | \
- BORDERWINDOW_DRAW_CLOSE | \
- BORDERWINDOW_DRAW_ROLL | \
- BORDERWINDOW_DRAW_DOCK | \
- BORDERWINDOW_DRAW_HIDE | \
- BORDERWINDOW_DRAW_HELP | \
- BORDERWINDOW_DRAW_PIN | \
- BORDERWINDOW_DRAW_MENU)
+enum class BorderWindowDraw {
+ Title = 0x0001,
+ Border = 0x0002,
+ Frame = 0x0004,
+ Close = 0x0008,
+ Roll = 0x0010,
+ Dock = 0x0020,
+ Hide = 0x0040,
+ Help = 0x0080,
+ Pin = 0x0100,
+ Menu = 0x0200,
+ All = Title | Border | Frame | Close | Roll | Dock | Hide | Help | Pin | Menu
+};
+namespace o3tl {
+ template<> struct typed_flags<BorderWindowDraw> : is_typed_flags<BorderWindowDraw, 0x03ff> {};
+};
enum class BorderWindowTitleType {
Normal = 0x0001,
@@ -239,7 +235,7 @@ public:
virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0;
virtual long CalcTitleWidth() const = 0;
- virtual void DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point* pOffset = nullptr) = 0;
+ virtual void DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset = nullptr) = 0;
virtual Rectangle GetMenuRect() const;
static void ImplInitTitle( ImplBorderFrameData* pData );
@@ -258,7 +254,7 @@ public:
virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
virtual long CalcTitleWidth() const override;
- virtual void DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point* pOffset) override;
+ virtual void DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset) override;
};
class ImplSmallBorderWindowView : public ImplBorderWindowView
@@ -280,7 +276,7 @@ public:
virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
virtual long CalcTitleWidth() const override;
- virtual void DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point* pOffset) override;
+ virtual void DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset) override;
};
class ImplStdBorderWindowView : public ImplBorderWindowView
@@ -303,7 +299,7 @@ public:
virtual void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const override;
virtual long CalcTitleWidth() const override;
- virtual void DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point* pOffset) override;
+ virtual void DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset) override;
};
#endif // INCLUDED_VCL_INC_BRDWIN_HXX
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 6a4fa7c..a7d75bc 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -432,7 +432,7 @@ long ImplNoBorderWindowView::CalcTitleWidth() const
return 0;
}
-void ImplNoBorderWindowView::DrawWindow(vcl::RenderContext&, sal_uInt16, const Point*)
+void ImplNoBorderWindowView::DrawWindow(vcl::RenderContext&, BorderWindowDraw, const Point*)
{
}
@@ -626,7 +626,7 @@ long ImplSmallBorderWindowView::CalcTitleWidth() const
return 0;
}
-void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point*)
+void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point*)
{
WindowBorderStyle nBorderStyle = mpBorderWindow->GetBorderStyle();
if (nBorderStyle & WindowBorderStyle::NOBORDER)
@@ -759,7 +759,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, s
if (bNativeOK)
return;
- if (nDrawFlags & BORDERWINDOW_DRAW_FRAME)
+ if (nDrawFlags & BorderWindowDraw::Frame)
{
DrawFrameStyle nStyle = DrawFrameStyle::NONE;
DrawFrameFlags nFlags = DrawFrameFlags::NONE;
@@ -894,7 +894,7 @@ bool ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
{
bTracking = false;
- if ( (maFrameData.mnHitTest & BORDERWINDOW_DRAW_TITLE) &&
+ if ( (maFrameData.mnHitTest & BORDERWINDOW_HITTEST_TITLE) &&
((rMEvt.GetClicks() % 2) == 0) )
{
maFrameData.mnHitTest = 0;
@@ -1527,7 +1527,7 @@ long ImplStdBorderWindowView::CalcTitleWidth() const
return ImplCalcTitleWidth( &maFrameData );
}
-void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags, const Point* pOffset)
+void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset)
{
ImplBorderFrameData* pData = &maFrameData;
ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
@@ -1541,7 +1541,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aFrameColor.DecreaseContrast(sal_uInt8(0.5 * 255));
// Draw Frame
- if (nDrawFlags & BORDERWINDOW_DRAW_FRAME)
+ if (nDrawFlags & BorderWindowDraw::Frame)
{
vcl::Region oldClipRgn(rRenderContext.GetClipRegion());
@@ -1581,7 +1581,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
// Draw Border
rRenderContext.SetLineColor();
long nBorderSize = pData->mnBorderSize;
- if ((nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize)
+ if ((nDrawFlags & BorderWindowDraw::Border) && nBorderSize)
{
rRenderContext.SetFillColor(rStyleSettings.GetFaceColor());
rRenderContext.DrawRect(Rectangle(Point(aInRect.Left(), aInRect.Top()),
@@ -1595,7 +1595,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
}
// Draw Title
- if ((nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty())
+ if ((nDrawFlags & BorderWindowDraw::Title) && !pData->maTitleRect.IsEmpty())
{
aInRect = pData->maTitleRect;
@@ -1646,7 +1646,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
}
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Close) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maCloseRect.IsEmpty())
{
Rectangle aSymbolRect(pData->maCloseRect);
@@ -1654,7 +1654,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aSymbolRect.Move(pOffset->X(), pOffset->Y());
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::CLOSE, pData->mnCloseState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Dock) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maDockRect.IsEmpty())
{
Rectangle aSymbolRect(pData->maDockRect);
@@ -1662,7 +1662,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aSymbolRect.Move(pOffset->X(), pOffset->Y());
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::DOCK, pData->mnDockState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_MENU) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Menu) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maMenuRect.IsEmpty())
{
Rectangle aSymbolRect(pData->maMenuRect);
@@ -1670,7 +1670,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aSymbolRect.Move(pOffset->X(), pOffset->Y());
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::MENU, pData->mnMenuState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Hide) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maHideRect.IsEmpty())
{
Rectangle aSymbolRect(pData->maHideRect);
@@ -1678,7 +1678,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aSymbolRect.Move(pOffset->X(), pOffset->Y());
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HIDE, pData->mnHideState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Roll) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maRollRect.IsEmpty())
{
SymbolType eType;
@@ -1692,7 +1692,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, eType, pData->mnRollState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Help) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maHelpRect.IsEmpty())
{
Rectangle aSymbolRect(pData->maHelpRect);
@@ -1700,7 +1700,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, sal
aSymbolRect.Move(pOffset->X(), pOffset->Y());
ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HELP, pData->mnHelpState);
}
- if (((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE))
+ if (((nDrawFlags & BorderWindowDraw::Pin) || (nDrawFlags & BorderWindowDraw::Title))
&& !pData->maPinRect.IsEmpty())
{
Image aImage;
@@ -1857,13 +1857,13 @@ void ImplBorderWindow::Tracking( const TrackingEvent& rTEvt )
void ImplBorderWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& )
{
if (mpBorderView)
- mpBorderView->DrawWindow(rRenderContext, BORDERWINDOW_DRAW_ALL);
+ mpBorderView->DrawWindow(rRenderContext, BorderWindowDraw::All);
}
void ImplBorderWindow::Draw( const Rectangle&, OutputDevice* pOutDev, const Point& rPos )
{
if (mpBorderView)
- mpBorderView->DrawWindow(*pOutDev, BORDERWINDOW_DRAW_ALL, &rPos);
+ mpBorderView->DrawWindow(*pOutDev, BorderWindowDraw::All, &rPos);
}
void ImplBorderWindow::Activate()
More information about the Libreoffice-commits
mailing list