vcl/source/control/imivctl1.cxx | 81 ++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 52 deletions(-)
New commits: commit 766417d8d7de5fe3b082add4094781eadcaab072 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 22 11:22:42 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 24 05:43:35 2024 +0200 tdf#161501 icon choice ctrl: OSL_FAIL -> assert Change-Id: Ifa6528f9994c471828efcaedebee83bc0027775a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170848 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 6b5216d5ff14..af354bc5ba59 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -1161,7 +1161,7 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcBmpRect( SvxIconChoiceCtrlEntry* pE return tools::Rectangle( aPos, aImageSize ); default: - OSL_FAIL("IconView: Viewmode not set"); + assert(false && "IconView: Viewmode not set"); return aBound; } } commit c59730b46b4d7dd0af0c49ecbc852cda2871a5a0 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 22 11:05:30 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Jul 24 05:43:27 2024 +0200 tdf#161501 icon choice ctrl: Draw whole entry natively When native drawing of tab items is supported, natively draw the whole (vertical) tab item (except for the text) in `SvxIconChoiceCtrl_Impl::PaintEntry`, instead of using native drawing API only for highlighting the mouse-hovered entry, as originally introduced in commit 8708e8cf90d0ac0acbbce34b82f10ef7352d5062 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Thu Jul 11 10:47:50 2024 +0200 tdf#161026 tdf#161355 tdf#161501 icon choice ctrl: Natively draw mouse-hover ... feedback. Set the corresponding state flags for selected and focused entry, so that the native drawing routine can take care of drawing the selected/focused entry accordingly instead of using the native drawing API to draw a `ControlType::WindowBackground` for that purpose. With this commit in place, all entries (not just the mouse-hovered, focused or selected) entry are now drawn using the native drawing API. For the kf5 VCL plugin with the Breeze style, this makes them look similar to the entries for the non-vertical tabbar used elsewhere in LibreOffice, or actual native `QTabBar`s. Due to Change-Id: Idf1e41d3bc309d152a4a36d14e8617bd6429940c Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Jul 22 08:25:32 2024 +0200 tdf#161501 vcl: Make TabitemValue position-aware , the selection indicator is drawn vertically as expected when using the Breeze style. Restrict manually drawing entries (including focus and selection indicator) to the case where native drawing is not implemented (e.g. the gen VCL plugin). Further tweaking the visual appearance (e.g. getting rid of extra white margins and space between the entries for the variant where icons are used, like the "Insert" -> "Hyperlink" dialog in Writer) can be done in separate commits. Change-Id: Ie0c8ba1b56f6bb76ece6761253b93a109bb3a3f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170847 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index f32af05ac19c..6b5216d5ff14 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -1048,68 +1048,45 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po nBmpPaintFlags |= PAINTFLAG_HOR_CENTERED; sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED; - // Background of selected entry tools::Rectangle aFocusRect(CalcFocusRect(pEntry)); - bool bNativeSelection = rRenderContext.IsNativeControlSupported(ControlType::WindowBackground, ControlPart::Entire); - if (bSelected) - { - if (bNativeSelection) - { - ControlState nState = ControlState::ENABLED; - ImplControlValue aControlValue(0); - bNativeSelection = rRenderContext.DrawNativeControl(ControlType::WindowBackground, ControlPart::Entire, - aFocusRect, nState, aControlValue, OUString()); - } - if (bNativeSelection) - { - // If a native control was drawn, then draw a mark at the left side of the selected tab - aFocusRect.setWidth(TAB_MARK_WIDTH); - Color aOldFillColor(rRenderContext.GetFillColor()); - Color aOldLineColor(rRenderContext.GetLineColor()); - Color aAccentColor(rRenderContext.GetSettings().GetStyleSettings().GetAccentColor()); - rRenderContext.SetFillColor(aAccentColor); - rRenderContext.SetLineColor(aAccentColor); - rRenderContext.DrawRect(aFocusRect); - rRenderContext.SetFillColor(aOldFillColor); - rRenderContext.SetLineColor(aOldLineColor); - } - else - { - vcl::RenderTools::DrawSelectionBackground(rRenderContext, *pView, aFocusRect, - pView->HasFocus() ? 1 : 2, false, false, false); - } - } - else + bool bNativeOK + = rRenderContext.IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire); + if (bNativeOK) { - PaintEmphasis(aTextRect, rRenderContext); - } + ControlState nState = ControlState::ENABLED; + if (bSelected) + nState |= ControlState::SELECTED; + if (pEntry->IsFocused()) + nState |= ControlState::FOCUSED; + if (bMouseHovered) + nState |= ControlState::ROLLOVER; - if (pEntry->IsFocused()) - DrawFocusRect(rRenderContext, pEntry); + TabitemValue tiValue(aFocusRect, TabBarPosition::Left); + bNativeOK = rRenderContext.DrawNativeControl(ControlType::TabItem, ControlPart::Entire, + aFocusRect, nState, tiValue, OUString()); + } - // highlight mouse-hovered entry - if (bMouseHovered) + if (!bNativeOK) { - const tools::Rectangle aRect = CalcFocusRect(pEntry); - bool bNativeOK - = rRenderContext.IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire); - if (bNativeOK) - { - ControlState nState = ControlState::ENABLED | ControlState::ROLLOVER; - TabitemValue tiValue(aRect, TabBarPosition::Left); - bNativeOK = rRenderContext.DrawNativeControl(ControlType::TabItem, ControlPart::Entire, - aRect, nState, tiValue, OUString()); - } + if (bSelected) + vcl::RenderTools::DrawSelectionBackground( + rRenderContext, *pView, aFocusRect, pView->HasFocus() ? 1 : 2, false, false, false); + else + PaintEmphasis(aTextRect, rRenderContext); + + if (pEntry->IsFocused()) + DrawFocusRect(rRenderContext, pEntry); - if (!bNativeOK) - DrawHighlightFrame(rRenderContext, aRect); + // highlight mouse-hovered entry + if (bMouseHovered) + DrawHighlightFrame(rRenderContext, aFocusRect); } PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, rRenderContext); - // Move text a bit to the right for native controls due to the tab mark (applies to text-only entries) - if (bNativeSelection && (nWinBits & WB_DETAILS)) + // Move text a bit to the right for native controls due to potential tab mark (applies to text-only entries) + if (bNativeOK && (nWinBits & WB_DETAILS)) aTextRect.SetPos(Point(aTextRect.GetPos().X() + TAB_MARK_WIDTH, aTextRect.GetPos().Y())); PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, rRenderContext);