spktoolbar: Option to draw selection in TSpkToolbar with rounded corners.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8749 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-02-27 15:09:47 +00:00
parent d3a9ebb97a
commit 7d9529a164
7 changed files with 177 additions and 47 deletions

View File

@ -27,10 +27,10 @@ type
);
TSpkElementStyle = (esRounded, esRectangle);
TSpkMenuButtonShapeStyle = (mbssRounded, mbssRectangle);
TSpkPopupStyle = (psDefault, psGutter);
TSpkMenuButtonShapeStyle = (mbssRounded, mbssRectangle);
TSpkPopupSelectionShape = (ssRounded, ssRectangle);
TSpkStyle = (
spkOffice2007Blue,
@ -362,6 +362,7 @@ type
FIdleGradientToColor: TColor;
FIdleGradientType: TBackgroundKind;
FStyle: TSpkPopupStyle;
FSelShape: TSpkPopupSelectionShape;
procedure SetCaptionFont(const Value: TFont);
procedure SetCheckedFrameColor(const Value: TColor);
procedure SetCheckedGradientFromColor(const Value: TColor);
@ -382,6 +383,7 @@ type
procedure SetIdleGradientFromColor(const Value: TColor);
procedure SetIdleGradientToColor(const Value: TColor);
procedure SetIdleGradientType(const Value: TBackgroundKind);
procedure SetSelShape(const Value: TSpkPopupSelectionShape);
procedure SetStyle(const Value: TSpkPopupStyle);
protected
procedure CaptionFontChange(Sender: TObject);
@ -414,6 +416,7 @@ type
property IdleGradientFromColor: TColor read FIdleGradientFromColor write SetIdleGradientFromColor;
property IdleGradientToColor: TColor read FIdleGradientToColor write SetIdleGradientToColor;
property IdleGradientType: TBackgroundKind read FHotTrackGradientType write SetHotTrackGradientType;
property SelectionShape: TSpkPopupSelectionShape read FSelShape write SetSelShape;
property Style: TSpkPopupStyle read FStyle write SetStyle;
end;
@ -1798,7 +1801,9 @@ begin
FHotTrackGradientToColor := SrcAppearance.HotTrackGradientToColor;
FHotTrackGradientType := SrcAppearance.HotTrackGradientType;
FSelShape := SrcAppearance.SelectionShape;
FStyle := SrcAppearance.Style;
if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged;
end else
@ -1853,11 +1858,7 @@ begin
Subnode := Node['IdleCaptionColor', false];
if Assigned(Subnode) then
FIdleCaptionColor := Subnode.TextAsColor;
{
Subnode := Node['IdleFrameColor', false];
if Assigned(Subnode) then
FIdleFrameColor := Subnode.TextAsColor;
}
Subnode := Node['IdleGradientFromColor', false];
if Assigned(Subnode) then
FIdleGradientFromColor := Subnode.TextAsColor;
@ -1870,16 +1871,6 @@ begin
if Assigned(Subnode) then
FIdleGradientType := TBackgroundKind(Subnode.TextAsInteger);
{
Subnode := Node['IdleInnerLightColor', false];
if Assigned(Subnode) then
FIdleInnerLightColor := Subnode.TextAsColor;
Subnode := Node['IdleInnerDarkColor', false];
if Assigned(Subnode) then
FIdleInnerDarkColor := Subnode.TextAsColor;
}
// Gutter
Subnode := Node['GutterFrameColor', false];
if Assigned(Subnode) then
@ -1897,7 +1888,6 @@ begin
if Assigned(Subnode) then
FGutterGradientType := TBackgroundKind(Subnode.TextAsInteger);
// HotTrack
Subnode := Node['HottrackCaptionColor', false];
if Assigned(Subnode) then
@ -1918,21 +1908,12 @@ begin
Subnode := Node['HottrackGradientType', false];
if Assigned(Subnode) then
FHottrackGradientType := TBackgroundKind(Subnode.TextAsInteger);
{
Subnode := Node['HottrackInnerLightColor', false];
if Assigned(Subnode) then
FHottrackInnerLightColor := Subnode.TextAsColor;
Subnode := Node['HottrackInnerDarkColor', false];
if Assigned(Subnode) then
FHottrackInnerDarkColor := Subnode.TextAsColor;
Subnode := Node['HottrackBrightnessChange', false];
if Assigned(Subnode) then
FHottrackBrightnessChange := Subnode.TextAsInteger;
}
// Other
Subnode := Node['SelectionShape', false];
if Assigned(Subnode) then
FSelShape := TSpkPopupSelectionShape(Subnode.TextAsInteger);
Subnode := Node['Style', false];
if Assigned(SubNode) then
FStyle := TSpkPopupStyle(Subnode.TextAsInteger);
@ -1977,6 +1958,7 @@ begin
FIdleGradientToColor := rgb(250, 250, 250);
FIdleGradientType := bkSolid;
FStyle := psGutter;
FSelShape := ssRectangle;
end;
spkOffice2007Silver,
@ -2031,6 +2013,7 @@ begin
FHotTrackGradientToColor := $004DD7FF;
end;
FStyle := psGutter;
FSelShape := ssRectangle;
end;
spkMetroLight:
@ -2074,6 +2057,7 @@ begin
}
FStyle := psDefault;
FSelShape := ssRectangle;
end;
spkMetroDark:
@ -2112,6 +2096,7 @@ begin
FIdleInnerLightColor := $00444444;
}
FStyle := psDefault;
FSelShape := ssRectangle;
end;
end;
end;
@ -2146,6 +2131,7 @@ begin
Add(' HotTrackGradientToColor := $%.8x;', [FHotTrackGradientToColor]);
Add(' HotTrackGradientType := %s;', [GradientTypeName(FHotTrackGradientType)]);
Add(' SelectionShape := %s;', [GetEnumName(TypeInfo(TSpkPopupSelectionShape), ord(FSelShape))]);
Add(' Style := %s;', [GetEnumName(TypeInfo(TSpkPopupStyle), ord(FStyle))]);
Add(' end;');
end;
@ -2244,6 +2230,9 @@ begin
}
// Other
Subnode := Node['SelectionShape', true];
Subnode.TextAsInteger := integer(FSelShape);
Subnode := Node['Style', true];
Subnode.TextAsInteger := integer(FStyle);
end;
@ -2388,6 +2377,13 @@ begin
FDispatch.NotifyAppearanceChanged;
end;
procedure TSpkPopupMenuAppearance.SetSelShape(const Value: TSpkPopupSelectionShape);
begin
FSelShape := Value;
if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged;
end;
procedure TSpkPopupMenuAppearance.SetStyle(const Value: TSpkPopupStyle);
begin
FStyle := Value;