You've already forked lazarus-ccr
SpkToolbar: Refactor small button painting.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5367 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -758,6 +758,7 @@ var
|
|||||||
gradientKind: TBackgroundKind;
|
gradientKind: TBackgroundKind;
|
||||||
x: Integer;
|
x: Integer;
|
||||||
y: Integer;
|
y: Integer;
|
||||||
|
delta: Integer;
|
||||||
cornerRadius: Integer;
|
cornerRadius: Integer;
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
txtHeight: Integer;
|
txtHeight: Integer;
|
||||||
@ -774,6 +775,7 @@ begin
|
|||||||
if (FRect.Width < 2*LargeButtonRadius) or (FRect.Height < 2*LargeButtonRadius) then
|
if (FRect.Width < 2*LargeButtonRadius) or (FRect.Height < 2*LargeButtonRadius) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
delta := 40;
|
||||||
case FAppearance.Element.Style of
|
case FAppearance.Element.Style of
|
||||||
esRounded:
|
esRounded:
|
||||||
cornerRadius := LargeButtonRadius;
|
cornerRadius := LargeButtonRadius;
|
||||||
@ -803,11 +805,11 @@ begin
|
|||||||
drawBtn := true;
|
drawBtn := true;
|
||||||
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, 40);
|
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, 40);
|
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, 40);
|
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, 40);
|
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, 40);
|
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownHottrack) then
|
if (FButtonState = bsDropdownHottrack) then
|
||||||
@ -872,11 +874,11 @@ begin
|
|||||||
end else
|
end else
|
||||||
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, 40);
|
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, 40);
|
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, 40);
|
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, 40);
|
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, 40);
|
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
end else
|
end else
|
||||||
drawBtn := false;
|
drawBtn := false;
|
||||||
@ -1277,14 +1279,17 @@ end;
|
|||||||
procedure TSpkSmallButton.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
procedure TSpkSmallButton.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
||||||
var
|
var
|
||||||
fontColor: TColor;
|
fontColor: TColor;
|
||||||
x: Integer;
|
frameColor, innerLightColor, innerDarkColor: TColor;
|
||||||
y: Integer;
|
gradientFromColor, gradientToColor: TColor;
|
||||||
|
gradientKind: TBackgroundKind;
|
||||||
|
P: T2DIntPoint;
|
||||||
|
x, y: Integer;
|
||||||
|
delta: Integer;
|
||||||
cornerRadius: Integer;
|
cornerRadius: Integer;
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
|
drawBtn: Boolean;
|
||||||
begin
|
begin
|
||||||
if FToolbarDispatch = nil then
|
if (FToolbarDispatch = nil) or (FAppearance = nil) then
|
||||||
exit;
|
|
||||||
if FAppearance = nil then
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if (FRect.Width < 2*SmallButtonRadius) or (FRect.Height < 2*SmallButtonRadius) then
|
if (FRect.Width < 2*SmallButtonRadius) or (FRect.Height < 2*SmallButtonRadius) then
|
||||||
@ -1297,105 +1302,66 @@ begin
|
|||||||
cornerRadius := 0;
|
cornerRadius := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fontColor := clNone;
|
// Button (Background and frame)
|
||||||
case FButtonState of
|
drawBtn := true;
|
||||||
bsIdle:
|
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
||||||
fontColor := FAppearance.Element.IdleCaptionColor;
|
|
||||||
bsBtnHottrack,
|
|
||||||
bsDropdownHottrack:
|
|
||||||
fontColor := FAppearance.Element.HotTrackCaptionColor;
|
|
||||||
bsBtnPressed,
|
|
||||||
bsDropdownPressed:
|
|
||||||
fontColor := FAppearance.ELement.ActiveCaptionColor;
|
|
||||||
end;
|
|
||||||
if not FEnabled then
|
|
||||||
fontColor := TColorTools.ColorToGrayscale(fontColor);
|
|
||||||
|
|
||||||
// *** Przycisk ***
|
|
||||||
|
|
||||||
// T³o i ramka
|
|
||||||
|
|
||||||
{$REGION 'Rysowanie przycisku'}
|
|
||||||
if (FButtonState = bsIdle) and (not(FHideFrameWhenIdle)) then
|
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
frameColor := FAppearance.Element.IdleFrameColor;
|
||||||
TButtonTools.DrawButton(
|
innerLightColor := FAppearance.Element.IdleInnerLightColor;
|
||||||
ABuffer,
|
innerDarkColor := FAppearance.Element.IdleInnerDarkColor;
|
||||||
FButtonRect,
|
gradientFromColor := FAppearance.Element.IdleGradientFromColor;
|
||||||
IdleFrameColor,
|
gradientToColor := FAppearance.Element.IdleGradientToColor;
|
||||||
IdleInnerLightColor,
|
gradientKind := FAppearance.Element.IdleGradientType;
|
||||||
IdleInnerDarkColor,
|
|
||||||
IdleGradientFromColor,
|
|
||||||
IdleGradientToColor,
|
|
||||||
IdleGradientType,
|
|
||||||
(FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]),
|
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
cornerRadius,
|
|
||||||
ClipRect
|
|
||||||
);
|
|
||||||
end
|
|
||||||
else if (FButtonState = bsBtnHottrack) then
|
|
||||||
begin
|
|
||||||
with FAppearance.Element do
|
|
||||||
TButtonTools.DrawButton(
|
|
||||||
ABuffer,
|
|
||||||
FButtonRect,
|
|
||||||
HotTrackFrameColor,
|
|
||||||
HotTrackInnerLightColor,
|
|
||||||
HotTrackInnerDarkColor,
|
|
||||||
HotTrackGradientFromColor,
|
|
||||||
HotTrackGradientToColor,
|
|
||||||
HotTrackGradientType,
|
|
||||||
(FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]),
|
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
cornerRadius,
|
|
||||||
ClipRect
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsBtnPressed) then
|
if FButtonState = bsBtnHottrack then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
frameColor := FAppearance.Element.HotTrackFrameColor;
|
||||||
TButtonTools.DrawButton(ABuffer,
|
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
||||||
FButtonRect,
|
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
||||||
ActiveFrameColor,
|
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
||||||
ActiveInnerLightColor,
|
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
||||||
ActiveInnerDarkColor,
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
ActiveGradientFromColor,
|
end else
|
||||||
ActiveGradientToColor,
|
if FButtonState = bsBtnPressed then
|
||||||
ActiveGradientType,
|
begin
|
||||||
(FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]),
|
frameColor := FAppearance.Element.ActiveFrameColor;
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
|
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
||||||
false,
|
innerLightColor := FAppearance.Element.ActiveInnerLightColor;
|
||||||
false,
|
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
||||||
cornerRadius,
|
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
||||||
ClipRect
|
gradientKind := FAppearance.Element.ActiveGradientType;
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
delta := 40;
|
||||||
TButtonTools.DrawButton(
|
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
||||||
ABuffer,
|
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
||||||
FButtonRect,
|
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
||||||
TColorTools.Brighten(HotTrackFrameColor, 40),
|
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
||||||
TColorTools.Brighten(HotTrackInnerLightColor, 40),
|
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
||||||
TColorTools.Brighten(HotTrackInnerDarkColor, 40),
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
TColorTools.Brighten(HotTrackGradientFromColor, 40),
|
end else
|
||||||
TColorTools.Brighten(HotTrackGradientToColor, 40),
|
drawBtn := false;
|
||||||
HotTrackGradientType,
|
|
||||||
(FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]),
|
if drawBtn then
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
|
begin
|
||||||
false,
|
TButtonTools.DrawButton(
|
||||||
false,
|
ABuffer,
|
||||||
cornerRadius,
|
FButtonRect, // draw button part only
|
||||||
ClipRect
|
frameColor,
|
||||||
);
|
innerLightColor,
|
||||||
end;
|
innerDarkColor,
|
||||||
{$ENDREGION}
|
gradientFromColor,
|
||||||
|
gradientToColor,
|
||||||
|
gradientKind,
|
||||||
|
(FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]),
|
||||||
|
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]) or (FButtonKind = bkButtonDropdown),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
cornerRadius,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
// Icon
|
// Icon
|
||||||
if not FEnabled and (FDisabledImages <> nil) then
|
if not FEnabled and (FDisabledImages <> nil) then
|
||||||
@ -1410,25 +1376,37 @@ begin
|
|||||||
else
|
else
|
||||||
x := FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
|
x := FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding;
|
||||||
y := FButtonRect.top + (FButtonRect.height - imgList.Height) div 2;
|
y := FButtonRect.top + (FButtonRect.height - imgList.Height) div 2;
|
||||||
|
P := {$IFDEF EnhancedRecordSupport}T2DIntPoint.Create{$ELSE}Create2DIntPoint{$ENDIF}(x, y);
|
||||||
TGUITools.DrawImage(
|
TGUITools.DrawImage(
|
||||||
ABuffer.Canvas,
|
ABuffer.Canvas,
|
||||||
imgList,
|
imgList,
|
||||||
FImageIndex,
|
FImageIndex,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
P,
|
||||||
T2DIntPoint.Create(x,y),
|
|
||||||
{$ELSE}
|
|
||||||
Create2DIntPoint(x,y),
|
|
||||||
{$ENDIF}
|
|
||||||
ClipRect
|
ClipRect
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Prepare font and chevron color
|
||||||
|
fontColor := clNone;
|
||||||
|
case FButtonState of
|
||||||
|
bsIdle:
|
||||||
|
fontColor := FAppearance.Element.IdleCaptionColor;
|
||||||
|
bsBtnHottrack,
|
||||||
|
bsDropdownHottrack:
|
||||||
|
fontColor := FAppearance.Element.HotTrackCaptionColor;
|
||||||
|
bsBtnPressed,
|
||||||
|
bsDropdownPressed:
|
||||||
|
fontColor := FAppearance.ELement.ActiveCaptionColor;
|
||||||
|
end;
|
||||||
|
if not FEnabled then
|
||||||
|
fontColor := TColorTools.ColorToGrayscale(fontColor);
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
if FShowCaption then
|
if FShowCaption then
|
||||||
begin
|
begin
|
||||||
ABuffer.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
ABuffer.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
||||||
ABuffer.Canvas.Font.Color := fontColor;
|
ABuffer.Canvas.Font.Color := fontColor;
|
||||||
|
|
||||||
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
|
if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then
|
||||||
x := FButtonRect.Left + SmallButtonHalfBorderWidth
|
x := FButtonRect.Left + SmallButtonHalfBorderWidth
|
||||||
else
|
else
|
||||||
@ -1443,128 +1421,93 @@ begin
|
|||||||
TGUITools.DrawText(ABuffer.Canvas, x, y, FCaption, fontColor, ClipRect);
|
TGUITools.DrawText(ABuffer.Canvas, x, y, FCaption, fontColor, ClipRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Dropdown
|
// Dropdown button
|
||||||
if FButtonKind = bkButton then
|
|
||||||
begin
|
|
||||||
// Nic dodatkowego do rysowania
|
|
||||||
end else
|
|
||||||
if FButtonKind = bkButtonDropdown then
|
if FButtonKind = bkButtonDropdown then
|
||||||
begin
|
begin
|
||||||
// T³o i ramka
|
drawBtn := true;
|
||||||
{$REGION 'Rysowanie dropdowna'}
|
|
||||||
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
frameColor := FAppearance.Element.IdleFrameColor;
|
||||||
TButtonTools.DrawButton(
|
innerLightColor := FAppearance.Element.IdleInnerLightColor;
|
||||||
ABuffer,
|
innerDarkColor := FAppearance.Element.IdleInnerDarkColor;
|
||||||
FDropdownRect,
|
gradientFromColor := FAppearance.Element.IdleGradientFromColor;
|
||||||
IdleFrameColor,
|
gradientToColor := FAppearance.Element.IdleGradientToColor;
|
||||||
IdleInnerLightColor,
|
gradientKind := FAppearance.Element.IdleGradientType;
|
||||||
IdleInnerDarkColor,
|
|
||||||
IdleGradientFromColor,
|
|
||||||
IdleGradientToColor,
|
|
||||||
IdleGradientType,
|
|
||||||
true,
|
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
cornerRadius,
|
|
||||||
ClipRect
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState in [bsBtnHotTrack, bsBtnPressed]) then
|
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
delta := 40;
|
||||||
TButtonTools.DrawButton(
|
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
||||||
ABuffer,
|
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
||||||
FDropdownRect,
|
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
||||||
TColorTools.Brighten(HotTrackFrameColor, 40),
|
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
||||||
TColorTools.Brighten(HotTrackInnerLightColor, 40),
|
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
||||||
TColorTools.Brighten(HotTrackInnerDarkColor, 40),
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
TColorTools.Brighten(HotTrackGradientFromColor, 40),
|
|
||||||
TColorTools.Brighten(HotTrackGradientToColor, 40),
|
|
||||||
HotTrackGradientType,
|
|
||||||
true,
|
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
cornerRadius,
|
|
||||||
ClipRect
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownHottrack) then
|
if (FButtonState = bsDropdownHottrack) then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
frameColor := FAppearance.Element.HotTrackFrameColor;
|
||||||
TButtonTools.DrawButton(
|
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
||||||
ABuffer,
|
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
||||||
FDropdownRect,
|
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
||||||
HotTrackFrameColor,
|
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
||||||
HotTrackInnerLightColor,
|
gradientKind := FAppearance.Element.HotTrackGradientType;
|
||||||
HotTrackInnerDarkColor,
|
|
||||||
HotTrackGradientFromColor,
|
|
||||||
HotTrackGradientToColor,
|
|
||||||
HotTrackGradientType,
|
|
||||||
true,
|
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
cornerRadius,
|
|
||||||
ClipRect
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownPressed) then
|
if (FButtonState = bsDropdownPressed) then
|
||||||
begin
|
begin
|
||||||
with FAppearance.Element do
|
frameColor := FAppearance.Element.ActiveFrameColor;
|
||||||
TButtonTools.DrawButton(
|
innerlightColor := FAppearance.Element.ActiveInnerLightColor;
|
||||||
ABuffer,
|
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
||||||
FDropdownRect,
|
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
||||||
ActiveFrameColor,
|
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
||||||
ActiveInnerLightColor,
|
gradientKind := FAppearance.Element.ActiveGradientType;
|
||||||
ActiveInnerDarkColor,
|
end else
|
||||||
ActiveGradientFromColor,
|
drawBtn := false;
|
||||||
ActiveGradientToColor,
|
|
||||||
ActiveGradientType,
|
if drawBtn then begin
|
||||||
true,
|
TButtonTools.DrawButton(
|
||||||
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
|
ABuffer,
|
||||||
false,
|
FDropdownRect,
|
||||||
false,
|
frameColor,
|
||||||
cornerRadius,
|
innerLightColor,
|
||||||
ClipRect
|
innerDarkColor,
|
||||||
);
|
gradientFromColor,
|
||||||
|
gradientToColor,
|
||||||
|
gradientKind,
|
||||||
|
true,
|
||||||
|
(FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup]),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
cornerRadius,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Chevron
|
// Chevron
|
||||||
// to do: what if font 'Marlett' does not exist?
|
ABuffer.Canvas.Font.Charset := DEFAULT_CHARSET;
|
||||||
ABuffer.Canvas.Font.Charset := DEFAULT_CHARSET;
|
ABuffer.Canvas.Font.Name := 'Marlett';
|
||||||
ABuffer.Canvas.Font.Name := 'Marlett';
|
ABuffer.Canvas.Font.Style := [];
|
||||||
ABuffer.Canvas.Font.Style := [];
|
ABuffer.Canvas.Font.Orientation := 0;
|
||||||
ABuffer.Canvas.Font.Orientation := 0;
|
|
||||||
|
|
||||||
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
|
|
||||||
x := FDropdownRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1
|
|
||||||
else
|
|
||||||
x := FDropdownRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
|
|
||||||
y := FDropdownRect.top + (FDropdownRect.Height - ABuffer.Canvas.Textheight('u')) div 2;
|
|
||||||
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', fontColor, ClipRect);
|
|
||||||
{$ENDREGION}
|
|
||||||
end else
|
|
||||||
if FButtonKind = bkDropdown then
|
if FButtonKind = bkDropdown then
|
||||||
begin
|
begin
|
||||||
// Chevron dropdown
|
|
||||||
// to do: what if font 'Marlett' does not exist?
|
|
||||||
ABuffer.Canvas.Font.Charset := DEFAULT_CHARSET;
|
|
||||||
ABuffer.Canvas.Font.Name := 'Marlett';
|
|
||||||
ABuffer.Canvas.Font.Style := [];
|
|
||||||
ABuffer.Canvas.Font.Orientation := 0;
|
|
||||||
|
|
||||||
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
|
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
|
||||||
x := FButtonRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1
|
x := FButtonRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1
|
||||||
else
|
else
|
||||||
x := FButtonRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
|
x := FButtonRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
|
||||||
y := FButtonRect.top + (FButtonRect.height - ABuffer.Canvas.Textheight('u')) div 2;
|
y := FButtonRect.top + (FButtonRect.height - ABuffer.Canvas.Textheight('u')) div 2;
|
||||||
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', fontColor, ClipRect);
|
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', fontColor, ClipRect);
|
||||||
|
end else
|
||||||
|
if FButtonKind = bkButtonDropdown then
|
||||||
|
begin
|
||||||
|
if FGroupBehaviour in [gbBeginsGroup, gbContinuesGroup] then
|
||||||
|
x := FDropdownRect.Right - SmallButtonHalfBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1
|
||||||
|
else
|
||||||
|
x := FDropdownRect.Right - SmallButtonBorderWidth - (SmallButtonDropdownWidth + ABuffer.Canvas.Textwidth('u')) div 2 + 1;
|
||||||
|
y := FDropdownRect.top + (FDropdownRect.Height - ABuffer.Canvas.Textheight('u')) div 2;
|
||||||
|
TGUITools.DrawText(ABuffer.Canvas, x, y, 'u', FontColor, ClipRect);
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkSmallButton.GetDropdownPoint: T2DIntPoint;
|
function TSpkSmallButton.GetDropdownPoint: T2DIntPoint;
|
||||||
|
Reference in New Issue
Block a user