You've already forked lazarus-ccr
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:
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user