diff options
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/brdwin.cxx | 135 | ||||
-rw-r--r-- | vcl/source/window/popupmenuwindow.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/seleng.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 21 |
4 files changed, 67 insertions, 98 deletions
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index a17f085140be..842fe831cf65 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&, BorderWindowDraw, const Point*) +void ImplNoBorderWindowView::DrawWindow(vcl::RenderContext&, const Point*) { } @@ -626,7 +626,7 @@ long ImplSmallBorderWindowView::CalcTitleWidth() const return 0; } -void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point*) +void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, const Point*) { WindowBorderStyle nBorderStyle = mpBorderWindow->GetBorderStyle(); if (nBorderStyle & WindowBorderStyle::NOBORDER) @@ -759,30 +759,27 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, B if (bNativeOK) return; - if (nDrawFlags & BorderWindowDraw::Frame) - { - DrawFrameStyle nStyle = DrawFrameStyle::NONE; - DrawFrameFlags nFlags = DrawFrameFlags::NONE; - // move border outside if border was converted or if the border window is a frame window, - if (mpBorderWindow->mbSmallOutBorder) - nStyle = DrawFrameStyle::DoubleOut; - else if (nBorderStyle & WindowBorderStyle::NWF) - nStyle = DrawFrameStyle::NWF; - else - nStyle = DrawFrameStyle::DoubleIn; - if (nBorderStyle & WindowBorderStyle::MONO) - nFlags |= DrawFrameFlags::Mono; - if (nBorderStyle & WindowBorderStyle::MENU) - nFlags |= DrawFrameFlags::Menu; - // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners - if (mpBorderWindow == mpBorderWindow->ImplGetFrameWindow()) - nFlags |= DrawFrameFlags::WindowBorder; - - DecorationView aDecoView(&rRenderContext); - Point aTmpPoint; - Rectangle aInRect(aTmpPoint, Size(mnWidth, mnHeight)); - aDecoView.DrawFrame(aInRect, nStyle, nFlags); - } + DrawFrameStyle nStyle = DrawFrameStyle::NONE; + DrawFrameFlags nFlags = DrawFrameFlags::NONE; + // move border outside if border was converted or if the border window is a frame window, + if (mpBorderWindow->mbSmallOutBorder) + nStyle = DrawFrameStyle::DoubleOut; + else if (nBorderStyle & WindowBorderStyle::NWF) + nStyle = DrawFrameStyle::NWF; + else + nStyle = DrawFrameStyle::DoubleIn; + if (nBorderStyle & WindowBorderStyle::MONO) + nFlags |= DrawFrameFlags::Mono; + if (nBorderStyle & WindowBorderStyle::MENU) + nFlags |= DrawFrameFlags::Menu; + // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners + if (mpBorderWindow == mpBorderWindow->ImplGetFrameWindow()) + nFlags |= DrawFrameFlags::WindowBorder; + + DecorationView aDecoView(&rRenderContext); + Point aTmpPoint; + Rectangle aInRect(aTmpPoint, Size(mnWidth, mnHeight)); + aDecoView.DrawFrame(aInRect, nStyle, nFlags); } @@ -1527,7 +1524,7 @@ long ImplStdBorderWindowView::CalcTitleWidth() const return ImplCalcTitleWidth( &maFrameData ); } -void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, BorderWindowDraw nDrawFlags, const Point* pOffset) +void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset) { ImplBorderFrameData* pData = &maFrameData; ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; @@ -1541,47 +1538,42 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor aFrameColor.DecreaseContrast(sal_uInt8(0.5 * 255)); // Draw Frame - if (nDrawFlags & BorderWindowDraw::Frame) - { - vcl::Region oldClipRgn(rRenderContext.GetClipRegion()); + vcl::Region oldClipRgn(rRenderContext.GetClipRegion()); - // for popups, don't draw part of the frame - if (pData->mnTitleType == BorderWindowTitleType::Popup) + // for popups, don't draw part of the frame + if (pData->mnTitleType == BorderWindowTitleType::Popup) + { + FloatingWindow* pWin = dynamic_cast<FloatingWindow*>(pData->mpBorderWindow->GetWindow(GetWindowType::Client)); + if (pWin) { - FloatingWindow* pWin = dynamic_cast<FloatingWindow*>(pData->mpBorderWindow->GetWindow(GetWindowType::Client)); - if (pWin) + vcl::Region aClipRgn(aInRect); + Rectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect()); + if (!aItemClipRect.IsEmpty()) { - vcl::Region aClipRgn(aInRect); - Rectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect()); - if (!aItemClipRect.IsEmpty()) - { - aItemClipRect.SetPos(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft())); - aClipRgn.Exclude(aItemClipRect); - rRenderContext.SetClipRegion(aClipRgn); - } + aItemClipRect.SetPos(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft())); + aClipRgn.Exclude(aItemClipRect); + rRenderContext.SetClipRegion(aClipRgn); } } - - // single line frame - rRenderContext.SetLineColor(aFrameColor); - rRenderContext.SetFillColor(); - rRenderContext.DrawRect(aInRect); - ++aInRect.Left(); - --aInRect.Right(); - ++aInRect.Top(); - --aInRect.Bottom(); - - // restore - if (pData->mnTitleType == BorderWindowTitleType::Popup) - rRenderContext.SetClipRegion(oldClipRgn); } - else - aInRect = aDecoView.DrawFrame(aInRect, DrawFrameStyle::DoubleOut, DrawFrameFlags::NoDraw); + + // single line frame + rRenderContext.SetLineColor(aFrameColor); + rRenderContext.SetFillColor(); + rRenderContext.DrawRect(aInRect); + ++aInRect.Left(); + --aInRect.Right(); + ++aInRect.Top(); + --aInRect.Bottom(); + + // restore + if (pData->mnTitleType == BorderWindowTitleType::Popup) + rRenderContext.SetClipRegion(oldClipRgn); // Draw Border rRenderContext.SetLineColor(); long nBorderSize = pData->mnBorderSize; - if ((nDrawFlags & BorderWindowDraw::Border) && nBorderSize) + if (nBorderSize) { rRenderContext.SetFillColor(rStyleSettings.GetFaceColor()); rRenderContext.DrawRect(Rectangle(Point(aInRect.Left(), aInRect.Top()), @@ -1595,7 +1587,7 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor } // Draw Title - if ((nDrawFlags & BorderWindowDraw::Title) && !pData->maTitleRect.IsEmpty()) + if (!pData->maTitleRect.IsEmpty()) { aInRect = pData->maTitleRect; @@ -1646,40 +1638,35 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor } } - if (((nDrawFlags & BorderWindowDraw::Close) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maCloseRect.IsEmpty()) + if (!pData->maCloseRect.IsEmpty()) { Rectangle aSymbolRect(pData->maCloseRect); if (pOffset) aSymbolRect.Move(pOffset->X(), pOffset->Y()); ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::CLOSE, pData->mnCloseState); } - if (((nDrawFlags & BorderWindowDraw::Dock) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maDockRect.IsEmpty()) + if (!pData->maDockRect.IsEmpty()) { Rectangle aSymbolRect(pData->maDockRect); if (pOffset) aSymbolRect.Move(pOffset->X(), pOffset->Y()); ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::DOCK, pData->mnDockState); } - if (((nDrawFlags & BorderWindowDraw::Menu) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maMenuRect.IsEmpty()) + if (!pData->maMenuRect.IsEmpty()) { Rectangle aSymbolRect(pData->maMenuRect); if (pOffset) aSymbolRect.Move(pOffset->X(), pOffset->Y()); ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::MENU, pData->mnMenuState); } - if (((nDrawFlags & BorderWindowDraw::Hide) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maHideRect.IsEmpty()) + if (!pData->maHideRect.IsEmpty()) { Rectangle aSymbolRect(pData->maHideRect); if (pOffset) aSymbolRect.Move(pOffset->X(), pOffset->Y()); ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HIDE, pData->mnHideState); } - if (((nDrawFlags & BorderWindowDraw::Roll) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maRollRect.IsEmpty()) + if (!pData->maRollRect.IsEmpty()) { SymbolType eType; if (pBorderWindow->mbRollUp) @@ -1692,16 +1679,14 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, eType, pData->mnRollState); } - if (((nDrawFlags & BorderWindowDraw::Help) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maHelpRect.IsEmpty()) + if (!pData->maHelpRect.IsEmpty()) { Rectangle aSymbolRect(pData->maHelpRect); if (pOffset) aSymbolRect.Move(pOffset->X(), pOffset->Y()); ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HELP, pData->mnHelpState); } - if (((nDrawFlags & BorderWindowDraw::Pin) || (nDrawFlags & BorderWindowDraw::Title)) - && !pData->maPinRect.IsEmpty()) + if (!pData->maPinRect.IsEmpty()) { Image aImage; ImplGetPinImage(pData->mnPinState, pBorderWindow->mbPinned, aImage); @@ -1857,13 +1842,13 @@ void ImplBorderWindow::Tracking( const TrackingEvent& rTEvt ) void ImplBorderWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) { if (mpBorderView) - mpBorderView->DrawWindow(rRenderContext, BorderWindowDraw::All); + mpBorderView->DrawWindow(rRenderContext); } void ImplBorderWindow::Draw( const Rectangle&, OutputDevice* pOutDev, const Point& rPos ) { if (mpBorderView) - mpBorderView->DrawWindow(*pOutDev, BorderWindowDraw::All, &rPos); + mpBorderView->DrawWindow(*pOutDev, &rPos); } void ImplBorderWindow::Activate() diff --git a/vcl/source/window/popupmenuwindow.cxx b/vcl/source/window/popupmenuwindow.cxx index e9388732ae6c..310d7550b202 100644 --- a/vcl/source/window/popupmenuwindow.cxx +++ b/vcl/source/window/popupmenuwindow.cxx @@ -38,8 +38,8 @@ PopupMenuFloatingWindow::ImplData::~ImplData() { } -PopupMenuFloatingWindow::PopupMenuFloatingWindow( vcl::Window* pParent, WinBits nStyle ) : - FloatingWindow(pParent, nStyle), +PopupMenuFloatingWindow::PopupMenuFloatingWindow( vcl::Window* pParent ) : + FloatingWindow(pParent, WB_SYSTEMFLOATWIN | WB_SYSTEMWINDOW | WB_NOBORDER ), mpImplData(new ImplData) { } diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index 05899554205d..b9f09fc30088 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -33,10 +33,9 @@ inline bool SelectionEngine::ShouldDeselect( bool bModifierKey1 ) const // TODO: throw out FunctionSet::SelectAtPoint -SelectionEngine::SelectionEngine( vcl::Window* pWindow, FunctionSet* pFuncSet, - sal_uLong nAutoRepeatInterval ) : +SelectionEngine::SelectionEngine( vcl::Window* pWindow, FunctionSet* pFuncSet ) : pWin( pWindow ), - nUpdateInterval( nAutoRepeatInterval ) + nUpdateInterval( SELENG_AUTOREPEAT_INTERVAL ) { eSelMode = SelectionMode::Single; pFunctionSet = pFuncSet; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ac14dd2c4f09..2e1b9d527101 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3293,17 +3293,10 @@ void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& mpOutDevData->mpRecordLayout = nullptr; } -void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder ) -{ - DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, nullptr, nullptr ); -} - void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, - bool bDrawBorder, - Color* pSelectionTextColor, - Color* pPaintColor + bool bDrawBorder ) { if( rRect.IsEmpty() ) @@ -3312,7 +3305,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, const StyleSettings& rStyles = GetSettings().GetStyleSettings(); // colors used for item highlighting - Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() ); + Color aSelectionBorderCol( rStyles.GetHighlightColor() ); Color aSelectionFillCol( aSelectionBorderCol ); bool bDark = rStyles.GetFaceColor().IsDark(); @@ -3321,7 +3314,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, int c1 = aSelectionBorderCol.GetLuminance(); int c2 = GetDisplayBackground().GetColor().GetLuminance(); - if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) ) + if( !bDark && !bBright && abs( c2-c1 ) < 75 ) { // constrast too low sal_uInt16 h,s,b; @@ -3396,14 +3389,6 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, } SetFillColor( aSelectionFillCol ); - if( pSelectionTextColor ) - { - Color aTextColor = IsControlBackground() ? GetControlForeground() : rStyles.GetButtonTextColor(); - Color aHLTextColor = rStyles.GetHighlightTextColor(); - int nTextDiff = abs(aSelectionFillCol.GetLuminance() - aTextColor.GetLuminance()); - int nHLDiff = abs(aSelectionFillCol.GetLuminance() - aHLTextColor.GetLuminance()); - *pSelectionTextColor = (nHLDiff >= nTextDiff) ? aHLTextColor : aTextColor; - } if( bDark ) { |