You've already forked lazarus-ccr
SpkToolbar: Add new pane property "Style". Update appearance editor. Minor refactoring of pane drawing code.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5350 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -18,6 +18,10 @@ uses Graphics, Classes, Forms, SysUtils,
|
|||||||
SpkGUITools, SpkXMLParser, SpkXMLTools,
|
SpkGUITools, SpkXMLParser, SpkXMLTools,
|
||||||
spkt_Dispatch, spkt_Exceptions, spkt_Const;
|
spkt_Dispatch, spkt_Exceptions, spkt_Const;
|
||||||
|
|
||||||
|
type
|
||||||
|
TSpkPaneStyle = (psRectangleFlat, psRectangleEtched, psRectangleRaised,
|
||||||
|
psDividerFlat, psDividerEtched, psDividerRaised);
|
||||||
|
|
||||||
type TSpkTabAppearance = class(TPersistent)
|
type TSpkTabAppearance = class(TPersistent)
|
||||||
private
|
private
|
||||||
FDispatch : TSpkBaseAppearanceDispatch;
|
FDispatch : TSpkBaseAppearanceDispatch;
|
||||||
@ -67,14 +71,16 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
FGradientFromColor : TColor;
|
FGradientFromColor : TColor;
|
||||||
FGradientToColor : TColor;
|
FGradientToColor : TColor;
|
||||||
FGradientType : TBackgroundKind;
|
FGradientType : TBackgroundKind;
|
||||||
|
FStyle: TSpkPaneStyle;
|
||||||
|
|
||||||
|
procedure SetCaptionBgColor(const Value: TColor);
|
||||||
procedure SetCaptionFont(const Value: TFont);
|
procedure SetCaptionFont(const Value: TFont);
|
||||||
procedure SetBorderDarkColor(const Value: TColor);
|
procedure SetBorderDarkColor(const Value: TColor);
|
||||||
procedure SetBorderLightColor(const Value: TColor);
|
procedure SetBorderLightColor(const Value: TColor);
|
||||||
procedure SetGradientFromColor(const Value: TColor);
|
procedure SetGradientFromColor(const Value: TColor);
|
||||||
procedure SetGradientToColor(const Value: TColor);
|
procedure SetGradientToColor(const Value: TColor);
|
||||||
procedure SetGradientType(const Value: TBackgroundKind);
|
procedure SetGradientType(const Value: TBackgroundKind);
|
||||||
procedure SetCaptionBgColor(const Value: TColor);
|
procedure SetStyle(const Value: TSpkPaneStyle);
|
||||||
public
|
public
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
|
||||||
@ -90,6 +96,7 @@ type TSpkPaneAppearance = class(TPersistent)
|
|||||||
property GradientFromColor: TColor read FGradientFromColor write SetGradientFromColor;
|
property GradientFromColor: TColor read FGradientFromColor write SetGradientFromColor;
|
||||||
property GradientToColor: TColor read FGradientToColor write SetGradientToColor;
|
property GradientToColor: TColor read FGradientToColor write SetGradientToColor;
|
||||||
property GradientType: TBackgroundKind read FGradientType write SetGradientType;
|
property GradientType: TBackgroundKind read FGradientType write SetGradientType;
|
||||||
|
property Style: TSpkPaneStyle read FStyle write SetStyle default psRectangleEtched;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type TSpkElementAppearance = class(TPersistent)
|
type TSpkElementAppearance = class(TPersistent)
|
||||||
@ -414,6 +421,7 @@ begin
|
|||||||
FGradientFromColor := SrcAppearance.GradientFromColor;
|
FGradientFromColor := SrcAppearance.GradientFromColor;
|
||||||
FGradientToColor := SrcAppearance.GradientToColor;
|
FGradientToColor := SrcAppearance.GradientToColor;
|
||||||
FGradientType := SrcAppearance.GradientType;
|
FGradientType := SrcAppearance.GradientType;
|
||||||
|
FStyle := SrcAppearance.Style;
|
||||||
|
|
||||||
if FDispatch<>nil then
|
if FDispatch<>nil then
|
||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
@ -426,6 +434,7 @@ begin
|
|||||||
inherited Create;
|
inherited Create;
|
||||||
FDispatch:=ADispatch;
|
FDispatch:=ADispatch;
|
||||||
FCaptionFont:=TFont.Create;
|
FCaptionFont:=TFont.Create;
|
||||||
|
FStyle := psRectangleEtched;
|
||||||
Reset;
|
Reset;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -436,40 +445,43 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkPaneAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
|
var
|
||||||
var Subnode : TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not(assigned(Node)) then
|
if not(Assigned(Node)) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Subnode:=Node['CaptionFont',false];
|
Subnode := Node['CaptionFont', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
TSpkXMLTools.Load(Subnode, FCaptionFont);
|
TSpkXMLTools.Load(Subnode, FCaptionFont);
|
||||||
|
|
||||||
Subnode:=Node['BorderDarkColor',false];
|
Subnode := Node['BorderDarkColor', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FBorderDarkColor:=Subnode.TextAsColor;
|
FBorderDarkColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode:=Node['BorderLightColor',false];
|
Subnode := Node['BorderLightColor', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FBorderLightColor:=Subnode.TextAsColor;
|
FBorderLightColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode:=Node['CaptionBgColor',false];
|
Subnode := Node['CaptionBgColor', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FCaptionBgColor:=Subnode.TextAsColor;
|
FCaptionBgColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientFromColor',false];
|
Subnode := Node['GradientFromColor', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FGradientFromColor:=Subnode.TextAsColor;
|
FGradientFromColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientToColor',false];
|
Subnode := Node['GradientToColor', false];
|
||||||
if assigned(Subnode) then
|
if Assigned(Subnode) then
|
||||||
FGradientToColor:=Subnode.TextAsColor;
|
FGradientToColor := Subnode.TextAsColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientType',false];
|
Subnode := Node['GradientType', false];
|
||||||
if assigned(Subnode) then
|
if assigned(Subnode) then
|
||||||
FGradientType:=TBackgroundKind(Subnode.TextAsInteger);
|
FGradientType := TBackgroundKind(Subnode.TextAsInteger);
|
||||||
|
|
||||||
|
Subnode := Node['Style', false];
|
||||||
|
if Assigned(Subnode) then
|
||||||
|
FStyle := TSpkPaneStyle(SubNode.TextAsInteger);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.Reset;
|
procedure TSpkPaneAppearance.Reset;
|
||||||
@ -510,36 +522,39 @@ begin
|
|||||||
FGradientFromColor := rgb(222, 232, 245);
|
FGradientFromColor := rgb(222, 232, 245);
|
||||||
FGradientToColor := rgb(199, 216, 237);
|
FGradientToColor := rgb(199, 216, 237);
|
||||||
FGradientType := bkConcave;
|
FGradientType := bkConcave;
|
||||||
|
FStyle := psRectangleEtched;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.SaveToXML(Node: TSpkXMLNode);
|
procedure TSpkPaneAppearance.SaveToXML(Node: TSpkXMLNode);
|
||||||
|
var
|
||||||
var Subnode : TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not(assigned(Node)) then
|
if not(Assigned(Node)) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Subnode:=Node['CaptionFont',true];
|
Subnode := Node['CaptionFont',true];
|
||||||
TSpkXMLTools.Save(Subnode, FCaptionFont);
|
TSpkXMLTools.Save(Subnode, FCaptionFont);
|
||||||
|
|
||||||
Subnode:=Node['BorderDarkColor',true];
|
Subnode := Node['BorderDarkColor',true];
|
||||||
Subnode.TextAsColor:=FBorderDarkColor;
|
Subnode.TextAsColor := FBorderDarkColor;
|
||||||
|
|
||||||
Subnode:=Node['BorderLightColor',true];
|
Subnode := Node['BorderLightColor',true];
|
||||||
Subnode.TextAsColor:=FBorderLightColor;
|
Subnode.TextAsColor := FBorderLightColor;
|
||||||
|
|
||||||
Subnode:=Node['CaptionBgColor',true];
|
Subnode := Node['CaptionBgColor',true];
|
||||||
Subnode.TextAsColor:=FCaptionBgColor;
|
Subnode.TextAsColor := FCaptionBgColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientFromColor',true];
|
Subnode := Node['GradientFromColor',true];
|
||||||
Subnode.TextAsColor:=FGradientFromColor;
|
Subnode.TextAsColor := FGradientFromColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientToColor',true];
|
Subnode := Node['GradientToColor',true];
|
||||||
Subnode.TextAsColor:=FGradientToColor;
|
Subnode.TextAsColor := FGradientToColor;
|
||||||
|
|
||||||
Subnode:=Node['GradientType',true];
|
Subnode := Node['GradientType',true];
|
||||||
Subnode.TextAsInteger:=integer(FGradientType);
|
Subnode.TextAsInteger := integer(FGradientType);
|
||||||
|
|
||||||
|
Subnode := Node['Style', true];
|
||||||
|
Subnode.TextAsInteger := integer(FStyle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPaneAppearance.SetBorderDarkColor(const Value: TColor);
|
procedure TSpkPaneAppearance.SetBorderDarkColor(const Value: TColor);
|
||||||
@ -591,6 +606,13 @@ begin
|
|||||||
FDispatch.NotifyAppearanceChanged;
|
FDispatch.NotifyAppearanceChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkPaneAppearance.SetStyle(const Value: TSpkPaneStyle);
|
||||||
|
begin
|
||||||
|
FStyle := Value;
|
||||||
|
if FDispatch <> nil then
|
||||||
|
FDispatch.NotifyAppearanceChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkElementAppearance }
|
{ TSpkElementAppearance }
|
||||||
|
|
||||||
|
@ -224,136 +224,209 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkPane.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
procedure TSpkPane.Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
|
||||||
|
var
|
||||||
var x: Integer;
|
x: Integer;
|
||||||
y: Integer;
|
y: Integer;
|
||||||
BgFromColor, BgToColor, CaptionColor, FontColor, BorderLightColor,
|
BgFromColor, BgToColor, CaptionColor: TColor;
|
||||||
BorderDarkColor : TColor;
|
FontColor, BorderLightColor, BorderDarkColor, c: TColor;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
R: T2DIntRect;
|
||||||
begin
|
begin
|
||||||
// W niektórych warunkach nie jesteœmy w stanie rysowaæ:
|
// W niektórych warunkach nie jesteœmy w stanie rysowaæ:
|
||||||
// * Brak dyspozytora
|
// * Brak dyspozytora
|
||||||
if FToolbarDispatch=nil then
|
if FToolbarDispatch = nil then
|
||||||
exit;
|
exit;
|
||||||
// * Brak appearance
|
// * Brak appearance
|
||||||
if FAppearance=nil then
|
if FAppearance = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if FPaneState = psIdle then
|
if FPaneState = psIdle then
|
||||||
begin
|
begin
|
||||||
// psIdle
|
// psIdle
|
||||||
BgFromColor:=FAppearance.Pane.GradientFromColor;
|
BgFromColor:=FAppearance.Pane.GradientFromColor;
|
||||||
BgToColor:=FAppearance.Pane.GradientToColor;
|
BgToColor:=FAppearance.Pane.GradientToColor;
|
||||||
CaptionColor:=FAppearance.Pane.CaptionBgColor;
|
CaptionColor:=FAppearance.Pane.CaptionBgColor;
|
||||||
FontColor:=FAppearance.Pane.CaptionFont.Color;
|
FontColor:=FAppearance.Pane.CaptionFont.Color;
|
||||||
BorderLightColor:=FAppearance.Pane.BorderLightColor;
|
BorderLightColor:=FAppearance.Pane.BorderLightColor;
|
||||||
BorderDarkColor:=FAppearance.Pane.BorderDarkColor;
|
BorderDarkColor:=FAppearance.Pane.BorderDarkColor;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
// psHover
|
// psHover
|
||||||
BgFromColor:=TColorTools.Brighten(FAppearance.Pane.GradientFromColor,20);
|
BgFromColor:=TColorTools.Brighten(FAppearance.Pane.GradientFromColor,20);
|
||||||
BgToColor:=TColorTools.Brighten(FAppearance.Pane.GradientToColor,20);
|
BgToColor:=TColorTools.Brighten(FAppearance.Pane.GradientToColor,20);
|
||||||
CaptionColor:=TColorTools.Brighten(FAppearance.Pane.CaptionBgColor,20);
|
CaptionColor:=TColorTools.Brighten(FAppearance.Pane.CaptionBgColor,20);
|
||||||
FontColor:=TColorTools.Brighten(FAppearance.Pane.CaptionFont.Color,20);
|
FontColor:=TColorTools.Brighten(FAppearance.Pane.CaptionFont.Color,20);
|
||||||
BorderLightColor:=TColorTools.Brighten(FAppearance.Pane.BorderLightColor,20);
|
BorderLightColor:=TColorTools.Brighten(FAppearance.Pane.BorderLightColor,20);
|
||||||
BorderDarkColor:=TColorTools.Brighten(FAppearance.Pane.BorderDarkColor,20);
|
BorderDarkColor:=TColorTools.Brighten(FAppearance.Pane.BorderDarkColor,20);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// T³o
|
// T³o
|
||||||
TGuiTools.DrawRoundRect(ABuffer.Canvas,
|
{$IFDEF EnhancedRecordSupport}
|
||||||
{$IFDEF EnhancedRecordSupport}
|
R := T2DIntRect.Create(
|
||||||
T2DIntRect.Create(FRect.left,
|
{$ELSE}
|
||||||
FRect.top,
|
R := Create2DIntRect(
|
||||||
FRect.right - PaneBorderHalfSize,
|
{$ENDIF}
|
||||||
FRect.Bottom - PaneBorderHalfSize),
|
FRect.Left,
|
||||||
{$ELSE}
|
FRect.Top,
|
||||||
Create2DIntRect(FRect.left,
|
FRect.Right - PaneBorderHalfSize,
|
||||||
FRect.top,
|
FRect.Bottom - PaneBorderHalfSize
|
||||||
FRect.right - PaneBorderHalfSize,
|
);
|
||||||
FRect.Bottom - PaneBorderHalfSize),
|
TGuiTools.DrawRoundRect(
|
||||||
{$ENDIF}
|
ABuffer.Canvas,
|
||||||
PaneCornerRadius,
|
R,
|
||||||
BgFromColor,
|
PaneCornerRadius,
|
||||||
BgToColor,
|
BgFromColor,
|
||||||
FAppearance.Pane.GradientType,
|
BgToColor,
|
||||||
ClipRect);
|
FAppearance.Pane.GradientType,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
|
|
||||||
// T³o etykiety tafli
|
// T³o etykiety tafli
|
||||||
TGuiTools.DrawRoundRect(ABuffer.Canvas,
|
{$IFDEF EnhancedRecordSupport}
|
||||||
{$IFDEF EnhancedRecordSupport}
|
R := T2DIntRect.Create(
|
||||||
T2DIntRect.Create(FRect.Left,
|
{$ELSE}
|
||||||
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
|
R := Create2DIntRect(
|
||||||
FRect.right - PaneBorderHalfSize,
|
{$ENDIF}
|
||||||
FRect.bottom - PaneBorderHalfSize),
|
FRect.Left,
|
||||||
{$ELSE}
|
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
|
||||||
Create2DIntRect(FRect.Left,
|
FRect.Right - PaneBorderHalfSize,
|
||||||
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
|
FRect.Bottom - PaneBorderHalfSize
|
||||||
FRect.Right - PaneBorderHalfSize,
|
);
|
||||||
FRect.Bottom - PaneBorderHalfSize),
|
TGuiTools.DrawRoundRect(
|
||||||
{$ENDIF}
|
ABuffer.Canvas,
|
||||||
PaneCornerRadius,
|
R,
|
||||||
CaptionColor,
|
PaneCornerRadius,
|
||||||
clNone,
|
CaptionColor,
|
||||||
bkSolid,
|
clNone,
|
||||||
ClipRect,
|
bkSolid,
|
||||||
false,
|
ClipRect,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
true);
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Etykieta tafli
|
// Etykieta tafli
|
||||||
ABuffer.Canvas.Font.assign(FAppearance.Pane.CaptionFont);
|
ABuffer.Canvas.Font.Assign(FAppearance.Pane.CaptionFont);
|
||||||
x:=FRect.left + (FRect.width - ABuffer.Canvas.TextWidth(FCaption)) div 2;
|
x := FRect.Left + (FRect.Width - ABuffer.Canvas.TextWidth(FCaption)) div 2;
|
||||||
y:=FRect.Bottom - PaneBorderSize - PaneCaptionHeight + 1 +
|
y := FRect.Bottom - PaneBorderSize - PaneCaptionHeight + 1 +
|
||||||
(PaneCaptionHeight - ABuffer.Canvas.TextHeight('Wy')) div 2;
|
(PaneCaptionHeight - ABuffer.Canvas.TextHeight('Wy')) div 2;
|
||||||
|
|
||||||
TGUITools.DrawText(ABuffer.Canvas,
|
TGUITools.DrawText(
|
||||||
x,
|
ABuffer.Canvas,
|
||||||
y,
|
x,
|
||||||
FCaption,
|
y,
|
||||||
FontColor,
|
FCaption,
|
||||||
ClipRect);
|
FontColor,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
|
|
||||||
// Ramki
|
// Frames
|
||||||
TGUITools.DrawAARoundFrame(ABuffer,
|
case FAppearance.Pane.Style of
|
||||||
{$IFDEF EnhancedRecordSupport}
|
psRectangleFlat:
|
||||||
T2DIntRect.create(FRect.left+1,
|
begin
|
||||||
FRect.top+1,
|
{$IFDEF EnhancedRecordSupport}
|
||||||
FRect.Right,
|
R := T2DIntRect.Create(
|
||||||
FRect.bottom),
|
{$ELSE}
|
||||||
{$ELSE}
|
R := Create2DIntRect(
|
||||||
Create2DIntRect(FRect.left+1,
|
{$ENDIF}
|
||||||
FRect.top+1,
|
FRect.Left,
|
||||||
FRect.Right,
|
FRect.Top,
|
||||||
FRect.bottom),
|
FRect.Right,
|
||||||
{$ENDIF}
|
FRect.bottom
|
||||||
PaneCornerRadius,
|
);
|
||||||
BorderLightColor,
|
TGUITools.DrawAARoundFrame(
|
||||||
ClipRect);
|
ABuffer,
|
||||||
TGUITools.DrawAARoundFrame(ABuffer,
|
R,
|
||||||
{$IFDEF EnhancedRecordSupport}
|
PaneCornerRadius,
|
||||||
T2DIntRect.create(FRect.left,
|
BorderDarkColor,
|
||||||
FRect.top,
|
ClipRect
|
||||||
FRect.Right-1,
|
);
|
||||||
FRect.bottom-1),
|
end;
|
||||||
{$ELSE}
|
|
||||||
Create2DIntRect(FRect.left,
|
|
||||||
FRect.top,
|
|
||||||
FRect.Right-1,
|
|
||||||
FRect.bottom-1),
|
|
||||||
{$ENDIF}
|
|
||||||
PaneCornerRadius,
|
|
||||||
BorderDarkColor,
|
|
||||||
ClipRect);
|
|
||||||
|
|
||||||
// Elementy
|
psRectangleEtched, psRectangleRaised:
|
||||||
if FItems.Count>0 then
|
begin
|
||||||
for i := 0 to FItems.Count - 1 do
|
{$IFDEF EnhancedRecordSupport}
|
||||||
begin
|
R := T2DIntRect.Create(
|
||||||
if FItems[i].Visible then
|
{$ELSE}
|
||||||
Fitems[i].Draw(ABuffer, ClipRect);
|
R := Create2DIntRect(
|
||||||
end;
|
{$ENDIF}
|
||||||
|
FRect.Left + 1,
|
||||||
|
FRect.Top + 1,
|
||||||
|
FRect.Right,
|
||||||
|
FRect.bottom
|
||||||
|
);
|
||||||
|
if FAppearance.Pane.Style = psRectangleEtched then
|
||||||
|
c := BorderLightColor else
|
||||||
|
c := BorderDarkColor;
|
||||||
|
TGUITools.DrawAARoundFrame(
|
||||||
|
ABuffer,
|
||||||
|
R,
|
||||||
|
PaneCornerRadius,
|
||||||
|
c,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
|
|
||||||
|
{$IFDEF EnhancedRecordSupport}
|
||||||
|
R := T2DIntRect.Create(
|
||||||
|
{$ELSE}
|
||||||
|
R := Create2DIntRect(
|
||||||
|
{$ENDIF}
|
||||||
|
FRect.Left,
|
||||||
|
FRect.Top,
|
||||||
|
FRect.Right-1,
|
||||||
|
FRect.Bottom-1
|
||||||
|
);
|
||||||
|
if FAppearance.Pane.Style = psRectangleEtched then
|
||||||
|
c := BorderDarkColor else
|
||||||
|
c := BorderLightColor;
|
||||||
|
TGUITools.DrawAARoundFrame(
|
||||||
|
ABuffer,
|
||||||
|
R,
|
||||||
|
PaneCornerRadius,
|
||||||
|
c,
|
||||||
|
ClipRect
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
psDividerRaised, psDividerEtched:
|
||||||
|
begin
|
||||||
|
if FAppearance.Pane.Style = psDividerRaised then
|
||||||
|
c := BorderLightColor else
|
||||||
|
c := BorderDarkColor;
|
||||||
|
TGUITools.DrawVLine(
|
||||||
|
ABuffer,
|
||||||
|
FRect.Right + PaneBorderHalfSize - 1,
|
||||||
|
FRect.Top,
|
||||||
|
FRect.Bottom,
|
||||||
|
c
|
||||||
|
);
|
||||||
|
if FAppearance.Pane.Style = psDividerRaised then
|
||||||
|
c := BorderDarkColor else
|
||||||
|
c := BorderLightColor;
|
||||||
|
TGUITools.DrawVLine(
|
||||||
|
ABuffer,
|
||||||
|
FRect.Right + PaneBorderHalfSize,
|
||||||
|
FRect.Top,
|
||||||
|
FRect.Bottom,
|
||||||
|
c
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
psDividerFlat:
|
||||||
|
TGUITools.DrawVLine(
|
||||||
|
ABuffer,
|
||||||
|
FRect.Right + PaneBorderHalfSize,
|
||||||
|
FRect.Top,
|
||||||
|
FRect.Bottom,
|
||||||
|
BorderDarkColor
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Elementy
|
||||||
|
for i := 0 to FItems.Count - 1 do
|
||||||
|
if FItems[i].Visible then
|
||||||
|
Fitems[i].Draw(ABuffer, ClipRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkPane.FindItemAt(x, y : integer) : integer;
|
function TSpkPane.FindItemAt(x, y : integer) : integer;
|
||||||
|
@ -9,8 +9,10 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
|
|||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
Font.Height = -12
|
Font.Height = -12
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
|
ShowHint = True
|
||||||
LCLVersion = '1.7'
|
LCLVersion = '1.7'
|
||||||
object gbPreview: TGroupBox
|
object gbPreview: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -319,14 +321,14 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
|
|||||||
Height = 347
|
Height = 347
|
||||||
Top = 132
|
Top = 132
|
||||||
Width = 536
|
Width = 536
|
||||||
ActivePage = TabSheet3
|
ActivePage = TabSheet2
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabIndex = 2
|
TabIndex = 1
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
Caption = 'Tab'
|
Caption = 'Tab'
|
||||||
ClientHeight = 326
|
ClientHeight = 319
|
||||||
ClientWidth = 549
|
ClientWidth = 528
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
AnchorSideTop.Control = pTabFrame
|
AnchorSideTop.Control = pTabFrame
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
@ -677,6 +679,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
|
|||||||
Width = 137
|
Width = 137
|
||||||
BorderSpacing.Left = 12
|
BorderSpacing.Left = 12
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
|
Visible = False
|
||||||
end
|
end
|
||||||
object pPaneBorderDark: TPanel
|
object pPaneBorderDark: TPanel
|
||||||
AnchorSideLeft.Control = cbLinkPane
|
AnchorSideLeft.Control = cbLinkPane
|
||||||
@ -821,6 +824,46 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
|
|||||||
OnClick = cbLinkPaneClick
|
OnClick = cbLinkPaneClick
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
|
object cbPaneStyle: TComboBox
|
||||||
|
AnchorSideLeft.Control = pPaneCaptionFont
|
||||||
|
AnchorSideTop.Control = pPaneCaptionFont
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = pPaneCaptionFontColor
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 141
|
||||||
|
Height = 23
|
||||||
|
Top = 265
|
||||||
|
Width = 121
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
ItemHeight = 15
|
||||||
|
ItemIndex = 1
|
||||||
|
Items.Strings = (
|
||||||
|
'Rectangle flat'
|
||||||
|
'Rectangle etched'
|
||||||
|
'Rectangle raised'
|
||||||
|
'Divider flat'
|
||||||
|
'Divider etched'
|
||||||
|
'Divider raised'
|
||||||
|
)
|
||||||
|
OnChange = cbPaneStyleChange
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 9
|
||||||
|
Text = 'Rectangle etched'
|
||||||
|
end
|
||||||
|
object Label12: TLabel
|
||||||
|
AnchorSideTop.Control = cbPaneStyle
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = LblCaptionBackground
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 68
|
||||||
|
Height = 15
|
||||||
|
Top = 269
|
||||||
|
Width = 53
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Pane style'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object TabSheet3: TTabSheet
|
object TabSheet3: TTabSheet
|
||||||
Caption = 'Item'
|
Caption = 'Item'
|
||||||
|
@ -16,7 +16,9 @@ type
|
|||||||
{ TfrmAppearanceEditWindow }
|
{ TfrmAppearanceEditWindow }
|
||||||
|
|
||||||
TfrmAppearanceEditWindow = class(TForm)
|
TfrmAppearanceEditWindow = class(TForm)
|
||||||
|
cbPaneStyle: TComboBox;
|
||||||
gbPreview: TGroupBox;
|
gbPreview: TGroupBox;
|
||||||
|
Label12: TLabel;
|
||||||
SmallImages: TImageList;
|
SmallImages: TImageList;
|
||||||
LargeImages: TImageList;
|
LargeImages: TImageList;
|
||||||
Label18: TLabel;
|
Label18: TLabel;
|
||||||
@ -128,9 +130,11 @@ type
|
|||||||
procedure cbItemActiveGradientKindChange(Sender: TObject);
|
procedure cbItemActiveGradientKindChange(Sender: TObject);
|
||||||
procedure cbItemHottrackGradientKindChange(Sender: TObject);
|
procedure cbItemHottrackGradientKindChange(Sender: TObject);
|
||||||
procedure cbItemIdleGradientKindChange(Sender: TObject);
|
procedure cbItemIdleGradientKindChange(Sender: TObject);
|
||||||
procedure cbTabGradientKindChange(Sender: TObject);
|
|
||||||
procedure cbPaneGradientKindChange(Sender: TObject);
|
procedure cbPaneGradientKindChange(Sender: TObject);
|
||||||
|
procedure cbPaneStyleChange(Sender: TObject);
|
||||||
|
procedure cbTabGradientKindChange(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
|
|
||||||
@ -207,6 +211,9 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
var
|
||||||
|
CurrPageIndex: Integer = 0;
|
||||||
|
|
||||||
{ TForm3 }
|
{ TForm3 }
|
||||||
|
|
||||||
procedure TfrmAppearanceEditWindow.SetAppearance(const Value: TSpkToolbarAppearance);
|
procedure TfrmAppearanceEditWindow.SetAppearance(const Value: TSpkToolbarAppearance);
|
||||||
@ -362,6 +369,12 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAppearanceEditWindow.FormCloseQuery(Sender: TObject;
|
||||||
|
var CanClose: boolean);
|
||||||
|
begin
|
||||||
|
if CanClose then CurrPageIndex := PageControl1.PageIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAppearanceEditWindow.FormCreate(Sender: TObject);
|
procedure TfrmAppearanceEditWindow.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
bOK.AutoSize := false;
|
bOK.AutoSize := false;
|
||||||
@ -369,6 +382,8 @@ begin
|
|||||||
|
|
||||||
LargeImages.AddIcon(Application.Icon);
|
LargeImages.AddIcon(Application.Icon);
|
||||||
SmallImages.AddIcon(Application.Icon);
|
SmallImages.AddIcon(Application.Icon);
|
||||||
|
|
||||||
|
PageControl1.PageIndex := CurrPageIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmAppearanceEditWindow.FormShow(Sender: TObject);
|
procedure TfrmAppearanceEditWindow.FormShow(Sender: TObject);
|
||||||
@ -406,6 +421,7 @@ begin
|
|||||||
SetPanelColor(pPaneCaptionBackground, CaptionBgColor);
|
SetPanelColor(pPaneCaptionBackground, CaptionBgColor);
|
||||||
SetPanelFont(pPaneCaptionFont, CaptionFont);
|
SetPanelFont(pPaneCaptionFont, CaptionFont);
|
||||||
SetPanelColor(pPaneCaptionFontColor, CaptionFont.Color);
|
SetPanelColor(pPaneCaptionFontColor, CaptionFont.Color);
|
||||||
|
cbPaneStyle.ItemIndex := ord(Style);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with Element do
|
with Element do
|
||||||
@ -671,6 +687,12 @@ begin
|
|||||||
SetLinkedGradientKind((Sender as TComboBox).ItemIndex);
|
SetLinkedGradientKind((Sender as TComboBox).ItemIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAppearanceEditWindow.cbPaneStyleChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
with tbPreview.Appearance.Pane do
|
||||||
|
Style := TSpkPaneStyle((Sender as TCombobox).ItemIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAppearanceEditWindow.pPaneGradientToClick(Sender: TObject);
|
procedure TfrmAppearanceEditWindow.pPaneGradientToClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if ChangeColor(Sender as TPanel) then
|
if ChangeColor(Sender as TPanel) then
|
||||||
|
Reference in New Issue
Block a user