📄 aqdockinguidefault.pas
字号:
ACanvas.LineTo(R1.Right, R1.Bottom + 1);
ACanvas.MoveTo(R1.Left, R1.Top + (R1.Bottom - R1.Top) div 2);
ACanvas.LineTo(R1.Right, R1.Top + (R1.Bottom - R1.Top) div 2);
end;
dbkUndock:
begin
ACanvas.Pen.Width := (ARect.Right - ARect.Left) div 5;
R1:= ARect;
Inc(R1.Left, (R1.Right - R1.Left) div 4);
Dec(R1.Bottom, (R1.Bottom - R1.Top) div 4 - 1);
ACanvas.Rectangle(R1);
Inc(R1.Top, ACanvas.Pen.Width);
ACanvas.Rectangle(R1);
ACanvas.MoveTo(ARect.Left, ARect.Top + (ARect.Bottom - ARect.Top) div 4 + ACanvas.Pen.Width);
ACanvas.LineTo(R1.Left, R1.Top + ACanvas.Pen.Width);
ACanvas.MoveTo(ARect.Left, ARect.Bottom);
ACanvas.LineTo(R1.Left, R1.Bottom);
ACanvas.MoveTo(ARect.Right - (ARect.Right - ARect.Left) div 4 - ACanvas.Pen.Width, ARect.Bottom);
ACanvas.LineTo(R1.Right - ACanvas.Pen.Width, R1.Bottom);
end;
dbkMaximize:
begin
ACanvas.Pen.Width := (ARect.Right - ARect.Left) div 5;
ACanvas.Rectangle(ARect);
Inc(ARect.Top, ACanvas.Pen.Width);
ACanvas.Rectangle(ARect);
end;
dbkRestore:
begin
ACanvas.Pen.Width := (ARect.Right - ARect.Left) div 5;
R1 := ARect;
R1.Left := ((R1.Right - R1.Left) div 2) + R1.Left - 1;
R1.Bottom := ((R1.Bottom - R1.Top) div 2) + R1.Top + 1;
ACanvas.Rectangle(R1);
R1 := ARect;
R1.Right := ((R1.Right - R1.Left) div 2) + R1.Left + 1;
R1.Top := ((R1.Bottom - R1.Top) div 2) + R1.Top - 1;
ACanvas.Rectangle(R1);
Inc(R1.Top, ACanvas.Pen.Width);
ACanvas.Rectangle(R1);
end;
dbkHelp:
begin
DefFont := TFont.Create;
try
{$IFDEF VCL}
DefFont.Name := 'Arial';
{$ENDIF}
ACanvas.Font.Assign(DefFont);
ACanvas.Font.Height := -(ARect.Bottom - ARect.Top);
finally
DefFont.Free;
end;
ACanvas.Font.Color := ACanvas.Pen.Color;
{$IFDEF VCL}
// CLX fix: the following code does not work in CLX.
ACanvas.Font.Style := ACanvas.Font.Style + [fsBold];
{$ELSE}
ACanvas.Font.Weight := fwBold;
{$ENDIF}
OutTextRect(ACanvas, ARect, 0, 0, '?', tlCenter, taCenter);
end;
dbkMenu:
begin
ACanvas.Brush.Color := ACanvas.Pen.Color;
ACanvas.Pen.Width := Max(1, (ARect.Right - ARect.Left) div 5);
pts[0].X := ARect.Left + (ARect.Right - ARect.Left) div 5;
pts[0].Y := ARect.Top + (ARect.Bottom - ARect.Top) div 2;
pts[1].X := ARect.Left + (ARect.Right - ARect.Left) div 2;
pts[1].Y := ARect.Bottom - (ARect.Bottom - ARect.Top) div 5;
pts[2].X := ARect.Right - (ARect.Right - ARect.Left) div 5;
pts[2].Y := pts[0].Y;
pts[3].X := pts[0].X;
pts[3].Y := pts[0].Y;
ACanvas.Polygon(pts);
end;
dbkCustom:
begin
ACanvas.Pen.Width := 1;
ACanvas.Pen.Style := psDot;
ACanvas.Brush.Style := bsClear;
ACanvas.Rectangle(ARect);
end;
end;
end;
end;
procedure TaqCustomDefaultUIStyle.DoDrawControl(ACanvas: TCanvas; ARect: TRect;
AKind: TaqDockControlDrawKind);
begin
ACanvas.FillRect(ARect);
end;
procedure TaqCustomDefaultUIStyle.DoDrawCaption(ACanvas: TCanvas; ARect: TRect;
const AText: string; AState: TaqDockCaptionState; AMaxTExtWidth: Integer;
var AFitText: Boolean; ADrawImage: Boolean; AImages: TCustomImageList; AImageIndex: Integer);
var
Color: TGradient;
begin
if AState = dcsFocused then
Color := ActiveCaptionColor
else
Color := CaptionColor;
Color.Fill(ACanvas, ARect, ARect);
ACanvas.Pen.Style := psSolid;
DrawEdge(ACanvas, ARect, esLowered, esNone, ebRect);
InflateRect(ARect, -1, -1);
DrawEdge(ACanvas, ARect, esNone, esRaised, ebRect);
InflateRect(ARect, -1, -1);
DoDrawCaptionContent(ACanvas, ARect, AText, AState, AMaxTextWidth, AFitText,
ADrawImage, AImages, AImageIndex);
end;
procedure TaqCustomDefaultUIStyle.DoDrawSplitter(ACanvas: TCanvas; ARect: TRect;
AOrientation: TaqSplitterOrientation);
const
Borders: array [TaqSplitterOrientation] of TaqEdgeBorders = (
[ebTop, ebBottom], [ebLeft, ebRight]);
begin
ACanvas.Brush.Style := bsSolid;
ACanvas.Brush.Color := SplitterColor;
ACanvas.FillRect(ARect);
if ((AOrientation = spoVertical) and (ARect.Bottom - ARect.Top > 0))
or ((AOrientation = spoHorizontal) and (ARect.Right - ARect.Left > 0)) then
DrawEdge(ACanvas, ARect, esLowered, esNone, Borders[AOrientation], SplitterColor);
end;
procedure TaqCustomDefaultUIStyle.SetTabColor(Value: TGradient);
begin
if Value <> nil then
FTabColor.Assign(Value)
else
FTabColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.SetCaptionColor(Value: TGradient);
begin
if Value <> nil then
FCaptionColor.Assign(Value)
else
FCaptionColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.SetImages(Value: TImageList);
begin
if Value <> FImages then
begin
if Images <> nil then Images.UnRegisterChanges(FImageChangeLink);
FImages := Value;
if Images <> nil then
begin
Images.RegisterChanges(FImageChangeLink);
Images.FreeNotification(Self);
end;
Change;
end;
end;
procedure TaqCustomDefaultUIStyle.GradientChange(Sender: TObject);
begin
Change;
end;
procedure TaqCustomDefaultUIStyle.SetActiveCaptionColor(Value: TGradient);
begin
if Value <> nil then
FActiveCaptionColor.Assign(Value)
else
FActiveCaptionColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.SetActiveTabColor(Value: TGradient);
begin
if Value <> nil then
FActiveTabColor.Assign(Value)
else
FActiveTabColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.SetTabPaneColor(Value: TGradient);
begin
if Value <> nil then
FTabPaneColor.Assign(Value)
else
FTabPaneColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.AssignTo(Dest: TPersistent);
begin
if Dest is TaqCustomDefaultUIStyle then
with TaqCustomDefaultUIStyle(Dest) do
begin
BeginUpdate;
try
inherited;
ActiveTabColor.Assign(Self.ActiveTabColor);
TabColor.Assign(Self.TabColor);
TabPaneColor.Assign(Self.TabPaneColor);
ActiveCaptionColor.Assign(Self.ActiveCaptionColor);
CaptionColor.Assign(Self.CaptionColor);
CaptionButtons := Self.CaptionButtons;
SplitterColor := Self.SplitterColor;
Images := Self.Images;
finally
EndUpdate;
end;
end
else
inherited;
end;
procedure TaqCustomDefaultUIStyle.SetCaptionButtons(Value: TaqCaptionButtonImages);
begin
if Value <> FCaptionButtons then
begin
if Value <> nil then
FCaptionButtons.Assign(Value)
else
FCaptionButtons.Reset;
end;
end;
procedure TaqCustomDefaultUIStyle.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if Operation = opRemove then
if AComponent = Images then
Images := nil;
end;
procedure TaqCustomDefaultUIStyle.ImagesChanged(Sender: TObject);
begin
Change;
end;
procedure TaqCustomDefaultUIStyle.SetSplitterColor(const Value: TColor);
begin
if FSplitterColor <> Value then
begin
FSplitterColor := Value;
Change;
end;
end;
function TaqCustomDefaultUIStyle.GetCaptionButtonImagesClass: TaqCaptionButtonImagesClass;
begin
Result := TaqCaptionButtonImages;
end;
procedure TaqCustomDefaultUIStyle.DoDrawHideZone(ACanvas: TCanvas;
ASiteRect, ARect: TRect; AOrientation: TaqHideZoneOrientation);
begin
HideZoneColor.Fill(ACanvas, ASiteRect, ARect);
end;
procedure TaqCustomDefaultUIStyle.SetHideZoneColor(const Value: TGradient);
begin
if Value <> nil then
FHideZoneColor.Assign(Value)
else
FHideZoneColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.DoDrawHiddenTabItem(ACanvas: TCanvas;
ARect: TRect; const AText: string; AState: TaqTabItemState;
AOrientation: TaqHideZoneOrientation; APosition: TaqTabItemPosition;
ADrawImage, ADrawText: Boolean; AImages: TCustomImageList; AImageIndex: Integer);
const
TabStates: array [TaqTabItemState] of TaqTabItemState =
// htsNormal, htsHot, htsSelected, htsDisabled, htsFocused
(tisNormal, tisHot, tisSelected, tisDisabled, tisFocused);
var
TopIndent: Integer;
FillRect: TRect;
SwapColors: Boolean;
TbColor: TGradient;
ActiveTab: Boolean;
begin
TopIndent := 2;
ActiveTab := AState in [tisSelected, tisFocused];
if ActiveTab then
TbColor := ActiveHiddenTabColor
else
TbColor := HiddenTabColor;
ACanvas.Pen.Style := psSolid;
if ActiveTab then
begin
FillRect := ARect;
case AOrientation of
hzoTop:
begin
Dec(FillRect.Bottom, TopIndent);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebBottom, ebRight], TbColor.StartColor);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebLeft], TbColor.StartColor);
Dec(FillRect.Bottom);
end;
hzoBottom:
begin
Inc(FillRect.Top, TopIndent);
DrawEdge(ACanvas, FillRect, esNone, esRaised, [ebTop, ebLeft], TbColor.StartColor);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebRight], TbColor.StartColor);
Inc(FillRect.Top);
end;
hzoLeft:
begin
Dec(FillRect.Right, TopIndent);
DrawEdge(ACanvas, FillRect, esRaised, esNone, [ebBottom, ebRight, ebTop], TbColor.StartColor);
Dec(FillRect.Right);
end;
hzoRight:
begin
Inc(FillRect.Left, TopIndent);
DrawEdge(ACanvas, FillRect, esFlat, esNone, [ebTop, ebLeft, ebBottom], TbColor.StartColor);
Inc(FillRect.Left);
end;
end;
if AOrientation in [hzoTop, hzoBottom] then
InflateRect(FillRect, -1, 0)
else
InflateRect(FillRect, 0, -1);
end
else
begin
ACanvas.Pen.Color := DarkColor(TbColor.StartColor);
case AOrientation of
hzoTop:
FillRect := Rect(ARect.Left - 1, ARect.Top, ARect.Right, ARect.Bottom - TopIndent);
hzoBottom:
FillRect := Rect(ARect.Left - 1, ARect.Top + TopIndent, ARect.Right, ARect.Bottom);
hzoLeft:
FillRect := Rect(ARect.Left, ARect.Top - 1, ARect.Right - TopIndent, ARect.Bottom);
hzoRight:
FillRect := Rect(ARect.Left + TopIndent, ARect.Top - 1, ARect.Right, ARect.Bottom);
end;
if AOrientation in [hzoTop, hzoBottom] then
begin
ACanvas.MoveTo(FillRect.Right - 1, FillRect.Top);
ACanvas.LineTo(FillRect.Right - 1, FillRect.Bottom);
Dec(FillRect.Right);
end
else
begin
ACanvas.MoveTo(FillRect.Left, FillRect.Bottom - 1);
ACanvas.LineTo(FillRect.Right, FillRect.Bottom - 1);
Dec(FillRect.Bottom);
end;
end;
if AOrientation in [hzoTop, hzoLeft] then
SwapColors := False
else if AOrientation = hzoBottom then
SwapColors := TbColor.FillType = gtVertical
else
SwapColors := TbColor.FillType = gtHorizontal;
TbColor.Fill(ACanvas, FillRect, FillRect, SwapColors);
DoDrawTabItemContent(ACanvas, FillRect, AText, TabStates[AState],
HOrientations[AOrientation], ADrawImage, ADrawText, HiddenTabFont,
ActiveHiddenTabFont, AImages, AImageIndex, False);
end;
procedure TaqCustomDefaultUIStyle.SetActiveHiddenTabColor(
const Value: TGradient);
begin
if Value <> nil then
FActiveHiddenTabColor.Assign(Value)
else
FActiveHiddenTabColor.Clear;
end;
procedure TaqCustomDefaultUIStyle.SetHiddenTabColor(
const Value: TGradient);
begin
if Value <> nil then
FHiddenTabColor.Assign(Value)
else
FHiddenTabColor.Clear;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -