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
This commit is contained in:
wp_xxyyzz 2018-02-01 08:44:57 +00:00
parent dcc90b77e4
commit c5b3e83d2a
2 changed files with 12 additions and 32 deletions

View File

@ -203,7 +203,7 @@ type
implementation implementation
uses uses
LCLType, LCLIntf, LCLProc, SysUtils, Themes, LCLType, LCLIntf, LCLProc, SysUtils,
spkt_Pane, spkt_Appearance; spkt_Pane, spkt_Appearance;
@ -384,19 +384,9 @@ const
w = 8; w = 8;
h = 8; h = 8;
var var
details: TThemedElementDetails;
arrowState: TThemedToolBar;
P: array[0..3] of TPoint; P: array[0..3] of TPoint;
wsc, hsc: Integer; wsc, hsc: Integer;
begin 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 wsc := ScaleX(w, DesignDPI); // 0 1
hsc := ScaleY(h, DesignDPI); // 2 hsc := ScaleY(h, DesignDPI); // 2
P[2].x := ARect.Left + (ARect.Right - ARect.Left) div 2; P[2].x := ARect.Left + (ARect.Right - ARect.Left) div 2;
@ -407,7 +397,6 @@ begin
ABuffer.Canvas.Brush.Color := AColor; ABuffer.Canvas.Brush.Color := AColor;
ABuffer.Canvas.Pen.Style := psClear; ABuffer.Canvas.Pen.Style := psClear;
ABuffer.Canvas.Polygon(P); ABuffer.Canvas.Polygon(P);
end;
end; end;
function TSpkBaseButton.GetAction: TBasicAction; function TSpkBaseButton.GetAction: TBasicAction;

View File

@ -271,12 +271,9 @@ var
implementation implementation
uses uses
LCLType, Types, Themes; LCLType, Types;
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0); procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
var
detail: TThemedElementDetails;
detailSize: TSize;
begin begin
if not DPI_AWARE then if not DPI_AWARE then
ToDPI := FromDPI; ToDPI := FromDPI;
@ -303,12 +300,6 @@ begin
SmallButtonRadius := SMALLBUTTON_RADIUS; SmallButtonRadius := SMALLBUTTON_RADIUS;
SmallButtonMinWidth := 2 * SmallButtonPadding + SmallButtonGlyphWidth; 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); MaxElementHeight := SpkScaleY(MAX_ELEMENT_HEIGHT, FromDPI, ToDPI);
PaneRowHeight := SpkScaleY(PANE_ROW_HEIGHT, FromDPI, ToDPI); PaneRowHeight := SpkScaleY(PANE_ROW_HEIGHT, FromDPI, ToDPI);
PaneFullRowHeight := 3 * PaneRowHeight; PaneFullRowHeight := 3 * PaneRowHeight;