Componentes.Terceros.DevExp.../internal/x.46/1/ExpressLayout Control 2/Sources/dxLayoutPainters.pas
2009-10-27 17:09:30 +00:00

819 lines
26 KiB
ObjectPascal

{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressLayoutControl main components }
{ }
{ Copyright (c) 2001-2009 Developer Express Inc. }
{ ALL RIGHTS RESERVED }
{ }
{ The entire contents of this file is protected by U.S. and }
{ International Copyright Laws. Unauthorized reproduction, }
{ reverse-engineering, and distribution of all or any portion of }
{ the code contained in this file is strictly prohibited and may }
{ result in severe civil and criminal penalties and will be }
{ prosecuted to the maximum extent possible under the law. }
{ }
{ RESTRICTIONS }
{ }
{ THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES }
{ (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE }
{ SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS }
{ LICENSED TO DISTRIBUTE THE EXPRESSLAYOUTCONTROL AND ALL }
{ ACCOMPANYING VCL CONTROLS AS PART OF AN EXECUTABLE PROGRAM }
{ ONLY. }
{ }
{ THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED }
{ FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE }
{ COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE }
{ AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT }
{ AND PERMISSION FROM DEVELOPER EXPRESS INC. }
{ }
{ CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON }
{ ADDITIONAL RESTRICTIONS. }
{ }
{********************************************************************}
unit dxLayoutPainters;
{$I cxVer.inc}
interface
uses
Classes, Types, Windows, Graphics, dxLayoutLookAndFeels, dxLayoutControl,
cxLookAndFeels, cxLookAndFeelPainters, dxLayoutCommon;
type
TdxLayoutGroupStandardViewInfo = class;
TdxLayoutGroupWebViewInfo = class;
TdxLayoutGroupCaptionStandardViewInfo = class;
{ Painters }
TdxLayoutGroupStandardPainter = class(TdxLayoutGroupPainter)
private
function GetViewInfo: TdxLayoutGroupStandardViewInfo;
protected
function GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass; override;
procedure DoDrawBorders; override;
procedure DrawFrame; virtual;
property ViewInfo: TdxLayoutGroupStandardViewInfo read GetViewInfo;
end;
TdxLayoutGroupOfficePainter = class(TdxLayoutGroupStandardPainter)
protected
function GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass; override;
procedure DrawFrame; override;
end;
TdxLayoutGroupWebPainter = class(TdxLayoutGroupPainter)
private
function GetLayoutLookAndFeel: TdxLayoutWebLookAndFeel;
function GetViewInfo: TdxLayoutGroupWebViewInfo;
protected
function GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass; override;
procedure DoDrawBorders; override;
procedure DrawCaptionSeparator; virtual;
procedure DrawFrame; virtual;
property LayoutLookAndFeel: TdxLayoutWebLookAndFeel read GetLayoutLookAndFeel;
property ViewInfo: TdxLayoutGroupWebViewInfo read GetViewInfo;
end;
TdxLayoutGroupCaptionStandardPainter = class(TdxLayoutGroupCaptionPainter)
private
function GetViewInfo: TdxLayoutGroupCaptionStandardViewInfo;
protected
procedure DoDrawText; override;
property ViewInfo: TdxLayoutGroupCaptionStandardViewInfo read GetViewInfo;
end;
TdxLayoutGroupCaptionWebPainter = class(TdxLayoutGroupCaptionPainter)
protected
procedure DrawBackground; override;
end;
{ ViewInfos }
// standard
TdxLayoutGroupCaptionStandardViewInfo = class(TdxLayoutGroupCaptionViewInfo)
private
function GetItemViewInfo: TdxLayoutGroupStandardViewInfo;
protected
function GetAlignHorz: TAlignment; override;
property ItemViewInfo: TdxLayoutGroupStandardViewInfo read GetItemViewInfo;
public
function CalculateWidth: Integer; override;
end;
TdxLayoutGroupStandardViewInfo = class(TdxLayoutGroupViewInfo)
private
function GetStandardLookAndFeel: TdxLayoutStandardLookAndFeel;
protected
procedure CalculateCaptionViewInfoBounds; override;
function GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass; override;
function GetMinVisibleWidth: Integer; override;
function GetCaptionViewInfoOffset: Integer; virtual;
function GetFrameBounds: TRect; virtual;
property CaptionViewInfoOffset: Integer read GetCaptionViewInfoOffset;
property LayoutLookAndFeel: TdxLayoutStandardLookAndFeel read GetStandardLookAndFeel;
public
property FrameBounds: TRect read GetFrameBounds;
end;
// office
TdxLayoutGroupCaptionOfficeViewInfo = class(TdxLayoutGroupCaptionViewInfo)
public
function CalculateWidth: Integer; override;
end;
TdxLayoutGroupOfficeViewInfo = class(TdxLayoutGroupStandardViewInfo)
protected
function GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass; override;
function GetCaptionViewInfoOffset: Integer; override;
function GetFrameBounds: TRect; override;
function GetMinVisibleWidth: Integer; override;
end;
// web
TdxLayoutGroupCaptionWebViewInfo = class(TdxLayoutGroupCaptionViewInfo)
private
function GetItemViewInfo: TdxLayoutGroupWebViewInfo;
function GetWebLookAndFeel: TdxLayoutWebLookAndFeel;
function GetOptionsEx: TdxLayoutWebLookAndFeelGroupCaptionOptions;
function GetSeparatorWidth: Integer;
protected
function GetAlignVert: TdxAlignmentVert; override;
function GetColor: TColor; override;
function GetIsDefaultColor: Boolean; override;
function GetTextAreaBounds: TRect; override;
function GetTextOffset: Integer; virtual;
property ItemViewInfo: TdxLayoutGroupWebViewInfo read GetItemViewInfo;
property LookAndFeel: TdxLayoutWebLookAndFeel read GetWebLookAndFeel;
property Options: TdxLayoutWebLookAndFeelGroupCaptionOptions read GetOptionsEx;
property TextOffset: Integer read GetTextOffset;
public
function CalculateHeight: Integer; override;
function CalculateMinWidth: Integer; override;
property SeparatorWidth: Integer read GetSeparatorWidth;
end;
TdxLayoutGroupWebViewInfo = class(TdxLayoutGroupViewInfo)
private
function GetCaptionViewInfo: TdxLayoutGroupCaptionWebViewInfo;
function GetInsideFrameBounds: TRect;
function GetWebLookAndFeel: TdxLayoutWebLookAndFeel;
function GetOptionsEx: TdxLayoutWebLookAndFeelGroupOptions;
protected
procedure CalculateCaptionViewInfoBounds; override;
function GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass; override;
function GetMinVisibleWidth: Integer; override;
function GetRestSpaceBounds: TRect; override;
function GetCaptionSeparatorAreaBounds: TRect; virtual;
function GetCaptionSeparatorBounds: TRect; virtual;
property LookAndFeel: TdxLayoutWebLookAndFeel read GetWebLookAndFeel;
property InsideFrameBounds: TRect read GetInsideFrameBounds;
property Options: TdxLayoutWebLookAndFeelGroupOptions read GetOptionsEx;
public
property CaptionSeparatorAreaBounds: TRect read GetCaptionSeparatorAreaBounds;
property CaptionSeparatorBounds: TRect read GetCaptionSeparatorBounds;
property CaptionViewInfo: TdxLayoutGroupCaptionWebViewInfo read GetCaptionViewInfo;
end;
{ TdxLayoutGroupCaptionCxLookAndFeelViewInfo }
TdxLayoutGroupCaptionCxLookAndFeelViewInfo = class(TdxLayoutGroupCaptionStandardViewInfo)
private
function GetCaptionContentOffsets: TRect;
function GetIsSkinPainterUsed: Boolean;
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
protected
function GetAlignHorz: TAlignment; override;
function GetTextAreaBounds: TRect; override;
function GetTextColor: TColor; override;
public
function CalculateHeight: Integer; override;
function CalculateWidth: Integer; override;
//
property CaptionContentOffsets: TRect read GetCaptionContentOffsets;
property IsSkinPainterUsed: Boolean read GetIsSkinPainterUsed;
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
end;
{ TdxLayoutGroupCxLookAndFeelViewInfo }
TdxLayoutGroupCxLookAndFeelViewInfo = class(TdxLayoutGroupStandardViewInfo)
private
function GetIsSkinPainterUsed: Boolean;
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
protected
procedure CalculateCaptionViewInfoBounds; override;
function CanDrawBackground: Boolean; override;
function GetBorderWidth(ASide: TdxLayoutSide): Integer; override;
function GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass; override;
function GetCaptionViewInfoOffset: Integer; override;
function GetFrameBounds: TRect; override;
//
property IsSkinPainterUsed: Boolean read GetIsSkinPainterUsed;
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
end;
{ TdxLayoutGroupCaptionCxLookAndFeelPainter }
TdxLayoutGroupCaptionCxLookAndFeelPainter = class(TdxLayoutGroupCaptionPainter)
private
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
protected
procedure DoDrawText; override;
procedure DrawBackground; override;
public
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
end;
{ TdxLayoutGroupCxLookAndFeelPainter }
TdxLayoutGroupCxLookAndFeelPainter = class(TdxLayoutGroupStandardPainter)
private
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
protected
function GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass; override;
procedure DrawFrame; override;
public
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
end;
{ TdxLayoutItemCxLookAndFeelViewInfo }
TdxLayoutItemCxLookAndFeelViewInfo = class(TdxLayoutItemViewInfo)
protected
function CanDrawBackground: Boolean; override;
end;
implementation
uses
{$IFDEF DELPHI7}
UxTheme, Themes,
{$ENDIF}
cxGraphics, cxGeometry;
type
TdxLayoutControlViewInfoAccess = class(TdxLayoutControlViewInfo);
TdxCustomLayoutItemCaptionViewInfoAccess = class(TdxCustomLayoutItemCaptionViewInfo);
{ TdxLayoutGroupStandardPainter }
function TdxLayoutGroupStandardPainter.GetViewInfo: TdxLayoutGroupStandardViewInfo;
begin
Result := TdxLayoutGroupStandardViewInfo(inherited ViewInfo);
end;
function TdxLayoutGroupStandardPainter.GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass;
begin
Result := TdxLayoutGroupCaptionStandardPainter;
end;
procedure TdxLayoutGroupStandardPainter.DoDrawBorders;
begin
inherited;
DrawFrame;
end;
procedure TdxLayoutGroupStandardPainter.DrawFrame;
var
R: TRect;
begin
{$IFDEF DELPHI7}
if ThemeServices.ThemesEnabled then
begin
ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(tbGroupBoxNormal),
ViewInfo.FrameBounds);
Exit;
end;
{$ENDIF}
R := ViewInfo.FrameBounds;
Canvas.DrawEdge(R, True, True);
InflateRect(R, -1, -1);
Canvas.DrawEdge(R, False, False);
end;
{ TdxLayoutGroupOfficePainter }
function TdxLayoutGroupOfficePainter.GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass;
begin
Result := TdxLayoutGroupCaptionPainter;
end;
procedure TdxLayoutGroupOfficePainter.DrawFrame;
var
R: TRect;
begin
R := ViewInfo.FrameBounds;
with Canvas do
begin
DrawEdge(R, True, True, [bTop]);
Inc(R.Top);
DrawEdge(R, False, False, [bTop]);
end;
end;
{ TdxLayoutGroupWebPainter }
function TdxLayoutGroupWebPainter.GetLayoutLookAndFeel: TdxLayoutWebLookAndFeel;
begin
Result := TdxLayoutWebLookAndFeel(inherited LayoutLookAndFeel);
end;
function TdxLayoutGroupWebPainter.GetViewInfo: TdxLayoutGroupWebViewInfo;
begin
Result := TdxLayoutGroupWebViewInfo(inherited ViewInfo);
end;
function TdxLayoutGroupWebPainter.GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass;
begin
Result := TdxLayoutGroupCaptionWebPainter;
end;
procedure TdxLayoutGroupWebPainter.DoDrawBorders;
begin
DrawFrame;
DrawCaptionSeparator;
inherited;
end;
procedure TdxLayoutGroupWebPainter.DrawCaptionSeparator;
begin
with Canvas do
begin
Brush.Color := ViewInfo.Color;
FillRect(ViewInfo.CaptionSeparatorAreaBounds);
Brush.Color := ViewInfo.Options.GetFrameColor;
FillRect(ViewInfo.CaptionSeparatorBounds);
end;
end;
procedure TdxLayoutGroupWebPainter.DrawFrame;
var
R: TRect;
I: Integer;
begin
R := ViewInfo.Bounds;
for I := 1 to ViewInfo.Options.FrameWidth do
begin
Canvas.FrameRect(R, ViewInfo.Options.GetFrameColor);
InflateRect(R, -1, -1);
end;
end;
{ TdxLayoutGroupCaptionStandardPainter }
procedure TdxLayoutGroupCaptionStandardPainter.DoDrawText;
{$IFDEF DELPHI7}
const
Enableds: array[Boolean] of Integer = (DTT_GRAYED, 0);
{$ENDIF}
begin
{$IFDEF DELPHI7}
if ThemeServices.ThemesEnabled then
with ViewInfo do
ThemeServices.DrawText(Canvas.Handle, ThemeServices.GetElementDetails(tbGroupBoxNormal),
Text, TextAreaBounds, cxFlagsToDTFlags(CalculateTextFlags), Enableds[Enabled])
else
inherited;
{$ELSE}
inherited;
{$ENDIF}
end;
function TdxLayoutGroupCaptionStandardPainter.GetViewInfo: TdxLayoutGroupCaptionStandardViewInfo;
begin
Result := inherited ViewInfo as TdxLayoutGroupCaptionStandardViewInfo;
end;
{ TdxLayoutGroupCaptionWebPainter }
procedure TdxLayoutGroupCaptionWebPainter.DrawBackground;
begin
if not TdxCustomLayoutItemCaptionViewInfoAccess(ViewInfo).IsTransparent then
begin
Canvas.Brush.Color := ViewInfo.Color;
Canvas.FillRect(ViewInfo.Bounds);
end;
end;
{ TdxLayoutGroupStandardCaptionViewInfo }
function TdxLayoutGroupCaptionStandardViewInfo.GetItemViewInfo: TdxLayoutGroupStandardViewInfo;
begin
Result := TdxLayoutGroupStandardViewInfo(inherited ItemViewInfo);
end;
function TdxLayoutGroupCaptionStandardViewInfo.GetAlignHorz: TAlignment;
begin
Result := taCenter;
end;
function TdxLayoutGroupCaptionStandardViewInfo.CalculateWidth: Integer;
begin
Result := inherited CalculateWidth;
if Visible then
Inc(Result, 2 + 2);
end;
{ TdxLayoutGroupStandardViewInfo }
function TdxLayoutGroupStandardViewInfo.GetStandardLookAndFeel: TdxLayoutStandardLookAndFeel;
begin
Result := TdxLayoutStandardLookAndFeel(inherited LayoutLookAndFeel);
end;
procedure TdxLayoutGroupStandardViewInfo.CalculateCaptionViewInfoBounds;
var
ACaptionWidth: Integer;
begin
FCaptionAreaBounds := BorderBounds[sdTop];
ACaptionWidth := CaptionViewInfo.CalculateWidth;
with FCaptionAreaBounds do
begin
case Item.CaptionOptions.AlignHorz of
taLeftJustify:
begin
Inc(Left, CaptionViewInfoOffset);
Right := Left + ACaptionWidth;
end;
taRightJustify:
begin
Dec(Right, CaptionViewInfoOffset);
Left := Right - ACaptionWidth;
end;
taCenter:
begin
Left := (Left + Right - ACaptionWidth) div 2;
Right := Left + ACaptionWidth;
end;
end;
Bottom := Top + CaptionViewInfo.CalculateHeight;
end;
end;
function TdxLayoutGroupStandardViewInfo.GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass;
begin
Result := TdxLayoutGroupCaptionStandardViewInfo;
end;
function TdxLayoutGroupStandardViewInfo.GetMinVisibleWidth: Integer;
begin
Result := inherited GetMinVisibleWidth;
if HasCaption then
Inc(Result, 2 * CaptionViewInfoOffset);
end;
function TdxLayoutGroupStandardViewInfo.GetCaptionViewInfoOffset: Integer;
begin
Result := LayoutLookAndFeel.HDLUToPixels(CaptionViewInfo.Font, 7) - 2;
end;
function TdxLayoutGroupStandardViewInfo.GetFrameBounds: TRect;
begin
Result := Bounds;
Inc(Result.Top, LayoutLookAndFeel.VDLUToPixels(CaptionViewInfo.Font, 4) -
LayoutLookAndFeel.FrameWidths[sdTop] div 2);
end;
{ TdxLayoutGroupOfficeCaptionViewInfo }
function TdxLayoutGroupCaptionOfficeViewInfo.CalculateWidth: Integer;
var
AOffset: Integer;
begin
Result := inherited CalculateWidth;
if Visible then
begin
AOffset := LayoutLookAndFeel.HDLUToPixels(Font, 5);
if AlignHorz = taCenter then
AOffset := 2 * AOffset;
Inc(Result, AOffset);
end;
end;
{ TdxLayoutGroupOfficeViewInfo }
function TdxLayoutGroupOfficeViewInfo.GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass;
begin
Result := TdxLayoutGroupCaptionOfficeViewInfo;
end;
function TdxLayoutGroupOfficeViewInfo.GetCaptionViewInfoOffset: Integer;
begin
Result := 0;
end;
function TdxLayoutGroupOfficeViewInfo.GetFrameBounds: TRect;
begin
Result := inherited GetFrameBounds;
Result.Bottom := Result.Top + 2;
end;
function TdxLayoutGroupOfficeViewInfo.GetMinVisibleWidth: Integer;
begin
Result := inherited GetMinVisibleWidth;
if HasCaption then
Inc(Result, 20);
end;
{ TdxLayoutGroupCaptionWebViewInfo }
function TdxLayoutGroupCaptionWebViewInfo.GetItemViewInfo: TdxLayoutGroupWebViewInfo;
begin
Result := TdxLayoutGroupWebViewInfo(inherited ItemViewInfo);
end;
function TdxLayoutGroupCaptionWebViewInfo.GetWebLookAndFeel: TdxLayoutWebLookAndFeel;
begin
Result := TdxLayoutWebLookAndFeel(inherited LayoutLookAndFeel);
end;
function TdxLayoutGroupCaptionWebViewInfo.GetOptionsEx: TdxLayoutWebLookAndFeelGroupCaptionOptions;
begin
Result := TdxLayoutWebLookAndFeelGroupCaptionOptions(inherited Options);
end;
function TdxLayoutGroupCaptionWebViewInfo.GetSeparatorWidth: Integer;
begin
Result := Options.SeparatorWidth;
end;
function TdxLayoutGroupCaptionWebViewInfo.GetAlignVert: TdxAlignmentVert;
begin
Result := tavCenter;
end;
function TdxLayoutGroupCaptionWebViewInfo.GetColor: TColor;
begin
Result := Options.GetColor;
end;
function TdxLayoutGroupCaptionWebViewInfo.GetIsDefaultColor: Boolean;
begin
Result := Options.Color = clDefault;
end;
function TdxLayoutGroupCaptionWebViewInfo.GetTextAreaBounds: TRect;
begin
Result := inherited GetTextAreaBounds;
Inc(Result.Left, TextOffset);
end;
function TdxLayoutGroupCaptionWebViewInfo.GetTextOffset: Integer;
begin
if ItemViewInfo.Options.OffsetCaption then
Result := LookAndFeel.VDLUToPixels(Font, 5)
else
Result := LookAndFeel.DLUToPixels(Font, 2);
end;
function TdxLayoutGroupCaptionWebViewInfo.CalculateHeight: Integer;
begin
if Visible then
Result := LookAndFeel.VDLUToPixels(Font, 11{12})
else
Result := inherited CalculateHeight;
end;
function TdxLayoutGroupCaptionWebViewInfo.CalculateMinWidth: Integer;
begin
Result := 2 * TextOffset + inherited CalculateMinWidth;
end;
{ TdxLayoutGroupWebViewInfo }
function TdxLayoutGroupWebViewInfo.GetCaptionViewInfo: TdxLayoutGroupCaptionWebViewInfo;
begin
Result := TdxLayoutGroupCaptionWebViewInfo(inherited CaptionViewInfo);
end;
function TdxLayoutGroupWebViewInfo.GetInsideFrameBounds: TRect;
begin
Result := cxRectInflate(Bounds, -Options.FrameWidth, -Options.FrameWidth);
end;
function TdxLayoutGroupWebViewInfo.GetWebLookAndFeel: TdxLayoutWebLookAndFeel;
begin
Result := TdxLayoutWebLookAndFeel(inherited LayoutLookAndFeel);
end;
function TdxLayoutGroupWebViewInfo.GetOptionsEx: TdxLayoutWebLookAndFeelGroupOptions;
begin
Result := TdxLayoutWebLookAndFeelGroupOptions(inherited Options);
end;
procedure TdxLayoutGroupWebViewInfo.CalculateCaptionViewInfoBounds;
begin
FCaptionAreaBounds := InsideFrameBounds;
FCaptionAreaBounds.Bottom := FCaptionAreaBounds.Top + CaptionViewInfo.CalculateHeight;
end;
function TdxLayoutGroupWebViewInfo.GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass;
begin
Result := TdxLayoutGroupCaptionWebViewInfo;
end;
function TdxLayoutGroupWebViewInfo.GetMinVisibleWidth: Integer;
begin
Result := inherited GetMinVisibleWidth;
Inc(Result, 2 * Options.FrameWidth);
end;
function TdxLayoutGroupWebViewInfo.GetRestSpaceBounds: TRect;
begin
Result := cxRectInflate(inherited GetRestSpaceBounds, -Options.FrameWidth, -Options.FrameWidth);
if HasCaption then
Result.Top := CaptionViewInfo.Bounds.Bottom;
if Options.HasCaptionSeparator(HasCaption) then
Inc(Result.Top, CaptionViewInfo.SeparatorWidth);
end;
function TdxLayoutGroupWebViewInfo.GetCaptionSeparatorAreaBounds: TRect;
begin
Result := RestSpaceBounds;
Result.Bottom := Result.Top;
Dec(Result.Top, CaptionViewInfo.SeparatorWidth);
end;
function TdxLayoutGroupWebViewInfo.GetCaptionSeparatorBounds: TRect;
begin
Result := CaptionSeparatorAreaBounds;
if not Options.OffsetCaption and not Options.OffsetItems and
(Options.FrameWidth = 0) and (CaptionViewInfo.Color = Color) then
begin
Result.Left := ClientBounds.Left;
Result.Right := ClientBounds.Right;
end;
end;
{ TdxLayoutGroupCaptionCxLookAndFeelViewInfo }
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.CalculateHeight: Integer;
begin
with CaptionContentOffsets do
Result := inherited CalculateHeight + Top + Bottom;
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.CalculateWidth: Integer;
begin
with CaptionContentOffsets do
Result := inherited CalculateWidth + Left + Right;
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetCaptionContentOffsets: TRect;
begin
Result := LookAndFeelPainter.GroupBoxBorderSize(True, cxgpTop);
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetIsSkinPainterUsed: Boolean;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).IsSkinPainterUsed;
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).LookAndFeel.Painter;
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetAlignHorz: TAlignment;
begin
if IsSkinPainterUsed then
Result := Item.CaptionOptions.AlignHorz
else
Result := inherited GetAlignHorz;
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetTextAreaBounds: TRect;
begin
Result := cxRectContent(inherited GetTextAreaBounds, CaptionContentOffsets);
end;
function TdxLayoutGroupCaptionCxLookAndFeelViewInfo.GetTextColor: TColor;
begin
Result := LookAndFeelPainter.GroupBoxTextColor(Enabled, cxgpTop);
if Result = clDefault then
Result := inherited GetTextColor;
end;
{ TdxLayoutGroupCxLookAndFeelViewInfo }
procedure TdxLayoutGroupCxLookAndFeelViewInfo.CalculateCaptionViewInfoBounds;
begin
if IsSkinPainterUsed then
begin
FCaptionAreaBounds := Bounds;
FCaptionAreaBounds.Bottom := FCaptionAreaBounds.Top + CaptionViewInfo.CalculateHeight;
end
else
inherited CalculateCaptionViewInfoBounds;
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.CanDrawBackground: Boolean;
begin
Result := not (IsDefaultColor or IsTransparent) or Specific.CanDrawBackground or
(Group.IsRoot and TdxLayoutControlViewInfoAccess(ContainerViewInfo).NeedHighlightRoot);
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetBorderWidth(ASide: TdxLayoutSide): Integer;
begin
Result := inherited GetBorderWidth(ASide);
if (ASide = sdTop) and IsSkinPainterUsed and Group.ShowBorder and Group.ShowCaption and not Group.Hidden then
Inc(Result, CaptionViewInfo.CalculateHeight);
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetCaptionViewInfoClass: TdxCustomLayoutItemCaptionViewInfoClass;
begin
Result := TdxLayoutGroupCaptionCxLookAndFeelViewInfo;
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetCaptionViewInfoOffset: Integer;
begin
if IsSkinPainterUsed then
Result := LookAndFeelPainter.GroupBoxBorderSize(True, cxgpTop).Left
else
Result := inherited GetCaptionViewInfoOffset;
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetFrameBounds: TRect;
begin
if IsSkinPainterUsed then
begin
Result := Bounds;
Inc(Result.Top, CaptionViewInfo.CalculateHeight);
end
else
Result := inherited GetFrameBounds;
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetIsSkinPainterUsed: Boolean;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).IsSkinPainterUsed;
end;
function TdxLayoutGroupCxLookAndFeelViewInfo.GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).LookAndFeelPainter;
end;
{ TdxLayoutGroupCaptionCxLookAndFeelPainter }
procedure TdxLayoutGroupCaptionCxLookAndFeelPainter.DoDrawText;
begin
with TdxLayoutGroupCaptionCxLookAndFeelViewInfo(ViewInfo) do
Self.Canvas.DrawText(Text, TextAreaBounds, CalculateTextFlags);
end;
procedure TdxLayoutGroupCaptionCxLookAndFeelPainter.DrawBackground;
begin
LookAndFeelPainter.DrawGroupBoxCaption(Canvas, ViewInfo.Bounds, cxgpTop);
end;
function TdxLayoutGroupCaptionCxLookAndFeelPainter.GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).LookAndFeelPainter;
end;
{ TdxLayoutGroupCxLookAndFeelPainter }
procedure TdxLayoutGroupCxLookAndFeelPainter.DrawFrame;
const
CaptionPositionMap: array[Boolean] of TcxGroupBoxCaptionPosition = (cxgpCenter, cxgpTop);
begin
LookAndFeelPainter.DrawGroupBoxFrame(Canvas, ViewInfo.FrameBounds,
ViewInfo.Enabled, CaptionPositionMap[ViewInfo.HasCaption]);
end;
function TdxLayoutGroupCxLookAndFeelPainter.GetCaptionPainterClass: TdxCustomLayoutItemCaptionPainterClass;
begin
Result := TdxLayoutGroupCaptionCxLookAndFeelPainter;
end;
function TdxLayoutGroupCxLookAndFeelPainter.GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
begin
Result := TdxLayoutCxLookAndFeel(LayoutLookAndFeel).LookAndFeelPainter;
end;
{ TdxLayoutItemCxLookAndFeelViewInfo }
function TdxLayoutItemCxLookAndFeelViewInfo.CanDrawBackground: Boolean;
begin
Result := False;
end;
end.