SpkToolbar: Add new property Style to Appearance.Element (esRounded, esRectangle). Refactoring of Button drawing. Lots of cosmetic changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5354 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-11-16 18:56:23 +00:00
parent 588166bb4c
commit 9e82f074d9
7 changed files with 1270 additions and 1872 deletions

View File

@ -2218,11 +2218,10 @@ class procedure TGUITools.DrawRoundRect(ACanvas: TCanvas; Rect: T2DIntRect;
Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind; Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind;
ClipRect: T2DIntRect; LeftTopRound, RightTopRound, LeftBottomRound, ClipRect: T2DIntRect; LeftTopRound, RightTopRound, LeftBottomRound,
RightBottomRound: boolean); RightBottomRound: boolean);
var
var UseOrgClipRgn : boolean; UseOrgClipRgn: boolean;
ClipRgn: HRGN; ClipRgn: HRGN;
OrgRgn: HRGN; OrgRgn: HRGN;
begin begin
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego // Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn); SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
@ -2243,10 +2242,10 @@ end;
class procedure TGUITools.DrawText(ACanvas: TCanvas; x, y: integer; class procedure TGUITools.DrawText(ACanvas: TCanvas; x, y: integer;
const AText: string; TextColor: TColor); const AText: string; TextColor: TColor);
begin begin
with Acanvas do with ACanvas do
begin begin
brush.style:=bsClear; Brush.Style := bsClear;
font.color:=TextColor; Font.Color := TextColor;
TextOut(x, y, AText); TextOut(x, y, AText);
end; end;
end; end;
@ -2269,32 +2268,36 @@ end;
class procedure TGUITools.DrawRoundRect(ACanvas: TCanvas; Rect: T2DIntRect; class procedure TGUITools.DrawRoundRect(ACanvas: TCanvas; Rect: T2DIntRect;
Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind; Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind;
LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound: boolean); LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound: boolean);
var
var RoundRgn : HRGN; RoundRgn: HRGN;
TmpRgn: HRGN; TmpRgn: HRGN;
OrgRgn: HRGN; OrgRgn: HRGN;
UseOrgClipRgn: Boolean; UseOrgClipRgn: Boolean;
begin begin
if Radius<1 then if Radius < 0 then
exit; exit;
if Radius > 0 then
begin
//WriteLn('Radius: ', Radius, ' Rect.Width: ', Rect.Width, ' Rect.Height: ', Rect.Height); //WriteLn('Radius: ', Radius, ' Rect.Width: ', Rect.Width, ' Rect.Height: ', Rect.Height);
//there's a bug in fpc that evaluates the expression below erroneous when using inline // There's a bug in fpc that evaluates the expression below erroneous when using inline
// Radius = 3 and Rect.Width >= 128 and <= 261 will evaluate to true // Radius = 3 and Rect.Width >= 128 and <= 261 will evaluate to true
{$ifdef FpcBugWorkAround} {$ifdef FpcBugWorkAround}
if (CompareValue(Radius*2, Rect.width) > 0) and (CompareValue(Radius*2, Rect.Height) > 0) then if (CompareValue(Radius*2, Rect.width) > 0) and (CompareValue(Radius*2, Rect.Height) > 0) then
exit; exit;
{$else} {$else}
if (Radius*2>Rect.width) or (Radius*2>Rect.height) then if (Radius*2 > Rect.Width) or (Radius*2 > Rect.Height) then
exit; exit;
{$endif} {$endif}
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego // Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn); SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
if not(LeftTopRound) and not(RightTopRound) and not(LeftBottomRound) and not (RightBottomRound) then if not(LeftTopRound) and
not(RightTopRound) and
not(LeftBottomRound) and
not (RightBottomRound) then
begin begin
RoundRgn := CreateRectRgn(Rect.Left, Rect.Top, Rect.Right + 1, Rect.Bottom + 1); RoundRgn := CreateRectRgn(Rect.Left, Rect.Top, Rect.Right + 1, Rect.Bottom + 1);
end end
@ -2304,28 +2307,28 @@ else
if not(LeftTopRound) then if not(LeftTopRound) then
begin begin
TmpRgn:=CreateRectRgn(Rect.left, Rect.Top, Rect.left + Radius, Rect.Top + Radius); TmpRgn := CreateRectRgn(Rect.Left, Rect.Top, Rect.Left + Radius, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR); CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn); DeleteObject(TmpRgn);
end; end;
if not(RightTopRound) then if not(RightTopRound) then
begin begin
TmpRgn:=CreateRectRgn(Rect.right - Radius + 1, Rect.Top, Rect.Right + 1, Rect.Top + Radius); TmpRgn := CreateRectRgn(Rect.Right - Radius + 1, Rect.Top, Rect.Right + 1, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR); CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn); DeleteObject(TmpRgn);
end; end;
if not(LeftBottomRound) then if not(LeftBottomRound) then
begin begin
TmpRgn:=CreateRectRgn(Rect.left, Rect.Bottom - Radius + 1, Rect.Left + Radius, Rect.Bottom + 1); TmpRgn := CreateRectRgn(Rect.Left, Rect.Bottom - Radius + 1, Rect.Left + Radius, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR); CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn); DeleteObject(TmpRgn);
end; end;
if not(RightBottomRound) then if not(RightBottomRound) then
begin begin
TmpRgn:=CreateRectRgn(Rect.right - Radius + 1, Rect.Bottom - Radius + 1, Rect.Right + 1, Rect.Bottom + 1); TmpRgn := CreateRectRgn(Rect.Right - Radius + 1, Rect.Bottom - Radius + 1, Rect.Right + 1, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR); CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn); DeleteObject(TmpRgn);
end; end;
@ -2335,16 +2338,20 @@ if UseOrgClipRgn then
CombineRgn(RoundRgn, RoundRgn, OrgRgn, RGN_AND); CombineRgn(RoundRgn, RoundRgn, OrgRgn, RGN_AND);
SelectClipRgn(ACanvas.Handle, RoundRgn); SelectClipRgn(ACanvas.Handle, RoundRgn);
end; // if Radius > 0
ColorFrom := ColorToRGB(ColorFrom); ColorFrom := ColorToRGB(ColorFrom);
ColorTo := ColorToRGB(ColorTo); ColorTo := ColorToRGB(ColorTo);
FillGradientRectangle(ACanvas, Rect, ColorFrom, ColorTo, GradientKind); FillGradientRectangle(ACanvas, Rect, ColorFrom, ColorTo, GradientKind);
if Radius > 0 then
begin
// Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów // Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn); RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(RoundRgn); DeleteObject(RoundRgn);
end; end;
end;
class procedure TGUITools.DrawOutlinedText(ABitmap: TBitmap; x, y: integer; class procedure TGUITools.DrawOutlinedText(ABitmap: TBitmap; x, y: integer;
const AText: string; TextColor, OutlineColor: TColor); const AText: string; TextColor, OutlineColor: TColor);

View File

@ -22,6 +22,8 @@ type
TSpkPaneStyle = (psRectangleFlat, psRectangleEtched, psRectangleRaised, TSpkPaneStyle = (psRectangleFlat, psRectangleEtched, psRectangleRaised,
psDividerFlat, psDividerEtched, psDividerRaised); psDividerFlat, psDividerEtched, psDividerRaised);
TSpkElementStyle = (esRounded, esRectangle);
type TSpkTabAppearance = class(TPersistent) type TSpkTabAppearance = class(TPersistent)
private private
FDispatch: TSpkBaseAppearanceDispatch; FDispatch: TSpkBaseAppearanceDispatch;
@ -104,7 +106,6 @@ type TSpkPaneAppearance = class(TPersistent)
type TSpkElementAppearance = class(TPersistent) type TSpkElementAppearance = class(TPersistent)
private private
FDispatch: TSpkBaseAppearanceDispatch; FDispatch: TSpkBaseAppearanceDispatch;
protected
FCaptionFont: TFont; FCaptionFont: TFont;
FIdleFrameColor: TColor; FIdleFrameColor: TColor;
FIdleGradientFromColor: TColor; FIdleGradientFromColor: TColor;
@ -127,7 +128,7 @@ type TSpkElementAppearance = class(TPersistent)
FActiveInnerLightColor: TColor; FActiveInnerLightColor: TColor;
FActiveInnerDarkColor: TColor; FActiveInnerDarkColor: TColor;
FActiveCaptionColor: TColor; FActiveCaptionColor: TColor;
FStyle: TSpkElementStyle;
procedure SetActiveCaptionColor(const Value: TColor); procedure SetActiveCaptionColor(const Value: TColor);
procedure SetActiveFrameColor(const Value: TColor); procedure SetActiveFrameColor(const Value: TColor);
procedure SetActiveGradientFromColor(const Value: TColor); procedure SetActiveGradientFromColor(const Value: TColor);
@ -150,6 +151,7 @@ type TSpkElementAppearance = class(TPersistent)
procedure SetIdleGradientType(const Value: TBackgroundKind); procedure SetIdleGradientType(const Value: TBackgroundKind);
procedure SetIdleInnerDarkColor(const Value: TColor); procedure SetIdleInnerDarkColor(const Value: TColor);
procedure SetIdleInnerLightColor(const Value: TColor); procedure SetIdleInnerLightColor(const Value: TColor);
procedure SetStyle(const Value: TSpkElementStyle);
public public
constructor Create(ADispatch: TSpkBaseAppearanceDispatch); constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
destructor Destroy; override; destructor Destroy; override;
@ -181,6 +183,7 @@ type TSpkElementAppearance = class(TPersistent)
property ActiveInnerLightColor: TColor read FActiveInnerLightColor write SetActiveInnerLightColor; property ActiveInnerLightColor: TColor read FActiveInnerLightColor write SetActiveInnerLightColor;
property ActiveInnerDarkColor: TColor read FActiveInnerDarkColor write SetActiveInnerDarkColor; property ActiveInnerDarkColor: TColor read FActiveInnerDarkColor write SetActiveInnerDarkColor;
property ActiveCaptionColor: TColor read FActiveCaptionColor write SetActiveCaptionColor; property ActiveCaptionColor: TColor read FActiveCaptionColor write SetActiveCaptionColor;
property Style: TSpkElementStyle read FStyle write SetStyle;
end; end;
type TSpkToolbarAppearance = class; type TSpkToolbarAppearance = class;
@ -220,6 +223,7 @@ type TSpkToolbarAppearance = class;
property Element: TSpkElementAppearance read FElement write SetElementAppearance; property Element: TSpkElementAppearance read FElement write SetElementAppearance;
end; end;
procedure SetDefaultFont(AFont: TFont);
implementation implementation
@ -317,36 +321,8 @@ end;
procedure TSpkTabAppearance.Reset; procedure TSpkTabAppearance.Reset;
begin begin
if screen.fonts.IndexOf('Calibri') >= 0 then SetDefaultFont(FTabHeaderFont);
begin FTabHeaderFont.Size := FTabHeaderFont.Size + 1;
FTabHeaderFont.Charset := DEFAULT_CHARSET;
FTabHeaderFont.Color := rgb(21, 66, 139);
FTabHeaderFont.Name := 'Calibri';
FTabHeaderFont.Orientation := 0;
FTabHeaderFont.Pitch := fpDefault;
FTabHeaderFont.Size := 10;
FTabHeaderFont.Style := [];
end
else if screen.fonts.IndexOf('Verdana') >= 0 then
begin
FTabHeaderFont.Charset := DEFAULT_CHARSET;
FTabHeaderFont.Color := rgb(21, 66, 139);
FTabHeaderFont.Name := 'Verdana';
FTabHeaderFont.Orientation := 0;
FTabHeaderFont.Pitch := fpDefault;
FTabHeaderFont.Size := 10;
FTabHeaderFont.Style := [];
end
else
begin
FTabHeaderFont.Charset := DEFAULT_CHARSET;
FTabHeaderFont.Color := rgb(21, 66, 139);
FTabHeaderFont.Name := 'Arial';
FTabHeaderFont.Orientation := 0;
FTabHeaderFont.Pitch := fpDefault;
FTabHeaderFont.Size := 10;
FTabHeaderFont.Style := [];
end;
FBorderColor := rgb(141, 178, 227); FBorderColor := rgb(141, 178, 227);
FGradientFromColor := rgb(222, 232, 245); FGradientFromColor := rgb(222, 232, 245);
FGradientToColor := rgb(199, 216, 237); FGradientToColor := rgb(199, 216, 237);
@ -520,36 +496,7 @@ end;
procedure TSpkPaneAppearance.Reset; procedure TSpkPaneAppearance.Reset;
begin begin
if screen.fonts.IndexOf('Calibri') >= 0 then SetDefaultFont(FCaptionFont);
begin
FCaptionFont.Name := 'Calibri';
FCaptionFont.Size := 9;
FCaptionFont.color := rgb(62, 106, 170);
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
end
else if screen.fonts.IndexOf('Verdana') >= 0 then
begin
FCaptionFont.Name := 'Verdana';
FCaptionFont.Size := 9;
FCaptionFont.color := rgb(62, 106, 170);
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
end
else
begin
FCaptionFont.Name := 'Arial';
FCaptionFont.Size := 9;
FCaptionFont.color := rgb(62, 106, 170);
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
end;
FBorderDarkColor := rgb(158, 190, 218); FBorderDarkColor := rgb(158, 190, 218);
FBorderLightColor := rgb(237, 242, 248); FBorderLightColor := rgb(237, 242, 248);
FCaptionBgColor := rgb(194, 217, 241); FCaptionBgColor := rgb(194, 217, 241);
@ -667,15 +614,14 @@ end;
{ TSpkElementAppearance } { TSpkElementAppearance }
procedure TSpkElementAppearance.Assign(Source: TPersistent); procedure TSpkElementAppearance.Assign(Source: TPersistent);
var
var SrcAppearance : TSpkElementAppearance; SrcAppearance: TSpkElementAppearance;
begin begin
if Source is TSpkElementAppearance then if Source is TSpkElementAppearance then
begin begin
SrcAppearance := TSpkElementAppearance(Source); SrcAppearance := TSpkElementAppearance(Source);
FCaptionFont.assign(SrcAppearance.CaptionFont); FCaptionFont.Assign(SrcAppearance.CaptionFont);
FIdleFrameColor := SrcAppearance.IdleFrameColor; FIdleFrameColor := SrcAppearance.IdleFrameColor;
FIdleGradientFromColor := SrcAppearance.IdleGradientFromColor; FIdleGradientFromColor := SrcAppearance.IdleGradientFromColor;
FIdleGradientToColor := SrcAppearance.IdleGradientToColor; FIdleGradientToColor := SrcAppearance.IdleGradientToColor;
@ -697,6 +643,7 @@ begin
FActiveInnerLightColor := SrcAppearance.ActiveInnerLightColor; FActiveInnerLightColor := SrcAppearance.ActiveInnerLightColor;
FActiveInnerDarkColor := SrcAppearance.ActiveInnerDarkColor; FActiveInnerDarkColor := SrcAppearance.ActiveInnerDarkColor;
FActiveCaptionColor := SrcAppearance.ActiveCaptionColor; FActiveCaptionColor := SrcAppearance.ActiveCaptionColor;
FStyle := SrcAppearance.Style;
if FDispatch <> nil then if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
@ -707,11 +654,8 @@ end;
constructor TSpkElementAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch); constructor TSpkElementAppearance.Create(ADispatch: TSpkBaseAppearanceDispatch);
begin begin
inherited Create; inherited Create;
FDispatch := ADispatch; FDispatch := ADispatch;
FCaptionFont := TFont.Create; FCaptionFont := TFont.Create;
Reset; Reset;
end; end;
@ -722,141 +666,113 @@ begin
end; end;
procedure TSpkElementAppearance.LoadFromXML(Node: TSpkXMLNode); procedure TSpkElementAppearance.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);
// *** Idle *** // Idle
Subnode := Node['IdleFrameColor', false]; Subnode := Node['IdleFrameColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleFrameColor := Subnode.TextAsColor; FIdleFrameColor := Subnode.TextAsColor;
Subnode := Node['IdleGradientFromColor', false]; Subnode := Node['IdleGradientFromColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleGradientFromColor := Subnode.TextAsColor; FIdleGradientFromColor := Subnode.TextAsColor;
Subnode := Node['IdleGradientToColor', false]; Subnode := Node['IdleGradientToColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleGradientToColor := Subnode.TextAsColor; FIdleGradientToColor := Subnode.TextAsColor;
Subnode := Node['IdleGradientType', false]; Subnode := Node['IdleGradientType', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleGradientType := TBackgroundKind(Subnode.TextAsInteger); FIdleGradientType := TBackgroundKind(Subnode.TextAsInteger);
Subnode := Node['IdleInnerLightColor', false]; Subnode := Node['IdleInnerLightColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleInnerLightColor := Subnode.TextAsColor; FIdleInnerLightColor := Subnode.TextAsColor;
Subnode := Node['IdleInnerDarkColor', false]; Subnode := Node['IdleInnerDarkColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleInnerDarkColor := Subnode.TextAsColor; FIdleInnerDarkColor := Subnode.TextAsColor;
Subnode := Node['IdleCaptionColor', false]; Subnode := Node['IdleCaptionColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FIdleCaptionColor := Subnode.TextAsColor; FIdleCaptionColor := Subnode.TextAsColor;
// *** Hottrack *** // Hottrack
Subnode := Node['HottrackFrameColor', false]; Subnode := Node['HottrackFrameColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackFrameColor := Subnode.TextAsColor; FHottrackFrameColor := Subnode.TextAsColor;
Subnode := Node['HottrackGradientFromColor', false]; Subnode := Node['HottrackGradientFromColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackGradientFromColor := Subnode.TextAsColor; FHottrackGradientFromColor := Subnode.TextAsColor;
Subnode := Node['HottrackGradientToColor', false]; Subnode := Node['HottrackGradientToColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackGradientToColor := Subnode.TextAsColor; FHottrackGradientToColor := Subnode.TextAsColor;
Subnode := Node['HottrackGradientType', false]; Subnode := Node['HottrackGradientType', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackGradientType := TBackgroundKind(Subnode.TextAsInteger); FHottrackGradientType := TBackgroundKind(Subnode.TextAsInteger);
Subnode := Node['HottrackInnerLightColor', false]; Subnode := Node['HottrackInnerLightColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackInnerLightColor := Subnode.TextAsColor; FHottrackInnerLightColor := Subnode.TextAsColor;
Subnode := Node['HottrackInnerDarkColor', false]; Subnode := Node['HottrackInnerDarkColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackInnerDarkColor := Subnode.TextAsColor; FHottrackInnerDarkColor := Subnode.TextAsColor;
Subnode := Node['HottrackCaptionColor', false]; Subnode := Node['HottrackCaptionColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FHottrackCaptionColor := Subnode.TextAsColor; FHottrackCaptionColor := Subnode.TextAsColor;
// *** Active *** // Active
Subnode := Node['ActiveFrameColor', false]; Subnode := Node['ActiveFrameColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveFrameColor := Subnode.TextAsColor; FActiveFrameColor := Subnode.TextAsColor;
Subnode := Node['ActiveGradientFromColor', false]; Subnode := Node['ActiveGradientFromColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveGradientFromColor := Subnode.TextAsColor; FActiveGradientFromColor := Subnode.TextAsColor;
Subnode := Node['ActiveGradientToColor', false]; Subnode := Node['ActiveGradientToColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveGradientToColor := Subnode.TextAsColor; FActiveGradientToColor := Subnode.TextAsColor;
Subnode := Node['ActiveGradientType', false]; Subnode := Node['ActiveGradientType', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveGradientType := TBackgroundKind(Subnode.TextAsInteger); FActiveGradientType := TBackgroundKind(Subnode.TextAsInteger);
Subnode := Node['ActiveInnerLightColor', false]; Subnode := Node['ActiveInnerLightColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveInnerLightColor := Subnode.TextAsColor; FActiveInnerLightColor := Subnode.TextAsColor;
Subnode := Node['ActiveInnerDarkColor', false]; Subnode := Node['ActiveInnerDarkColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveInnerDarkColor := Subnode.TextAsColor; FActiveInnerDarkColor := Subnode.TextAsColor;
Subnode := Node['ActiveCaptionColor', false]; Subnode := Node['ActiveCaptionColor', false];
if assigned(Subnode) then if Assigned(Subnode) then
FActiveCaptionColor := Subnode.TextAsColor; FActiveCaptionColor := Subnode.TextAsColor;
// Other
Subnode := Node['Style', false];
if Assigned(SubNode) then
FStyle := TSpkElementStyle(Subnode.TextAsInteger);
end; end;
procedure TSpkElementAppearance.Reset; procedure TSpkElementAppearance.Reset;
begin begin
if screen.fonts.IndexOf('Calibri') >= 0 then SetDefaultFont(FCaptionFont);
begin FCaptionFont.Size := FCaptionFont.Size - 1;
FCaptionFont.Name := 'Calibri';
FCaptionFont.Size := 9;
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
FCaptionFont.Color := rgb(21, 66, 139);
end
else if screen.fonts.IndexOf('Verdana') >= 0 then
begin
FCaptionFont.Name := 'Verdana';
FCaptionFont.Size := 8;
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
FCaptionFont.Color := rgb(21, 66, 139);
end
else
begin
FCaptionFont.Name := 'Arial';
FCaptionFont.Size := 8;
FCaptionFont.Style := [];
FCaptionFont.Charset := DEFAULT_CHARSET;
FCaptionFont.Orientation := 0;
FCaptionFont.Pitch := fpDefault;
FCaptionFont.Color := rgb(21, 66, 139);
end;
FIdleFrameColor := rgb(155, 183, 224); FIdleFrameColor := rgb(155, 183, 224);
FIdleGradientFromColor := rgb(200, 219, 238); FIdleGradientFromColor := rgb(200, 219, 238);
FIdleGradientToColor := rgb(188, 208, 233); FIdleGradientToColor := rgb(188, 208, 233);
@ -878,6 +794,7 @@ begin
FActiveInnerLightColor := rgb(252, 169, 14); FActiveInnerLightColor := rgb(252, 169, 14);
FActiveInnerDarkColor := rgb(252, 169, 14); FActiveInnerDarkColor := rgb(252, 169, 14);
FActiveCaptionColor := rgb(110, 66, 128); FActiveCaptionColor := rgb(110, 66, 128);
FStyle := esRounded;
end; end;
procedure TSpkElementAppearance.SaveToPascal(AList: TStrings); procedure TSpkElementAppearance.SaveToPascal(AList: TStrings);
@ -909,6 +826,8 @@ begin
Add(' ActiveInnerDarkColor := $' + IntToHex(FActiveInnerDarkColor, 8) + ';'); Add(' ActiveInnerDarkColor := $' + IntToHex(FActiveInnerDarkColor, 8) + ';');
Add(' ActiveInnerLightColor := $' + IntToHex(FActiveInnerLightColor, 8) + ';'); Add(' ActiveInnerLightColor := $' + IntToHex(FActiveInnerLightColor, 8) + ';');
Add(' ActiveCaptionColor := $' + IntToHex(FActiveCaptionColor, 8) + ';'); Add(' ActiveCaptionColor := $' + IntToHex(FActiveCaptionColor, 8) + ';');
Add(' Style := ' + GetEnumName(TypeInfo(TSpkElementStyle), ord(FStyle)) + ';');
Add(' end;'); Add(' end;');
end; end;
end; end;
@ -988,10 +907,12 @@ begin
Subnode := Node['ActiveCaptionColor', true]; Subnode := Node['ActiveCaptionColor', true];
Subnode.TextAsColor := FActiveCaptionColor; Subnode.TextAsColor := FActiveCaptionColor;
Subnode := Node['Style', true];
Subnode.TextAsInteger := integer(FStyle);
end; end;
procedure TSpkElementAppearance.SetActiveCaptionColor( procedure TSpkElementAppearance.SetActiveCaptionColor(const Value: TColor);
const Value: TColor);
begin begin
FActiveCaptionColor := Value; FActiveCaptionColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
@ -1005,40 +926,35 @@ begin
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetActiveGradientFromColor( procedure TSpkElementAppearance.SetActiveGradientFromColor(const Value: TColor);
const Value: TColor);
begin begin
FActiveGradientFromColor := Value; FActiveGradientFromColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetActiveGradientToColor( procedure TSpkElementAppearance.SetActiveGradientToColor(const Value: TColor);
const Value: TColor);
begin begin
FActiveGradientToColor := Value; FActiveGradientToColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetActiveGradientType( procedure TSpkElementAppearance.SetActiveGradientType(const Value: TBackgroundKind);
const Value: TBackgroundKind);
begin begin
FActiveGradientType := Value; FActiveGradientType := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetActiveInnerDarkColor( procedure TSpkElementAppearance.SetActiveInnerDarkColor(const Value: TColor);
const Value: TColor);
begin begin
FActiveInnerDarkColor := Value; FActiveInnerDarkColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetActiveInnerLightColor( procedure TSpkElementAppearance.SetActiveInnerLightColor(const Value: TColor);
const Value: TColor);
begin begin
FActiveInnerLightColor := Value; FActiveInnerLightColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
@ -1052,56 +968,49 @@ begin
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackCaptionColor( procedure TSpkElementAppearance.SetHotTrackCaptionColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackCaptionColor := Value; FHotTrackCaptionColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackFrameColor( procedure TSpkElementAppearance.SetHotTrackFrameColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackFrameColor := Value; FHotTrackFrameColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackGradientFromColor( procedure TSpkElementAppearance.SetHotTrackGradientFromColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackGradientFromColor := Value; FHotTrackGradientFromColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackGradientToColor( procedure TSpkElementAppearance.SetHotTrackGradientToColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackGradientToColor := Value; FHotTrackGradientToColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackGradientType( procedure TSpkElementAppearance.SetHotTrackGradientType(const Value: TBackgroundKind);
const Value: TBackgroundKind);
begin begin
FHotTrackGradientType := Value; FHotTrackGradientType := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackInnerDarkColor( procedure TSpkElementAppearance.SetHotTrackInnerDarkColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackInnerDarkColor := Value; FHotTrackInnerDarkColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetHotTrackInnerLightColor( procedure TSpkElementAppearance.SetHotTrackInnerLightColor(const Value: TColor);
const Value: TColor);
begin begin
FHotTrackInnerLightColor := Value; FHotTrackInnerLightColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
@ -1122,46 +1031,48 @@ begin
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetIdleGradientFromColor( procedure TSpkElementAppearance.SetIdleGradientFromColor(const Value: TColor);
const Value: TColor);
begin begin
FIdleGradientFromColor := Value; FIdleGradientFromColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetIdleGradientToColor( procedure TSpkElementAppearance.SetIdleGradientToColor(const Value: TColor);
const Value: TColor);
begin begin
FIdleGradientToColor := Value; FIdleGradientToColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetIdleGradientType( procedure TSpkElementAppearance.SetIdleGradientType(const Value: TBackgroundKind);
const Value: TBackgroundKind);
begin begin
FIdleGradientType := Value; FIdleGradientType := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetIdleInnerDarkColor( procedure TSpkElementAppearance.SetIdleInnerDarkColor(const Value: TColor);
const Value: TColor);
begin begin
FIdleInnerDarkColor := Value; FIdleInnerDarkColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetIdleInnerLightColor( procedure TSpkElementAppearance.SetIdleInnerLightColor(const Value: TColor);
const Value: TColor);
begin begin
FIdleInnerLightColor := Value; FIdleInnerLightColor := Value;
if FDispatch<>nil then if FDispatch<>nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end; end;
procedure TSpkElementAppearance.SetStyle(const Value: TSpkElementStyle);
begin
FStyle := Value;
if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged;
end;
{ TSpkToolbarAppearanceDispatch } { TSpkToolbarAppearanceDispatch }
constructor TSpkToolbarAppearanceDispatch.Create( constructor TSpkToolbarAppearanceDispatch.Create(
@ -1296,4 +1207,30 @@ begin
FTab.assign(Value); FTab.assign(Value);
end; end;
procedure SetDefaultFont(AFont: TFont);
begin
AFont.Assign(Screen.MenuFont);
{
if Screen.Fonts.IndexOf('Calibri') >= 0 then
begin
AFont.Name := 'Calibri';
AFont.Size := 9;
end
else if Screen.Fonts.IndexOf('Verdana') >= 0 then
begin
AFont.Name := 'Verdana';
AFont.Size := 8;
end else
begin
AFont.Name := 'Arial';
AFont.Size := 8;
end;
AFont.Style := [];
AFont.Charset := DEFAULT_CHARSET;
AFont.Orientation := 0;
AFont.Pitch := fpDefault;
}
AFont.Color := rgb(21, 66, 139);
end;
end. end.

File diff suppressed because it is too large Load Diff

View File

@ -355,7 +355,7 @@ begin
if ToDPI = 0 then if ToDPI = 0 then
ToDPI := ScreenInfo.PixelsPerInchX; ToDPI := ScreenInfo.PixelsPerInchX;
if not(DPI_AWARE) or (ToDPI = FromDPI) then if (not DPI_AWARE) or (ToDPI = FromDPI) then
Result := Size Result := Size
else else
begin begin
@ -372,7 +372,7 @@ begin
if ToDPI = 0 then if ToDPI = 0 then
ToDPI := ScreenInfo.PixelsPerInchY; ToDPI := ScreenInfo.PixelsPerInchY;
if not(DPI_AWARE) or (ToDPI = FromDPI) then if (not DPI_AWARE) or (ToDPI = FromDPI) then
Result := Size Result := Size
else else
begin begin

View File

@ -48,20 +48,20 @@ class procedure TButtonTools.DrawButton(Bitmap: TBitmap;
RightEdgeOpen, TopEdgeOpen, BottomEdgeOpen: boolean; Radius: integer; RightEdgeOpen, TopEdgeOpen, BottomEdgeOpen: boolean; Radius: integer;
ClipRect : T2DIntRect); ClipRect : T2DIntRect);
var x1, x2, y1, y2 : integer; var
x1, x2, y1, y2: integer;
LeftClosed, TopClosed, RightClosed, BottomClosed: byte; LeftClosed, TopClosed, RightClosed, BottomClosed: byte;
begin begin
if (Rect.Width <6 ) or (Rect.Height < 6) or if (Rect.Width <6 ) or (Rect.Height < 6) or
(Rect.Width < 2*radius) or (Rect.Height < 2*Radius) then (Rect.Width < 2*Radius) or (Rect.Height < 2*Radius) then exit;
exit;
if LeftEdgeOpen then LeftClosed := 0 else LeftClosed := 1; if LeftEdgeOpen then LeftClosed := 0 else LeftClosed := 1;
if RightEdgeOpen then RightClosed := 0 else RightClosed := 1; if RightEdgeOpen then RightClosed := 0 else RightClosed := 1;
if TopEdgeOpen then TopClosed := 0 else TopClosed := 1; if TopEdgeOpen then TopClosed := 0 else TopClosed := 1;
if BottomEdgeOpen then BottomClosed := 0 else BottomClosed := 1; if BottomEdgeOpen then BottomClosed := 0 else BottomClosed := 1;
TGuiTools.DrawRoundRect(Bitmap.Canvas, TGuiTools.DrawRoundRect(
Bitmap.Canvas,
Rect, Rect,
Radius, Radius,
GradientFrom, GradientFrom,
@ -71,7 +71,8 @@ TGuiTools.DrawRoundRect(Bitmap.Canvas,
not (LeftEdgeOpen or TopEdgeOpen), not (LeftEdgeOpen or TopEdgeOpen),
not (RightEdgeOpen or TopEdgeOpen), not (RightEdgeOpen or TopEdgeOpen),
not (LeftEdgeOpen or BottomEdgeOpen), not (LeftEdgeOpen or BottomEdgeOpen),
not(RightEdgeOpen or BottomEdgeOpen)); not (RightEdgeOpen or BottomEdgeOpen)
);
// Wewnêtrzna krawêdŸ // Wewnêtrzna krawêdŸ
// *** Góra *** // *** Góra ***
@ -85,7 +86,8 @@ x1:=Rect.Left + radius * BottomClosed * LeftClosed + LeftClosed;
x2 := Rect.Right - radius * BottomClosed * RightClosed - RightClosed; x2 := Rect.Right - radius * BottomClosed * RightClosed - RightClosed;
y1 := Rect.Bottom - BottomClosed; y1 := Rect.Bottom - BottomClosed;
if BottomEdgeOpen then if BottomEdgeOpen then
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerDarkColor, ClipRect) else TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerDarkColor, ClipRect)
else
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect); TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Lewo *** // *** Lewo ***
@ -99,12 +101,14 @@ y1:=Rect.Top + Radius * RightClosed * TopClosed + TopClosed;
y2 := Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed; y2 := Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed;
x1 := Rect.Right - RightClosed; x1 := Rect.Right - RightClosed;
if RightEdgeOpen then if RightEdgeOpen then
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerDarkColor, ClipRect) else TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerDarkColor, ClipRect)
else
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect); TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// Zaokr¹glone naro¿niki // Zaokr¹glone naro¿niki
if not(LeftEdgeOpen or TopEdgeOpen) then if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.Top + 1), T2DIntPoint.create(Rect.left + 1, Rect.Top + 1),
{$ELSE} {$ELSE}
@ -113,44 +117,51 @@ if not(LeftEdgeOpen or TopEdgeOpen) then
Radius, Radius,
cpLeftTop, cpLeftTop,
InnerLightColor, InnerLightColor,
ClipRect); ClipRect
);
if not(RightEdgeOpen or TopEdgeOpen) then if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius, Rect.Top + 1), T2DIntPoint.Create(Rect.right - radius, Rect.Top + 1),
{$ELSE} {$ELSE}
Create2DIntPoint(Rect.right - radius, Rect.Top + 1), Create2DIntPoint(Rect.right - radius, Rect.Top + 1),
{$ENDIF} {$ENDIF}
Radius, Radius,
cpRightTop, cpRightTop,
InnerLightColor, InnerLightColor,
ClipRect); ClipRect
);
if not(LeftEdgeOpen or BottomEdgeOpen) then if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.bottom - radius), T2DIntPoint.create(Rect.left + 1, Rect.bottom - Radius),
{$ELSE} {$ELSE}
Create2DIntPoint(Rect.left + 1, Rect.bottom - radius), Create2DIntPoint(Rect.left + 1, Rect.bottom - Radius),
{$ENDIF} {$ENDIF}
Radius, Radius,
cpLeftBottom, cpLeftBottom,
InnerLightColor, InnerLightColor,
ClipRect); ClipRect
);
if not(RightEdgeOpen or BottomEdgeOpen) then if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius, Rect.bottom - radius), T2DIntPoint.create(Rect.right - Radius, Rect.bottom - Radius),
{$ELSE} {$ELSE}
Create2DIntPoint(Rect.right - radius, Rect.bottom - radius), Create2DIntPoint(Rect.right - Radius, Rect.bottom - Radius),
{$ENDIF} {$ENDIF}
Radius, Radius,
cpRightBottom, cpRightBottom,
InnerLightColor, InnerLightColor,
ClipRect); ClipRect
);
// Zewnêtrzna krawêdŸ // Zewnêtrzna krawêdŸ
// Zaokr¹glone naro¿niki // Zaokr¹glone naro¿niki
if not(TopEdgeOpen) then if not TopEdgeOpen then
begin begin
x1 := Rect.Left + Radius * LeftClosed; x1 := Rect.Left + Radius * LeftClosed;
x2 := Rect.Right - Radius * RightClosed; x2 := Rect.Right - Radius * RightClosed;
@ -158,7 +169,7 @@ if not(TopEdgeOpen) then
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect); TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end; end;
if not(BottomEdgeOpen) then if not BottomEdgeOpen then
begin begin
x1 := Rect.Left + Radius * LeftClosed; x1 := Rect.Left + Radius * LeftClosed;
x2 := Rect.Right - Radius * RightClosed; x2 := Rect.Right - Radius * RightClosed;
@ -166,7 +177,7 @@ if not(BottomEdgeOpen) then
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect); TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end; end;
if not(LeftEdgeOpen) then if not LeftEdgeOpen then
begin begin
y1 := Rect.Top + Radius * TopClosed; y1 := Rect.Top + Radius * TopClosed;
y2 := Rect.Bottom - Radius * BottomClosed; y2 := Rect.Bottom - Radius * BottomClosed;
@ -183,7 +194,8 @@ if not(RightEdgeOpen) then
end; end;
if not(LeftEdgeOpen or TopEdgeOpen) then if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.Top), T2DIntPoint.create(Rect.left, Rect.Top),
{$ELSE} {$ELSE}
@ -192,9 +204,12 @@ if not(LeftEdgeOpen or TopEdgeOpen) then
Radius, Radius,
cpLeftTop, cpLeftTop,
FrameColor, FrameColor,
ClipRect); ClipRect
);
if not(RightEdgeOpen or TopEdgeOpen) then if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.Top), T2DIntPoint.create(Rect.right - radius + 1, Rect.Top),
{$ELSE} {$ELSE}
@ -203,9 +218,12 @@ if not(RightEdgeOpen or TopEdgeOpen) then
Radius, Radius,
cpRightTop, cpRightTop,
FrameColor, FrameColor,
ClipRect); ClipRect
);
if not(LeftEdgeOpen or BottomEdgeOpen) then if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.bottom - radius + 1), T2DIntPoint.create(Rect.left, Rect.bottom - radius + 1),
{$ELSE} {$ELSE}
@ -214,18 +232,22 @@ if not(LeftEdgeOpen or BottomEdgeOpen) then
Radius, Radius,
cpLeftBottom, cpLeftBottom,
FrameColor, FrameColor,
ClipRect); ClipRect
);
if not(RightEdgeOpen or BottomEdgeOpen) then if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap, TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.bottom - radius + 1), T2DIntPoint.create(Rect.right - radius + 1, Rect.bottom - radius + 1),
{$ELSE} {$ELSE}
Create2DIntPoint(Rect.right - radius + 1, Rect.bottom - radius + 1), Create2DIntPoint(Rect.right - Radius + 1, Rect.bottom - radius + 1),
{$ENDIF} {$ENDIF}
Radius, Radius,
cpRightBottom, cpRightBottom,
FrameColor, FrameColor,
ClipRect); ClipRect
);
end; end;
end. end.

