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,37 +2218,36 @@ class procedure TGUITools.DrawRoundRect(ACanvas: TCanvas; Rect: T2DIntRect;
Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind;
ClipRect: T2DIntRect; LeftTopRound, RightTopRound, LeftBottomRound,
RightBottomRound: boolean);
var UseOrgClipRgn : boolean;
ClipRgn : HRGN;
OrgRgn : HRGN;
var
UseOrgClipRgn: boolean;
ClipRgn: HRGN;
OrgRgn: HRGN;
begin
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
ClipRgn:=CreateRectRgn(ClipRect.left, ClipRect.Top, ClipRect.Right+1, ClipRect.Bottom+1);
if UseOrgClipRgn then
CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND);
ClipRgn := CreateRectRgn(ClipRect.left, ClipRect.Top, ClipRect.Right+1, ClipRect.Bottom+1);
if UseOrgClipRgn then
CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND);
SelectClipRgn(ACanvas.Handle, ClipRgn);
SelectClipRgn(ACanvas.Handle, ClipRgn);
DrawRoundRect(ACanvas, Rect, Radius, ColorFrom, ColorTo, GradientKind, LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound);
DrawRoundRect(ACanvas, Rect, Radius, ColorFrom, ColorTo, GradientKind, LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound);
// Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(ClipRgn);
// Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(ClipRgn);
end;
class procedure TGUITools.DrawText(ACanvas: TCanvas; x, y: integer;
const AText: string; TextColor: TColor);
const AText: string; TextColor: TColor);
begin
with Acanvas do
begin
brush.style:=bsClear;
font.color:=TextColor;
TextOut(x, y, AText);
end;
with ACanvas do
begin
Brush.Style := bsClear;
Font.Color := TextColor;
TextOut(x, y, AText);
end;
end;
class procedure TGUITools.DrawText(ACanvas: TCanvas; x, y: integer;
@ -2269,81 +2268,89 @@ end;
class procedure TGUITools.DrawRoundRect(ACanvas: TCanvas; Rect: T2DIntRect;
Radius: integer; ColorFrom, ColorTo: TColor; GradientKind: TBackgroundKind;
LeftTopRound, RightTopRound, LeftBottomRound, RightBottomRound: boolean);
var RoundRgn : HRGN;
TmpRgn : HRGN;
OrgRgn : HRGN;
UseOrgClipRgn: Boolean;
var
RoundRgn: HRGN;
TmpRgn: HRGN;
OrgRgn: HRGN;
UseOrgClipRgn: Boolean;
begin
if Radius<1 then
exit;
if Radius < 0 then
exit;
//WriteLn('Radius: ', Radius, ' Rect.Width: ', Rect.Width, ' Rect.Height: ', Rect.Height);
if Radius > 0 then
begin
//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
// Radius = 3 and Rect.Width >=128 and <= 261 will evaluate to true
{$ifdef FpcBugWorkAround}
if (CompareValue(Radius*2, Rect.width) > 0) and (CompareValue(Radius*2, Rect.Height) > 0) then
exit;
{$else}
if (Radius*2>Rect.width) or (Radius*2>Rect.height) then
exit;
{$endif}
// 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
{$ifdef FpcBugWorkAround}
if (CompareValue(Radius*2, Rect.width) > 0) and (CompareValue(Radius*2, Rect.Height) > 0) then
exit;
{$else}
if (Radius*2 > Rect.Width) or (Radius*2 > Rect.Height) then
exit;
{$endif}
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
// Zapamiêtywanie oryginalnego ClipRgn i ustawianie nowego
SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
if not(LeftTopRound) and not(RightTopRound) and not(LeftBottomRound) and not (RightBottomRound) then
begin
RoundRgn:=CreateRectRgn(Rect.Left, Rect.Top, Rect.Right + 1, Rect.Bottom + 1);
end
else
begin
RoundRgn:=CreateRoundRectRgn(Rect.Left, Rect.Top, Rect.Right +2, Rect.Bottom + 2, Radius*2, Radius*2);
if not(LeftTopRound) and
not(RightTopRound) and
not(LeftBottomRound) and
not (RightBottomRound) then
begin
RoundRgn := CreateRectRgn(Rect.Left, Rect.Top, Rect.Right + 1, Rect.Bottom + 1);
end
else
begin
RoundRgn := CreateRoundRectRgn(Rect.Left, Rect.Top, Rect.Right +2, Rect.Bottom + 2, Radius*2, Radius*2);
if not(LeftTopRound) then
if not(LeftTopRound) then
begin
TmpRgn:=CreateRectRgn(Rect.left, Rect.Top, Rect.left + Radius, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn := CreateRectRgn(Rect.Left, Rect.Top, Rect.Left + Radius, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
end;
if not(RightTopRound) then
if not(RightTopRound) then
begin
TmpRgn:=CreateRectRgn(Rect.right - Radius + 1, Rect.Top, Rect.Right + 1, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn := CreateRectRgn(Rect.Right - Radius + 1, Rect.Top, Rect.Right + 1, Rect.Top + Radius);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
end;
if not(LeftBottomRound) then
if not(LeftBottomRound) then
begin
TmpRgn:=CreateRectRgn(Rect.left, Rect.Bottom - Radius + 1, Rect.Left + Radius, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn := CreateRectRgn(Rect.Left, Rect.Bottom - Radius + 1, Rect.Left + Radius, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
end;
if not(RightBottomRound) then
if not(RightBottomRound) then
begin
TmpRgn:=CreateRectRgn(Rect.right - Radius + 1, Rect.Bottom - Radius + 1, Rect.Right + 1, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
TmpRgn := CreateRectRgn(Rect.Right - Radius + 1, Rect.Bottom - Radius + 1, Rect.Right + 1, Rect.Bottom + 1);
CombineRgn(RoundRgn, RoundRgn, TmpRgn, RGN_OR);
DeleteObject(TmpRgn);
end;
end;
end;
if UseOrgClipRgn then
CombineRgn(RoundRgn, RoundRgn, OrgRgn, RGN_AND);
if UseOrgClipRgn then
CombineRgn(RoundRgn, RoundRgn, OrgRgn, RGN_AND);
SelectClipRgn(ACanvas.Handle, RoundRgn);
SelectClipRgn(ACanvas.Handle, RoundRgn);
end; // if Radius > 0
ColorFrom:=ColorToRGB(ColorFrom);
ColorTo:=ColorToRGB(ColorTo);
ColorFrom := ColorToRGB(ColorFrom);
ColorTo := ColorToRGB(ColorTo);
FillGradientRectangle(ACanvas, Rect, ColorFrom, ColorTo, GradientKind);
FillGradientRectangle(ACanvas, Rect, ColorFrom, ColorTo, GradientKind);
// Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(RoundRgn);
if Radius > 0 then
begin
// Przywracanie poprzedniego ClipRgn i usuwanie wykorzystanych regionów
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
DeleteObject(RoundRgn);
end;
end;
class procedure TGUITools.DrawOutlinedText(ABitmap: TBitmap; x, y: integer;

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -22,20 +22,20 @@ type TButtonTools = class sealed(TObject)
private
protected
public
class procedure DrawButton(Bitmap : TBitmap;
Rect : T2DIntRect;
class procedure DrawButton(Bitmap: TBitmap;
Rect: T2DIntRect;
FrameColor,
InnerLightColor,
InnerDarkColor,
GradientFrom,
GradientTo : TColor;
GradientKind : TBackgroundKind;
GradientTo: TColor;
GradientKind: TBackgroundKind;
LeftEdgeOpen,
RightEdgeOpen,
TopEdgeOpen,
BottomEdgeOpen : boolean;
Radius : integer;
ClipRect : T2DIntRect);
BottomEdgeOpen: boolean;
Radius: integer;
ClipRect: T2DIntRect);
end;
implementation
@ -48,184 +48,206 @@ class procedure TButtonTools.DrawButton(Bitmap: TBitmap;
RightEdgeOpen, TopEdgeOpen, BottomEdgeOpen: boolean; Radius: integer;
ClipRect : T2DIntRect);
var x1, x2, y1, y2 : integer;
LeftClosed, TopClosed, RightClosed, BottomClosed : byte;
var
x1, x2, y1, y2: integer;
LeftClosed, TopClosed, RightClosed, BottomClosed: byte;
begin
if (Rect.Width<6) or (Rect.Height<6) or
(Rect.Width < 2*radius) or (Rect.Height < 2*Radius) then
exit;
if (Rect.Width <6 ) or (Rect.Height < 6) or
(Rect.Width < 2*Radius) or (Rect.Height < 2*Radius) then exit;
if LeftEdgeOpen then LeftClosed:=0 else LeftClosed:=1;
if RightEdgeOpen then RightClosed:=0 else RightClosed:=1;
if TopEdgeOpen then TopClosed:=0 else TopClosed:=1;
if BottomEdgeOpen then BottomClosed:=0 else BottomClosed:=1;
if LeftEdgeOpen then LeftClosed := 0 else LeftClosed := 1;
if RightEdgeOpen then RightClosed := 0 else RightClosed := 1;
if TopEdgeOpen then TopClosed := 0 else TopClosed := 1;
if BottomEdgeOpen then BottomClosed := 0 else BottomClosed := 1;
TGuiTools.DrawRoundRect(Bitmap.Canvas,
Rect,
Radius,
GradientFrom,
GradientTo,
GradientKind,
ClipRect,
not(LeftEdgeOpen or TopEdgeOpen),
not(RightEdgeOpen or TopEdgeOpen),
not(LeftEdgeOpen or BottomEdgeOpen),
not(RightEdgeOpen or BottomEdgeOpen));
TGuiTools.DrawRoundRect(
Bitmap.Canvas,
Rect,
Radius,
GradientFrom,
GradientTo,
GradientKind,
ClipRect,
not (LeftEdgeOpen or TopEdgeOpen),
not (RightEdgeOpen or TopEdgeOpen),
not (LeftEdgeOpen or BottomEdgeOpen),
not (RightEdgeOpen or BottomEdgeOpen)
);
// Wewnêtrzna krawêdŸ
// *** Góra ***
x1:=Rect.Left + radius * TopClosed * LeftClosed + LeftClosed;
x2:=Rect.Right - radius * TopClosed * RightClosed - RightClosed;
y1:=Rect.Top + TopClosed;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// Wewnêtrzna krawêdŸ
// *** Góra ***
x1 := Rect.Left + radius * TopClosed * LeftClosed + LeftClosed;
x2 := Rect.Right - radius * TopClosed * RightClosed - RightClosed;
y1 := Rect.Top + TopClosed;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Dó³ ***
x1:=Rect.Left + radius * BottomClosed * LeftClosed + LeftClosed;
x2:=Rect.Right - radius * BottomClosed * RightClosed - RightClosed;
y1:=Rect.Bottom - BottomClosed;
if BottomEdgeOpen then
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerDarkColor, ClipRect) else
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Dó³ ***
x1 := Rect.Left + radius * BottomClosed * LeftClosed + LeftClosed;
x2 := Rect.Right - radius * BottomClosed * RightClosed - RightClosed;
y1 := Rect.Bottom - BottomClosed;
if BottomEdgeOpen then
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerDarkColor, ClipRect)
else
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Lewo ***
y1:=Rect.Top + Radius * LeftClosed * TopClosed + TopClosed;
y2:=Rect.Bottom - Radius * LeftClosed * BottomClosed - BottomClosed;
x1:=Rect.Left + LeftClosed;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// *** Lewo ***
y1 := Rect.Top + Radius * LeftClosed * TopClosed + TopClosed;
y2 := Rect.Bottom - Radius * LeftClosed * BottomClosed - BottomClosed;
x1 := Rect.Left + LeftClosed;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// *** Prawo ***
y1:=Rect.Top + Radius * RightClosed * TopClosed + TopClosed;
y2:=Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed;
x1:=Rect.Right - RightClosed;
if RightEdgeOpen then
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerDarkColor, ClipRect) else
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// *** Prawo ***
y1 := Rect.Top + Radius * RightClosed * TopClosed + TopClosed;
y2 := Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed;
x1 := Rect.Right - RightClosed;
if RightEdgeOpen then
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerDarkColor, ClipRect)
else
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// Zaokr¹glone naro¿niki
if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.Top + 1),
{$ELSE}
Create2DIntPoint(Rect.left + 1, Rect.Top + 1),
{$ENDIF}
Radius,
cpLeftTop,
InnerLightColor,
ClipRect);
if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius, Rect.Top + 1),
{$ELSE}
Create2DIntPoint(Rect.right - radius, Rect.Top + 1),
{$ENDIF}
Radius,
cpRightTop,
InnerLightColor,
ClipRect);
if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.bottom - radius),
{$ELSE}
Create2DIntPoint(Rect.left + 1, Rect.bottom - radius),
{$ENDIF}
Radius,
cpLeftBottom,
InnerLightColor,
ClipRect);
if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius, Rect.bottom - radius),
{$ELSE}
Create2DIntPoint(Rect.right - radius, Rect.bottom - radius),
{$ENDIF}
Radius,
cpRightBottom,
InnerLightColor,
ClipRect);
// Zaokr¹glone naro¿niki
if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.Top + 1),
{$ELSE}
Create2DIntPoint(Rect.left + 1, Rect.Top + 1),
{$ENDIF}
Radius,
cpLeftTop,
InnerLightColor,
ClipRect
);
if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.Create(Rect.right - radius, Rect.Top + 1),
{$ELSE}
Create2DIntPoint(Rect.right - radius, Rect.Top + 1),
{$ENDIF}
Radius,
cpRightTop,
InnerLightColor,
ClipRect
);
if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left + 1, Rect.bottom - Radius),
{$ELSE}
Create2DIntPoint(Rect.left + 1, Rect.bottom - Radius),
{$ENDIF}
Radius,
cpLeftBottom,
InnerLightColor,
ClipRect
);
if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - Radius, Rect.bottom - Radius),
{$ELSE}
Create2DIntPoint(Rect.right - Radius, Rect.bottom - Radius),
{$ENDIF}
Radius,
cpRightBottom,
InnerLightColor,
ClipRect
);
// Zewnêtrzna krawêdŸ
// Zaokr¹glone naro¿niki
if not(TopEdgeOpen) then
begin
x1:=Rect.Left + Radius * LeftClosed;
x2:=Rect.Right - Radius * RightClosed;
y1:=Rect.Top;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end;
// Zewnêtrzna krawêdŸ
// Zaokr¹glone naro¿niki
if not TopEdgeOpen then
begin
x1 := Rect.Left + Radius * LeftClosed;
x2 := Rect.Right - Radius * RightClosed;
y1 := Rect.Top;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end;
if not(BottomEdgeOpen) then
begin
x1:=Rect.Left + Radius * LeftClosed;
x2:=Rect.Right - Radius * RightClosed;
y1:=Rect.Bottom;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end;
if not BottomEdgeOpen then
begin
x1 := Rect.Left + Radius * LeftClosed;
x2 := Rect.Right - Radius * RightClosed;
y1 := Rect.Bottom;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, FrameColor, ClipRect);
end;
if not(LeftEdgeOpen) then
begin
y1:=Rect.Top + Radius * TopClosed;
y2:=Rect.Bottom - Radius * BottomClosed;
x1:=Rect.Left;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, FrameColor, ClipRect);
end;
if not LeftEdgeOpen then
begin
y1 := Rect.Top + Radius * TopClosed;
y2 := Rect.Bottom - Radius * BottomClosed;
x1 := Rect.Left;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, FrameColor, ClipRect);
end;
if not(RightEdgeOpen) then
begin
y1:=Rect.Top + Radius * TopClosed;
y2:=Rect.Bottom - Radius * BottomClosed;
x1:=Rect.Right;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, FrameColor, ClipRect);
end;
if not(RightEdgeOpen) then
begin
y1 := Rect.Top + Radius * TopClosed;
y2 := Rect.Bottom - Radius * BottomClosed;
x1 := Rect.Right;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, FrameColor, ClipRect);
end;
if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.Top),
{$ELSE}
Create2DIntPoint(Rect.left, Rect.Top),
{$ENDIF}
Radius,
cpLeftTop,
FrameColor,
ClipRect);
if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.Top),
{$ELSE}
Create2DIntPoint(Rect.right - radius + 1, Rect.Top),
{$ENDIF}
Radius,
cpRightTop,
FrameColor,
ClipRect);
if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.bottom - radius + 1),
{$ELSE}
Create2DIntPoint(Rect.left, Rect.bottom - radius + 1),
{$ENDIF}
Radius,
cpLeftBottom,
FrameColor,
ClipRect);
if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.bottom - radius + 1),
{$ELSE}
Create2DIntPoint(Rect.right - radius + 1, Rect.bottom - radius + 1),
{$ENDIF}
Radius,
cpRightBottom,
FrameColor,
ClipRect);
if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.Top),
{$ELSE}
Create2DIntPoint(Rect.left, Rect.Top),
{$ENDIF}
Radius,
cpLeftTop,
FrameColor,
ClipRect
);
if not(RightEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.Top),
{$ELSE}
Create2DIntPoint(Rect.right - radius + 1, Rect.Top),
{$ENDIF}
Radius,
cpRightTop,
FrameColor,
ClipRect
);
if not(LeftEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.left, Rect.bottom - radius + 1),
{$ELSE}
Create2DIntPoint(Rect.left, Rect.bottom - radius + 1),
{$ENDIF}
Radius,
cpLeftBottom,
FrameColor,
ClipRect
);
if not(RightEdgeOpen or BottomEdgeOpen) then
TGuiTools.DrawAARoundCorner(
Bitmap,
{$IFDEF EnhancedRecordSupport}
T2DIntPoint.create(Rect.right - radius + 1, Rect.bottom - radius + 1),
{$ELSE}
Create2DIntPoint(Rect.right - Radius + 1, Rect.bottom - radius + 1),
{$ENDIF}
Radius,
cpRightBottom,
FrameColor,
ClipRect
);
end;
end.

