From c5b3e83d2a4f54e0879b3006ee85df2507f76b01 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 1 Feb 2018 08:44:57 +0000 Subject: [PATCH] spktoolbar: Replace themed painting of dropdown arrows by self-painted triangles (better control of color of the dropdown button). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6163 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../spktoolbar/SpkToolbar/spkt_Buttons.pas | 33 +++++++------------ .../spktoolbar/SpkToolbar/spkt_Const.pas | 11 +------ 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas index 676ad661c..b32b4388d 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas @@ -203,7 +203,7 @@ type implementation uses - LCLType, LCLIntf, LCLProc, SysUtils, Themes, + LCLType, LCLIntf, LCLProc, SysUtils, spkt_Pane, spkt_Appearance; @@ -384,30 +384,19 @@ const w = 8; h = 8; var - details: TThemedElementDetails; - arrowState: TThemedToolBar; P: array[0..3] of TPoint; wsc, hsc: Integer; begin - if ThemeServices.ThemesEnabled then begin - if Enabled then - arrowState := ttbSplitButtonDropdownNormal - else - arrowState := ttbSplitButtonDropDownDisabled; - details := ThemeServices.GetElementDetails(arrowState); - ThemeServices.DrawElement(ABuffer.Canvas.Handle, details, ARect); - end else begin - wsc := ScaleX(w, DesignDPI); // 0 1 - hsc := ScaleY(h, DesignDPI); // 2 - P[2].x := ARect.Left + (ARect.Right - ARect.Left) div 2; - P[2].y := ARect.Top + (ARect.Bottom - ARect.Top + hsc) div 2 - 1; - P[0] := Point(P[2].x - wsc div 2, P[2].y - hsc div 2); - P[1] := Point(P[2].x + wsc div 2, P[0].y); - P[3] := P[0]; - ABuffer.Canvas.Brush.Color := AColor; - ABuffer.Canvas.Pen.Style := psClear; - ABuffer.Canvas.Polygon(P); - end; + wsc := ScaleX(w, DesignDPI); // 0 1 + hsc := ScaleY(h, DesignDPI); // 2 + P[2].x := ARect.Left + (ARect.Right - ARect.Left) div 2; + P[2].y := ARect.Top + (ARect.Bottom - ARect.Top + hsc) div 2 - 1; + P[0] := Point(P[2].x - wsc div 2, P[2].y - hsc div 2); + P[1] := Point(P[2].x + wsc div 2, P[0].y); + P[3] := P[0]; + ABuffer.Canvas.Brush.Color := AColor; + ABuffer.Canvas.Pen.Style := psClear; + ABuffer.Canvas.Polygon(P); end; function TSpkBaseButton.GetAction: TBasicAction; diff --git a/components/spktoolbar/SpkToolbar/spkt_Const.pas b/components/spktoolbar/SpkToolbar/spkt_Const.pas index e85c65057..bc1b40962 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Const.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Const.pas @@ -271,12 +271,9 @@ var implementation uses - LCLType, Types, Themes; + LCLType, Types; procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0); -var - detail: TThemedElementDetails; - detailSize: TSize; begin if not DPI_AWARE then ToDPI := FromDPI; @@ -303,12 +300,6 @@ begin SmallButtonRadius := SMALLBUTTON_RADIUS; SmallButtonMinWidth := 2 * SmallButtonPadding + SmallButtonGlyphWidth; - // Make sure that dropdown button is not too narrow - detail := ThemeServices.GetElementDetails(ttbSplitButtonDropDownNormal); - detailsize := ThemeServices.GetDetailSize(detail); - if SmallButtonDropdownWidth < detailSize.CX then - SmallButtondropdownWidth := detailSize.CX; - MaxElementHeight := SpkScaleY(MAX_ELEMENT_HEIGHT, FromDPI, ToDPI); PaneRowHeight := SpkScaleY(PANE_ROW_HEIGHT, FromDPI, ToDPI); PaneFullRowHeight := 3 * PaneRowHeight;