View File

@ -1,10 +1,10 @@
object frmAppearanceEditWindow: TfrmAppearanceEditWindow object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 617 Left = 617
Height = 540 Height = 561
Top = 138 Top = 138
Width = 562 Width = 562
Caption = 'Toolbar appearance editor' Caption = 'Toolbar appearance editor'
ClientHeight = 540 ClientHeight = 561
ClientWidth = 562 ClientWidth = 562
Color = clBtnFace Color = clBtnFace
Font.Color = clWindowText Font.Color = clWindowText
@ -318,7 +318,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 368 Height = 389
Top = 132 Top = 132
Width = 562 Width = 562
ActivePage = TabSheet3 ActivePage = TabSheet3
@ -1096,7 +1096,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end end
object TabSheet3: TTabSheet object TabSheet3: TTabSheet
Caption = 'Item' Caption = 'Item'
ClientHeight = 340 ClientHeight = 361
ClientWidth = 554 ClientWidth = 554
ImageIndex = 2 ImageIndex = 2
object sItemRectangle: TShape object sItemRectangle: TShape
@ -1254,10 +1254,13 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideLeft.Control = pItemIdleInnerLight AnchorSideLeft.Control = pItemIdleInnerLight
AnchorSideTop.Control = pItemIdleInnerLight AnchorSideTop.Control = pItemIdleInnerLight
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pItemIdleInnerLight
AnchorSideRight.Side = asrBottom
Left = 116 Left = 116
Height = 25 Height = 25
Top = 279 Top = 279
Width = 121 Width = 100
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 20 BorderSpacing.Top = 20
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
BevelInner = bvRaised BevelInner = bvRaised
@ -1982,6 +1985,42 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
GroupIndex = 1 GroupIndex = 1
OnClick = bItemActiveInnerLightColorClick OnClick = bItemActiveInnerLightColorClick
end end
object cbItemStyle: TComboBox
AnchorSideLeft.Control = pItemIdleGradientFrom
AnchorSideTop.Control = pItemFont
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pItemIdleGradientTo
AnchorSideRight.Side = asrBottom
Left = 116
Height = 23
Top = 310
Width = 100
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Rounded'
'Rectangle'
)
OnChange = cbItemStyleChange
Style = csDropDownList
TabOrder = 23
Text = 'Rounded'
end
object Label27: TLabel
AnchorSideTop.Control = cbItemStyle
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = LblInnerLightColor
AnchorSideRight.Side = asrBottom
Left = 71
Height = 15
Top = 314
Width = 25
Anchors = [akTop, akRight]
Caption = 'Style'
ParentColor = False
end
end end
object TabSheet4: TTabSheet object TabSheet4: TTabSheet
Caption = 'Import / export' Caption = 'Import / export'
@ -2105,7 +2144,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object ButtonPanel: TPanel object ButtonPanel: TPanel
Left = 8 Left = 8
Height = 24 Height = 24
Top = 508 Top = 529
Width = 546 Width = 546
Align = alBottom Align = alBottom
BorderSpacing.Around = 8 BorderSpacing.Around = 8
@ -2191,8 +2230,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
'ColorS=F0FBFF' 'ColorS=F0FBFF'
'ColorT=A4A0A0' 'ColorT=A4A0A0'
) )
left = 216 left = 280
top = 464 top = 512
end end
object fdFontDialog: TFontDialog object fdFontDialog: TFontDialog
Font.Color = clWindowText Font.Color = clWindowText
@ -2200,18 +2239,18 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
MinFontSize = 0 MinFontSize = 0
MaxFontSize = 0 MaxFontSize = 0
left = 312 left = 376
top = 464 top = 512
end end
object LargeImages: TImageList object LargeImages: TImageList
Height = 32 Height = 32
Width = 32 Width = 32
left = 48 left = 112
top = 464 top = 512
end end
object SmallImages: TImageList object SmallImages: TImageList
left = 128 left = 192
top = 464 top = 512
Bitmap = { Bitmap = {
4C69010000001000000010000000000000000000000000000000000000000000 4C69010000001000000010000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000005BA36C7380C4 00000000000000000000000000000000000000000000000000005BA36C7380C4

View File

@ -46,10 +46,12 @@ type
bActiveTabHeaderFontColor: TSpeedButton; bActiveTabHeaderFontColor: TSpeedButton;
bExportToPascal: TButton; bExportToPascal: TButton;
bCopyToClipboard: TButton; bCopyToClipboard: TButton;
cbItemStyle: TComboBox;
cbPaneStyle: TComboBox; cbPaneStyle: TComboBox;
ColorView: TShape; ColorView: TShape;
gbPreview: TGroupBox; gbPreview: TGroupBox;
Label12: TLabel; Label12: TLabel;
Label27: TLabel;
LblCaptionBackground1: TLabel; LblCaptionBackground1: TLabel;
LblRGB: TLabel; LblRGB: TLabel;
SmallImages: TImageList; SmallImages: TImageList;
@ -195,6 +197,7 @@ 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 cbItemStyleChange(Sender: TObject);
procedure cbPaneGradientKindChange(Sender: TObject); procedure cbPaneGradientKindChange(Sender: TObject);
procedure cbPaneStyleChange(Sender: TObject); procedure cbPaneStyleChange(Sender: TObject);
procedure cbTabGradientKindChange(Sender: TObject); procedure cbTabGradientKindChange(Sender: TObject);
@ -736,6 +739,12 @@ begin
SetLinkedGradientKind((Sender as TComboBox).ItemIndex); SetLinkedGradientKind((Sender as TComboBox).ItemIndex);
end; end;
procedure TfrmAppearanceEditWindow.cbItemStyleChange(Sender: TObject);
begin
with tbPreview.Appearance.Element do
Style := TSpkElementStyle((Sender as TCombobox).ItemIndex);
end;
procedure TfrmAppearanceEditWindow.cbLinkItemClick(Sender: TObject); procedure TfrmAppearanceEditWindow.cbLinkItemClick(Sender: TObject);
begin begin
SwitchAttributesLink(cbLinkItem.Checked); SwitchAttributesLink(cbLinkItem.Checked);
@ -899,6 +908,8 @@ begin
SetPanelColor(pItemActiveCaptionColor, ActiveCaptionColor); SetPanelColor(pItemActiveCaptionColor, ActiveCaptionColor);
SetPanelColor(pItemActiveInnerDark, ActiveInnerDarkColor); SetPanelColor(pItemActiveInnerDark, ActiveInnerDarkColor);
SetPanelColor(pItemActiveInnerLight, ActiveInnerLightColor); SetPanelColor(pItemActiveInnerLight, ActiveInnerLightColor);
cbItemStyle.ItemIndex := ord(Style);
end; end;
end; end;
end; end;