View File

@ -1,10 +1,10 @@
object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Left = 617
Height = 540
Height = 561
Top = 138
Width = 562
Caption = 'Toolbar appearance editor'
ClientHeight = 540
ClientHeight = 561
ClientWidth = 562
Color = clBtnFace
Font.Color = clWindowText
@ -318,7 +318,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end
object PageControl1: TPageControl
Left = 0
Height = 368
Height = 389
Top = 132
Width = 562
ActivePage = TabSheet3
@ -1096,7 +1096,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end
object TabSheet3: TTabSheet
Caption = 'Item'
ClientHeight = 340
ClientHeight = 361
ClientWidth = 554
ImageIndex = 2
object sItemRectangle: TShape
@ -1254,10 +1254,13 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
AnchorSideLeft.Control = pItemIdleInnerLight
AnchorSideTop.Control = pItemIdleInnerLight
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = pItemIdleInnerLight
AnchorSideRight.Side = asrBottom
Left = 116
Height = 25
Top = 279
Width = 121
Width = 100
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 20
BorderSpacing.Bottom = 4
BevelInner = bvRaised
@ -1982,6 +1985,42 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
GroupIndex = 1
OnClick = bItemActiveInnerLightColorClick
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
object TabSheet4: TTabSheet
Caption = 'Import / export'
@ -2105,7 +2144,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
object ButtonPanel: TPanel
Left = 8
Height = 24
Top = 508
Top = 529
Width = 546
Align = alBottom
BorderSpacing.Around = 8
@ -2191,8 +2230,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
'ColorS=F0FBFF'
'ColorT=A4A0A0'
)
left = 216
top = 464
left = 280
top = 512
end
object fdFontDialog: TFontDialog
Font.Color = clWindowText
@ -2200,18 +2239,18 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Font.Name = 'Tahoma'
MinFontSize = 0
MaxFontSize = 0
left = 312
top = 464
left = 376
top = 512
end
object LargeImages: TImageList
Height = 32
Width = 32
left = 48
top = 464
left = 112
top = 512
end
object SmallImages: TImageList
left = 128
top = 464
left = 192
top = 512
Bitmap = {
4C69010000001000000010000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000005BA36C7380C4

View File

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