📄 aqdockinguidefault.pas
字号:
PaneBorders: array [TaqTabOrientation] of TaqEdgeBorders = (
[ebTop, ebLeft, ebRight], // dtoTop
[ebBottom, ebLeft, ebRight] // dtoBottom
);
var
PadArea, PaneArea: TRect;
begin
// Draw padding area.
PadArea := ARect;
case AOrientation of
dtoTop: PadArea.Top := ARect.Bottom - Metrics[dumTabPadding];
dtoBottom: PadArea.Bottom := ARect.Top + Metrics[dumTabPadding];
end;
if ActiveTabColor.FillType = gtVertical then
ACanvas.Brush.Color := ActiveTabColor.EndColor
else
ACanvas.Brush.Color := ActiveTabColor.StartColor;
ACanvas.Brush.Style := bsSolid;
ACanvas.FillRect(PadArea);
DrawEdge(ACanvas, PadArea, PaddingEdges[AOrientation, False],
PaddingEdges[AOrientation, True], PaddingBorders[AOrientation], ACanvas.Brush.Color);
// Draw tab pane.
SubtractRect(PaneArea, ARect, PadArea);
DrawEdge(ACanvas, PaneArea, PaneEdges[False],
PaneEdges[True], PaneBorders[AOrientation], TabPaneColor.StartColor);
InflateRect(PaneArea, -1, -1);
case AOrientation of
dtoTop: Inc(PaneArea.Bottom);
dtoBottom: Dec(PaneArea.Top);
end;
DoDrawTabPaneContent(ACanvas, PaneArea, Orientations[AOrientation]);
end;
procedure TaqCustomDefaultUIStyle.DoDrawTabPaneContent(ACanvas: TCanvas;
ARect: TRect; AOrientation: TaqOrientation);
var
SwapColors: Boolean;
begin
case AOrientation of
orTop, orLeft: SwapColors := False;
orBottom: SwapColors := TabPaneColor.FillType = gtVertical;
else {orRight} SwapColors := TabPaneColor.FillType = gtHorizontal;
end;
TabPaneColor.Fill(ACanvas, ARect, ARect, SwapColors);
end;
procedure TaqCustomDefaultUIStyle.DoDrawTabButton(ACanvas: TCanvas;
ARect: TRect; AState: TaqTabButtonState; AKind: TaqTabButtonKind);
const
BtnOuterEdgeStyles: array [TaqTabButtonState] of TaqEdgeStyle = (
// tbsNormal, tbsHot, tbsPressed, tbsDisabled
esNone, esRaised, esLowered, esNone);
begin
if AKind = tbkClose then
begin
ARect.Top := FLastTabTextRect.Top;
ARect.Bottom := FLastTabTextRect.Bottom;
end
else
with ACanvas do
begin
Brush.Style := bsSolid;
Brush.Color := TabPaneColor.StartColor;
FillRect(ARect);
end;
DrawEdge(ACanvas, ARect, esNone, BtnOuterEdgeStyles[AState], ebRect, TabPaneColor.StartColor);
InflateRect(ARect, -1, -1);
DoDrawTabButtonWidget(ACanvas, ARect, AState, AKind);
end;
procedure TaqCustomDefaultUIStyle.DoDrawTabButtonWidget(ACanvas: TCanvas;
ARect: TRect; AState: TaqTabButtonState;
AKind: TaqTabButtonKind);
const
ButtonColor: array [TaqTabButtonState] of TColor =
(clBlack, clHotLight, clHotLight, {$IFDEF VCL}clBtnShadow{$ELSE}clDark{$ENDIF});
var
Offset, Size, X1, X2, i: Integer;
Points: array [0..3] of TPoint;
ArrowHeight, ArrowWidth: Integer;
pts: array [0..3] of TPoint;
begin
if AKind = tbkClose then
begin
ACanvas.Brush.Style := bsSolid;
ACanvas.Pen.Color := clGray;
ACanvas.Brush.Color := TabPaneColor.StartColor;
Size := 3 * Min(ARect.Right - ARect.Left, ARect.Bottom - ARect.Top) div 4;
if Odd(Size) then
Inc(Size);
Size := Max(Size, 12);
X1 := ARect.Bottom;
ARect.Left := ARect.Left + (ARect.Right - ARect.Left - Size) div 2;
ARect.Top := ARect.Top + (ARect.Bottom - ARect.Top - Size) div 2 + 1;
ARect.Right := ARect.Left + Size;
ARect.Bottom := ARect.Top + Size - 1;
if ARect.Bottom > X1 then
OffsetRect(ARect, 0, X1 - ARect.Bottom);
ACanvas.Pen.Width := Max(1, (ARect.Right - ARect.Left) div 10);
ACanvas.Rectangle(Rect(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom));
InflateRect(ARect, -ACanvas.Pen.Width - 2, -ACanvas.Pen.Width - 2);
ACanvas.Brush.Style := bsClear;
ACanvas.Pen.Color := clBtnText;
pts[0].X := ARect.Left;
pts[0].Y := ARect.Top;
pts[1].X := ARect.Right - 2;
pts[1].Y := ARect.Bottom - 1;
pts[2].X := ARect.Right - 1;
pts[2].Y := ARect.Bottom - 1;
pts[3].X := ARect.Left + 1;
pts[3].Y := ARect.Top;
ACanvas.Polygon(pts);
pts[0].X := ARect.Left;
pts[0].Y := ARect.Bottom - 1;
pts[1].X := ARect.Right - 2;
pts[1].Y := ARect.Top;
pts[2].X := ARect.Right - 1;
pts[2].Y := ARect.Top;
pts[3].X := ARect.Left + 1;
pts[3].Y := ARect.Bottom - 1;
ACanvas.Polygon(pts);
end
else
begin
Offset := 3 + (ARect.Bottom - ARect.Top) div 20;
ArrowHeight := ARect.Bottom - ARect.Top - Offset * 2;
if not Odd(ArrowHeight) then Dec(ArrowHeight);
ArrowWidth := (ArrowHeight + 1) div 2;
Points[0].Y := Offset + ArrowHeight div 2;
Points[1].Y := Offset - 1;
Points[2].Y := Offset + ArrowHeight;
Points[3].Y := Points[0].Y;
X1 := (ARect.Right - ARect.Left - ArrowWidth) div 2;
X2 := X1 + ArrowWidth;
case AKind of
tbkLeft:
begin
Points[0].X := X1; Points[1].X := X2;
Points[2].X := Points[1].X;
Points[3].X := Points[0].X;
end;
tbkRight:
begin
Points[0].X := X2; Points[1].X := X1;
Points[2].X := Points[1].X;
Points[3].X := Points[0].X;
end;
tbkPopup, tbkPopupEx:
begin
for i := 0 to 3 do
Points[i].X := Points[i].Y;
Points[0].Y := X2 + 1;
Points[1].Y := X1;
Points[2].Y := X1;
Points[2].X := Points[2].X + 1;
Points[1].X := Points[1].X - 1;
Points[3] := Points[0];
end;
end;
for i := 0 to 3 do
begin
Points[i].X := Points[i].X + ARect.Left;
Points[i].Y := Points[i].Y + ARect.Top;
end;
with ACanvas do
begin
Pen.Width := 1;
Pen.Style := psSolid;
Pen.Color := ButtonColor[AState];
Brush.Color := ButtonColor[AState];
Polygon(Points{$IFNDEF VCL}, False, 0, 4{$ENDIF});
if AKind = tbkPopupEx then
Rectangle(Points[1].X, Points[1].Y - Max(1, ArrowHeight div 3) - Max(2, ArrowHeight div 3), Points[2].X + 1, Points[1].Y - Max(1, ArrowHeight div 3));
end;
end;
end;
procedure TaqCustomDefaultUIStyle.DoDrawTabTarget(ACanvas: TCanvas; ARect: TRect);
var
P: TPoint;
begin
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.Color := clBtnShadow;
ACanvas.Pen.Width := 1;
ACanvas.Brush.Style := bsSolid;
ACanvas.Brush.Color := clBtnHighlight;
P := Point(ARect.Left + (ARect.Right - ARect.Left) div 2, ARect.Top + ARect.Right - ARect.Left);
ACanvas.Polygon([ARect.TopLeft, Point(ARect.Right, ARect.Top), P]);
ACanvas.MoveTo(P.X, P.Y);
P.Y := ARect.Bottom - (ARect.Right - ARect.Left);
ACanvas.LineTo(P.X, P.Y);
ACanvas.Polygon([Point(ARect.Left, ARect.Bottom), ARect.BottomRight, P]);
end;
procedure TaqCustomDefaultUIStyle.DoDrawTabItem(ACanvas: TCanvas; ARect: TRect;
const AText: string; AState: TaqTabItemState; APosition: TaqTabItemPosition;
AOrientation: TaqOrientation; AButtonAreaWidthBefore: Integer; AButtonAreaWidthAfter: Integer;
ADrawImage: Boolean; AImages: TCustomImageList; AImageIndex: Integer);
var
Pad: Integer;
FillRect: TRect;
SwapColors: Boolean;
TbColor: TGradient;
ActiveTab: Boolean;
begin
Pad := Metrics[dumTabPadding];
ActiveTab := AState in [tisSelected, tisFocused];
if ActiveTab then
TbColor := ActiveTabColor
else
TbColor := TabColor;
ACanvas.Pen.Style := psSolid;
if ActiveTab then
begin
FillRect := Rect(ARect.Left - 2, ARect.Top, ARect.Right, ARect.Bottom);
case AOrientation of
orTop:
begin
Dec(FillRect.Bottom, Pad - 1);
Inc(FillRect.Top, 2);
DrawEdge(ACanvas, FillRect, esNone, esRaised, [ebTop, ebLeft], TbColor.StartColor);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebRight], TbColor.StartColor);
Inc(FillRect.Top);
end;
orBottom:
begin
Inc(FillRect.Top, Pad - 1);
Dec(FillRect.Bottom, 2);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebBottom, ebRight], TbColor.StartColor);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebLeft], TbColor.StartColor);
Dec(FillRect.Bottom);
end;
end;
Inc(FillRect.Left); Dec(FillRect.Right);
end
else
begin
FillRect := Rect(ARect.Left - 1, ARect.Top + Pad, ARect.Right, ARect.Bottom - Pad);
ACanvas.Pen.Color := DarkColor(TbColor.StartColor);
ACanvas.MoveTo(FillRect.Right - 1, FillRect.Top);
ACanvas.LineTo(FillRect.Right - 1, FillRect.Bottom);
Dec(FillRect.Right);
end;
if AOrientation = orTop then
SwapColors := False
else
SwapColors := TbColor.FillType = gtVertical;
TbColor.Fill(ACanvas, FillRect, FillRect, SwapColors);
// Inc(FillRect.Left);
// Dec(FillRect.Right, AButtonAreaWidth);
Inc(FillRect.Left, AButtonAreaWidthBefore + 1);
Dec(FillRect.Right, AButtonAreaWidthAfter);
DoDrawTabItemContent(ACanvas, FillRect, AText, AState,
AOrientation, ADrawImage, True, TabFont, ActiveTabFont, AImages, AImageIndex, True);
end;
procedure TaqCustomDefaultUIStyle.DoDrawCaptionButton(ACanvas: TCanvas; ARect: TRect;
AState: TaqDockButtonState; ACaptionState: TaqDockCaptionState; AKind: TaqDockButtonKind);
const
EdgeStyles: array [TaqDockButtonState] of TaqEdgeStyle =
// dbsNormal, dbsHot, dbsPressed, dbsDisabled
(esNone, esRaised, esLowered, esNone);
var
Color: TColor;
begin
ACanvas.Brush.Style := bsClear;
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.Width := 1;
if ACaptionState = dcsFocused then
Color := ActiveCaptionColor.StartColor
else
Color := CaptionColor.StartColor;
DrawEdge(ACanvas, ARect, esNone, EdgeStyles[AState], ebRect, Color);
InflateRect(ARect, -1, -1);
DoDrawCaptionButtonWidget(ACanvas, ARect, AState, ACaptionState, AKind);
end;
procedure TaqCustomDefaultUIStyle.DoDrawCaptionButtonWidget(ACanvas: TCanvas;
ARect: TRect; AState: TaqDockButtonState; ACaptionState: TaqDockCaptionState;
AKind: TaqDockButtonKind);
var
offset: Integer;
DefFont: TFont;
R1: TRect;
pts: array [0..3] of TPoint;
begin
ACanvas.Brush.Style := bsClear;
if (Images <> nil) and (CaptionButtons.FButtonImages[AKind] >= 0) then
DrawImage(Images, CaptionButtons.FButtonImages[AKind], ACanvas,
ARect, AState <> dbsDisabled, CaptionButtons.DrawStyle)
else
begin
if AKind <> dbkHelp then
InflateRect(ARect, -(ARect.Right - ARect.Left) div 6, -(ARect.Bottom - ARect.Top) div 6);
if ACaptionState = dcsFocused then
ACanvas.Pen.Color := ActiveCaptionFont.Color
else
ACanvas.Pen.Color := CaptionFont.Color;
if AState = dbsDisabled then
ACanvas.Pen.Color := clBtnShadow;
case AKind of
dbkHide:
begin
ACanvas.Brush.Color := ACanvas.Pen.Color;
ACanvas.Pen.Width := Max(1, (ARect.Right - ARect.Left) div 5);
pts[0].X := ARect.Left;
pts[0].Y := ARect.Top;
pts[1].X := ARect.Right - 2;
pts[1].Y := ARect.Bottom - 1;
pts[2].X := ARect.Right - 1;
pts[2].Y := ARect.Bottom - 1;
pts[3].X := ARect.Left + 1;
pts[3].Y := ARect.Top;
ACanvas.Polygon(pts);
pts[0].X := ARect.Left;
pts[0].Y := ARect.Bottom - 1;
pts[1].X := ARect.Right - 2;
pts[1].Y := ARect.Top;
pts[2].X := ARect.Right - 1;
pts[2].Y := ARect.Top;
pts[3].X := ARect.Left + 1;
pts[3].Y := ARect.Bottom - 1;
ACanvas.Polygon(pts);
end;
dbkAutoHide:
begin
ACanvas.Pen.Width := Max(1, (ARect.Right - ARect.Left) div 5);
R1 := ARect;
offset := (R1.Right - R1.Left) div 2 + 1;
Inc(R1.Left, offset div 2); R1.Right := R1.Left + offset;
R1.Bottom := R1.Top + (R1.Bottom - R1.Top) div 2 + 1;
Dec(R1.Top);
ACanvas.Rectangle(R1);
Inc(R1.Top, ACanvas.Pen.Width);
Dec(R1.Right, ACanvas.Pen.Width);
ACanvas.Rectangle(R1);
R1 := ARect;
R1.Top := R1.Top + (R1.Bottom - R1.Top) div 2;
ACanvas.MoveTo(R1.Left, R1.Top);
ACanvas.LineTo(R1.Right, R1.Top);
ACanvas.MoveTo(R1.Left + (R1.Right - R1.Left) div 2, R1.Top);
ACanvas.LineTo(R1.Left + (R1.Right - R1.Left) div 2, R1.Bottom);
end;
dbkUndoAutoHide:
begin
ACanvas.Pen.Width := Max(1, (ARect.Right - ARect.Left) div 5);
R1 := ARect;
offset := (R1.Bottom - R1.Top) div 2 + 1;
Inc(R1.Top, offset div 2); R1.Bottom := R1.Top + offset;
R1.Left := R1.Right - (R1.Right - R1.Left) div 2;
Inc(R1.Right);
ACanvas.Rectangle(R1);
Dec(R1.Right, ACanvas.Pen.Width);
Dec(R1.Bottom, ACanvas.Pen.Width);
ACanvas.Rectangle(R1);
R1 := ARect;
R1.Right := R1.Right - (R1.Right - R1.Left) div 2;
ACanvas.MoveTo(R1.Right, R1.Top);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -