diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-10 13:26:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-05-11 09:03:13 +0200 |
commit | 3e5a01617e14e9cbd6c4ab79dac1cbbd9ac3f4c1 (patch) | |
tree | 874d3873d78368e299f8ac4b1a784ac8237a62d6 /vcl | |
parent | 28d200d4140271f212240dd6e867ee0fbffa3dad (diff) |
Convert BORDERWINDOW_STYLE to scoped enum
Change-Id: Idbd538c69ebb40a319decc1e3a9cf06c99eb6423
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/brdwin.hxx | 24 | ||||
-rw-r--r-- | vcl/source/window/brdwin.cxx | 18 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/floatwin.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/wrkwin.cxx | 4 |
6 files changed, 37 insertions, 31 deletions
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index 9b9fc6e26142..49c60c9ba190 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -29,11 +29,17 @@ class ImplBorderWindowView; enum class DrawButtonFlags; -#define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001) -#define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002) -#define BORDERWINDOW_STYLE_FLOAT ((sal_uInt16)0x0004) -#define BORDERWINDOW_STYLE_FRAME ((sal_uInt16)0x0008) -#define BORDERWINDOW_STYLE_APP ((sal_uInt16)0x0010) +enum class BorderWindowStyle { + NONE = 0x0000, + Overlap = 0x0001, + Border = 0x0002, + Float = 0x0004, + Frame = 0x0008, + App = 0x0010 +}; +namespace o3tl { + template<> struct typed_flags<BorderWindowStyle> : is_typed_flags<BorderWindowStyle, 0x001f> {}; +}; enum class BorderWindowHitTest { NONE = 0x0000, @@ -118,10 +124,10 @@ private: using Window::ImplInit; void ImplInit( vcl::Window* pParent, - WinBits nStyle, sal_uInt16 nTypeStyle, + WinBits nStyle, BorderWindowStyle nTypeStyle, SystemParentData* pParentData ); void ImplInit( vcl::Window* pParent, - WinBits nStyle, sal_uInt16 nTypeStyle, + WinBits nStyle, BorderWindowStyle nTypeStyle, const css::uno::Any& ); ImplBorderWindow (const ImplBorderWindow &) = delete; @@ -131,9 +137,9 @@ public: ImplBorderWindow( vcl::Window* pParent, SystemParentData* pParentData, WinBits nStyle = 0, - sal_uInt16 nTypeStyle = 0 ); + BorderWindowStyle nTypeStyle = BorderWindowStyle::NONE ); ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0, - sal_uInt16 nTypeStyle = 0 ); + BorderWindowStyle nTypeStyle = BorderWindowStyle::NONE ); virtual ~ImplBorderWindow(); virtual void dispose() override; diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 278963e00f51..006b3753b15b 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1723,27 +1723,27 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor } void ImplBorderWindow::ImplInit( vcl::Window* pParent, - WinBits nStyle, sal_uInt16 nTypeStyle, + WinBits nStyle, BorderWindowStyle nTypeStyle, const css::uno::Any& ) { ImplInit( pParent, nStyle, nTypeStyle, nullptr ); } void ImplBorderWindow::ImplInit( vcl::Window* pParent, - WinBits nStyle, sal_uInt16 nTypeStyle, + WinBits nStyle, BorderWindowStyle nTypeStyle, SystemParentData* pSystemParentData ) { // remove all unwanted WindowBits WinBits nOrgStyle = nStyle; WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_POPUP); - if ( nTypeStyle & BORDERWINDOW_STYLE_APP ) + if ( nTypeStyle & BorderWindowStyle::App ) nTestStyle |= WB_APP; nStyle &= nTestStyle; mpWindowImpl->mbBorderWin = true; mbSmallOutBorder = false; - if ( nTypeStyle & BORDERWINDOW_STYLE_FRAME ) + if ( nTypeStyle & BorderWindowStyle::Frame ) { if( (nStyle & WB_SYSTEMCHILDWINDOW) ) { @@ -1767,7 +1767,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, mbSmallOutBorder = true; } } - else if ( nTypeStyle & BORDERWINDOW_STYLE_OVERLAP ) + else if ( nTypeStyle & BorderWindowStyle::Overlap ) { mpWindowImpl->mbOverlapWin = true; mbFrameBorder = true; @@ -1775,7 +1775,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, else mbFrameBorder = false; - if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) + if ( nTypeStyle & BorderWindowStyle::Float ) mbFloatWindow = true; else mbFloatWindow = false; @@ -1799,7 +1799,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, mbHideBtn = false; mbDisplayActive = IsActive(); - if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) + if ( nTypeStyle & BorderWindowStyle::Float ) mnTitleType = BorderWindowTitleType::Small; else mnTitleType = BorderWindowTitleType::Normal; @@ -1809,14 +1809,14 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, SystemParentData* pSystemParentData, - WinBits nStyle, sal_uInt16 nTypeStyle + WinBits nStyle, BorderWindowStyle nTypeStyle ) : Window( WINDOW_BORDERWINDOW ) { ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData ); } ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle , - sal_uInt16 nTypeStyle ) : + BorderWindowStyle nTypeStyle ) : Window( WINDOW_BORDERWINDOW ) { ImplInit( pParent, nStyle, nTypeStyle, css::uno::Any() ); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index e0fbd7e88bdd..c90d72a256ef 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -413,7 +413,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) // create window with a small border ? if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER ) { - VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_FRAME ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Frame ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); @@ -431,7 +431,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) } else { - VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Overlap | BorderWindowStyle::Border ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); @@ -1112,7 +1112,7 @@ void Dialog::GrabFocusToFirstControl() void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const { - ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); + ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap ); aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); } @@ -1139,7 +1139,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dra if (!( GetStyle() & WB_NOBORDER )) { - ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); + ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap ); aImplWin->SetText( GetText() ); aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() ); aImplWin->SetDisplayActive( true ); diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 1a6107b08774..024d726da3f6 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -97,16 +97,16 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) else { VclPtr<ImplBorderWindow> pBorderWin; - sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT; + BorderWindowStyle nBorderStyle = BorderWindowStyle::Border | BorderWindowStyle::Float; if (nStyle & WB_OWNERDRAWDECORATION) - nBorderStyle |= BORDERWINDOW_STYLE_FRAME; + nBorderStyle |= BorderWindowStyle::Frame; else - nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP; + nBorderStyle |= BorderWindowStyle::Overlap; if ((nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE))) { - nBorderStyle |= BORDERWINDOW_STYLE_FRAME; + nBorderStyle |= BorderWindowStyle::Frame; nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable } pBorderWin = VclPtr<ImplBorderWindow>::Create(pParent, nStyle, nBorderStyle); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 4575b22c7b58..7e8ee3a6c587 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -903,14 +903,14 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) ) { - sal_uInt16 nBorderTypeStyle = 0; + BorderWindowStyle nBorderTypeStyle = BorderWindowStyle::NONE; if( (nStyle & WB_SYSTEMCHILDWINDOW) ) { // handle WB_SYSTEMCHILDWINDOW // these should be analogous to a top level frame; meaning they - // should have a border window with style BORDERWINDOW_STYLE_FRAME + // should have a border window with style BorderWindowStyle::Frame // which controls their size - nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; + nBorderTypeStyle |= BorderWindowStyle::Frame; nStyle |= WB_BORDER; } VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL), nBorderTypeStyle ); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 20470a00c4bc..ecd580f73a72 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -45,9 +45,9 @@ void WorkWindow::ImplInitWorkWindowData() void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ) { - sal_uInt16 nFrameStyle = BORDERWINDOW_STYLE_FRAME; + BorderWindowStyle nFrameStyle = BorderWindowStyle::Frame; if ( nStyle & WB_APP ) - nFrameStyle |= BORDERWINDOW_STYLE_APP; + nFrameStyle |= BorderWindowStyle::App; VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, pSystemParentData, nStyle, nFrameStyle ); Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL | WB_SYSTEMFLOATWIN), nullptr ); |