jvclLaz/JvTabBar: Add property TabShape (rectangular, rounded, cut).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9774 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
b66ade7a3d
commit
248adc8025
@ -24,7 +24,6 @@
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
@ -61,6 +60,7 @@
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
|
@ -63,6 +63,9 @@
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
|
@ -6,8 +6,8 @@ object Form1: TForm1
|
||||
Caption = 'JvTabBar demo (with TJvNotebookPageList)'
|
||||
ClientHeight = 438
|
||||
ClientWidth = 669
|
||||
LCLVersion = '4.99.0.0'
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object JvTabBar1: TJvTabBar
|
||||
Left = 0
|
||||
Height = 30
|
||||
@ -50,6 +50,7 @@ object Form1: TForm1
|
||||
Font.Name = 'Courier New'
|
||||
Font.Pitch = fpFixed
|
||||
Font.Quality = fqCleartype
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
@ -486,34 +487,33 @@ object Form1: TForm1
|
||||
'PasSynEdit'
|
||||
)
|
||||
VisibleSpecialChars = [vscSpace, vscTabAtLast]
|
||||
SelectedColor.BackPriority = 50
|
||||
SelectedColor.ForePriority = 50
|
||||
SelectedColor.BackPriority = 50
|
||||
SelectedColor.FramePriority = 50
|
||||
SelectedColor.BoldPriority = 50
|
||||
SelectedColor.ItalicPriority = 50
|
||||
SelectedColor.UnderlinePriority = 50
|
||||
SelectedColor.StrikeOutPriority = 50
|
||||
SelectedColor.Features = [lafPastEOL]
|
||||
BracketHighlightStyle = sbhsBoth
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Foreground = clNone
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Style = [fsBold]
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.Foreground = clGray
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.FrameColor = clGray
|
||||
MouseLinkColor.Background = clNone
|
||||
MouseLinkColor.Foreground = clBlue
|
||||
LineHighlightColor.Background = clNone
|
||||
MouseLinkColor.Background = clNone
|
||||
LineHighlightColor.Foreground = clNone
|
||||
LineHighlightColor.Background = clNone
|
||||
inline SynLeftGutterPartList1: TSynGutterPartList
|
||||
object SynGutterMarks1: TSynGutterMarks
|
||||
Width = 24
|
||||
MouseActions = <>
|
||||
MaxExtraMarksColums = 0
|
||||
Options = [sgmoDeDuplicateMarksOnOverflow]
|
||||
end
|
||||
object SynGutterLineNumber1: TSynGutterLineNumber
|
||||
Width = 15
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clBtnFace
|
||||
MarkupInfo.Foreground = clNone
|
||||
MarkupInfo.Background = clBtnFace
|
||||
DigitCount = 2
|
||||
ShowOnlyLineNumbersMultiplesOf = 1
|
||||
ZeroStart = False
|
||||
@ -528,14 +528,14 @@ object Form1: TForm1
|
||||
object SynGutterSeparator1: TSynGutterSeparator
|
||||
Width = 2
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clWhite
|
||||
MarkupInfo.Foreground = clGray
|
||||
MarkupInfo.Background = clWhite
|
||||
end
|
||||
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
||||
AutoSize = False
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clNone
|
||||
MarkupInfo.Foreground = clGray
|
||||
MarkupInfo.Background = clNone
|
||||
MouseActionsExpanded = <>
|
||||
MouseActionsCollapsed = <>
|
||||
end
|
||||
@ -554,6 +554,7 @@ object Form1: TForm1
|
||||
Font.Name = 'Courier New'
|
||||
Font.Pitch = fpFixed
|
||||
Font.Quality = fqCleartype
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
@ -990,34 +991,33 @@ object Form1: TForm1
|
||||
'XMLSynEdit'
|
||||
)
|
||||
VisibleSpecialChars = [vscSpace, vscTabAtLast]
|
||||
SelectedColor.BackPriority = 50
|
||||
SelectedColor.ForePriority = 50
|
||||
SelectedColor.BackPriority = 50
|
||||
SelectedColor.FramePriority = 50
|
||||
SelectedColor.BoldPriority = 50
|
||||
SelectedColor.ItalicPriority = 50
|
||||
SelectedColor.UnderlinePriority = 50
|
||||
SelectedColor.StrikeOutPriority = 50
|
||||
SelectedColor.Features = [lafPastEOL]
|
||||
BracketHighlightStyle = sbhsBoth
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Foreground = clNone
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Style = [fsBold]
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.Foreground = clGray
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.FrameColor = clGray
|
||||
MouseLinkColor.Background = clNone
|
||||
MouseLinkColor.Foreground = clBlue
|
||||
LineHighlightColor.Background = clNone
|
||||
MouseLinkColor.Background = clNone
|
||||
LineHighlightColor.Foreground = clNone
|
||||
LineHighlightColor.Background = clNone
|
||||
inline SynLeftGutterPartList1: TSynGutterPartList
|
||||
object SynGutterMarks1: TSynGutterMarks
|
||||
Width = 24
|
||||
MouseActions = <>
|
||||
MaxExtraMarksColums = 0
|
||||
Options = [sgmoDeDuplicateMarksOnOverflow]
|
||||
end
|
||||
object SynGutterLineNumber1: TSynGutterLineNumber
|
||||
Width = 15
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clBtnFace
|
||||
MarkupInfo.Foreground = clNone
|
||||
MarkupInfo.Background = clBtnFace
|
||||
DigitCount = 2
|
||||
ShowOnlyLineNumbersMultiplesOf = 1
|
||||
ZeroStart = False
|
||||
@ -1032,14 +1032,14 @@ object Form1: TForm1
|
||||
object SynGutterSeparator1: TSynGutterSeparator
|
||||
Width = 2
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clWhite
|
||||
MarkupInfo.Foreground = clGray
|
||||
MarkupInfo.Background = clWhite
|
||||
end
|
||||
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
||||
AutoSize = False
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clNone
|
||||
MarkupInfo.Foreground = clGray
|
||||
MarkupInfo.Background = clNone
|
||||
MouseActionsExpanded = <>
|
||||
MouseActionsCollapsed = <>
|
||||
end
|
||||
@ -1063,9 +1063,11 @@ object Form1: TForm1
|
||||
DirectiveAttri.Foreground = clRed
|
||||
DirectiveAttri.Style = [fsBold]
|
||||
CompilerMode = pcmDelphi
|
||||
NestedComments = False
|
||||
left = 157
|
||||
top = 111
|
||||
ModeSwitches = [pcsTypeHelpers]
|
||||
StringMultilineMode = []
|
||||
NestedBracketAttribs = <>
|
||||
Left = 157
|
||||
Top = 111
|
||||
end
|
||||
object JvModernTabBarPainter1: TJvModernTabBarPainter
|
||||
Color = clGradientInactiveCaption
|
||||
@ -1076,22 +1078,22 @@ object Form1: TForm1
|
||||
DisabledFont.Color = clGrayText
|
||||
SelectedFont.Color = clWindowText
|
||||
SelectedFont.Style = [fsBold]
|
||||
left = 155
|
||||
top = 209
|
||||
Left = 155
|
||||
Top = 209
|
||||
end
|
||||
object JvTabBarXPPainter1: TJvTabBarXPPainter
|
||||
Font.Color = clWindowText
|
||||
DisabledFont.Color = clGrayText
|
||||
SelectedFont.Color = clWindowText
|
||||
FixedTabSize = 0
|
||||
left = 312
|
||||
top = 209
|
||||
Left = 312
|
||||
Top = 209
|
||||
end
|
||||
object SynXMLSyn1: TSynXMLSyn
|
||||
DefaultFilter = 'XML Document (*.xml,*.xsd,*.xsl,*.xslt,*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'
|
||||
Enabled = False
|
||||
WantBracesParsed = False
|
||||
left = 241
|
||||
top = 111
|
||||
Left = 241
|
||||
Top = 111
|
||||
end
|
||||
end
|
||||
|
@ -54,6 +54,8 @@ begin
|
||||
{$IF LCL_FullVersion >= 2010000}
|
||||
JvTabBar1.PageListTabLink := true;
|
||||
{$IFEND}
|
||||
JvTabBar1.TabShape := tsRounded;
|
||||
|
||||
dir := ExpandFileName(Application.Location + '../../examples/JvTabBar_NotebookPages/');
|
||||
PasSynEdit.Lines.LoadfromFile(dir + 'main.pas');
|
||||
XMLSynEdit.Lines.LoadFromFile(dir + 'JvTabBarDemo_NotebookPages.lpi');
|
||||
|
@ -1,7 +1,7 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 683
|
||||
Left = 690
|
||||
Height = 497
|
||||
Top = 173
|
||||
Top = 208
|
||||
Width = 734
|
||||
Caption = 'JvTabBar Demo'
|
||||
ClientHeight = 497
|
||||
@ -41,7 +41,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object JvPageList: TJvPageList
|
||||
Left = 0
|
||||
Height = 382
|
||||
Height = 362
|
||||
Top = 40
|
||||
Width = 734
|
||||
ActivePage = JvStandardPage1
|
||||
@ -49,13 +49,13 @@ object MainForm: TMainForm
|
||||
Align = alClient
|
||||
object JvStandardPage1: TJvStandardPage
|
||||
Left = 0
|
||||
Height = 382
|
||||
Height = 362
|
||||
Top = 0
|
||||
Width = 734
|
||||
Caption = 'Memo'
|
||||
object Memo1: TMemo
|
||||
Left = 8
|
||||
Height = 366
|
||||
Height = 346
|
||||
Top = 8
|
||||
Width = 718
|
||||
Align = alClient
|
||||
@ -649,13 +649,13 @@ object MainForm: TMainForm
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 75
|
||||
Top = 422
|
||||
Height = 95
|
||||
Top = 402
|
||||
Width = 734
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 75
|
||||
ClientHeight = 95
|
||||
ClientWidth = 734
|
||||
TabOrder = 2
|
||||
object lblPainter: TLabel
|
||||
@ -771,7 +771,7 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 207
|
||||
Height = 15
|
||||
Top = 40
|
||||
Top = 67
|
||||
Width = 68
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Scroll Layout'
|
||||
@ -779,13 +779,14 @@ object MainForm: TMainForm
|
||||
end
|
||||
object cmbScrollLayout: TComboBox
|
||||
AnchorSideLeft.Control = cmbOrientation
|
||||
AnchorSideTop.Control = cmbOrientation
|
||||
AnchorSideTop.Control = cmbTabShape
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 283
|
||||
Height = 23
|
||||
Top = 36
|
||||
Top = 63
|
||||
Width = 100
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
@ -842,6 +843,40 @@ object MainForm: TMainForm
|
||||
TabOrder = 8
|
||||
OnClick = bttnAddTabClick
|
||||
end
|
||||
object lblTabShape: TLabel
|
||||
AnchorSideLeft.Control = cmbPainter
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cmbTabShape
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 207
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 53
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Tab shape'
|
||||
ParentColor = False
|
||||
end
|
||||
object cmbTabShape: TComboBox
|
||||
AnchorSideLeft.Control = cmbOrientation
|
||||
AnchorSideTop.Control = cmbOrientation
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 283
|
||||
Height = 23
|
||||
Top = 36
|
||||
Width = 100
|
||||
BorderSpacing.Top = 4
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'rectangular'
|
||||
'rounded'
|
||||
'cut'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 9
|
||||
Text = 'rectangular'
|
||||
OnChange = cmbTabShapeChange
|
||||
end
|
||||
end
|
||||
object JvModernTabBarPainter: TJvModernTabBarPainter
|
||||
HotTrackColor = clSkyBlue
|
||||
|
@ -23,6 +23,7 @@ type
|
||||
cmbScrollLayout: TComboBox;
|
||||
cmbPainter: TComboBox;
|
||||
cmbOrientation: TComboBox;
|
||||
cmbTabShape: TComboBox;
|
||||
Image1: TImage;
|
||||
ImageList1: TImageList;
|
||||
JvModernTabBarPainter: TJvModernTabBarPainter;
|
||||
@ -36,6 +37,7 @@ type
|
||||
lblScrollLayout: TLabel;
|
||||
lblPainter: TLabel;
|
||||
lblOrientation: TLabel;
|
||||
lblTabShape: TLabel;
|
||||
Memo1: TMemo;
|
||||
Panel1: TPanel;
|
||||
ShellListView1: TShellListView;
|
||||
@ -51,6 +53,7 @@ type
|
||||
procedure cmbScrollLayoutChange(Sender: TObject);
|
||||
procedure cmbPainterChange(Sender: TObject);
|
||||
procedure cmbOrientationChange(Sender: TObject);
|
||||
procedure cmbTabShapeChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure JvTabBarTabCloseQuery(Sender: TObject; Item: TJvTabBarItem;
|
||||
var CanClose: Boolean);
|
||||
@ -151,6 +154,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.cmbTabShapeChange(Sender: TObject);
|
||||
begin
|
||||
JvTabBar.TabShape := TJvTabShape(cmbTabShape.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
counter := 0;
|
||||
|
@ -42,7 +42,9 @@ type
|
||||
|
||||
TJvTabBarOrientation = (toTop, toBottom);
|
||||
TJvTabBarScrollButtonKind = (sbScrollLeft, sbScrollRight);
|
||||
TJvTabBarScrollButtonLayout = (sblTop, sblBottom, sblSides);
|
||||
TJvTabBarScrollButtonState = (sbsHidden, sbsNormal, sbsHot, sbsPressed, sbsDisabled);
|
||||
TJvTabShape = (tsRectangular, tsRounded, tsCut);
|
||||
|
||||
TJvGetModifiedEvent = procedure(Sender: TJvTabBarItem; var Modified: Boolean) of object;
|
||||
TJvGetEnabledEvent = procedure(Sender: TJvTabBarItem; var Enabled: Boolean) of object;
|
||||
@ -172,7 +174,7 @@ type
|
||||
DEFAULT_CLOSE_CROSS_COLOR_SELECTED = clBlack;
|
||||
DEFAULT_CLOSE_RECT_COLOR = $868686;
|
||||
DEFAULT_CLOSE_RECT_COLOR_DISABLED = $D6D6D6;
|
||||
DEFAULT_CONTROL_DIVIDE_COLOR = clBlack;
|
||||
DEFAULT_CONTROL_DIVIDE_COLOR = clMedGray;
|
||||
DEFAULT_DIVIDER_COLOR = $99A8AC;
|
||||
DEFAULT_HOTTRACK_COLOR = $99A8AC;
|
||||
DEFAULT_MODIFIED_CROSS_COLOR = clRed;
|
||||
@ -227,6 +229,9 @@ type
|
||||
procedure DrawBackground(Canvas: TCanvas; TabBar: TJvCustomTabBar; R: TRect); override;
|
||||
procedure DrawDivider(Canvas: TCanvas; LeftTab: TJvTabBarItem; R: TRect); override;
|
||||
procedure DrawMoveDivider(Canvas: TCanvas; Tab: TJvTabBarItem; MoveLeft: Boolean); override;
|
||||
procedure DrawCutTab(Canvas: TCanvas; ATabRect: TRect; AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation); virtual;
|
||||
procedure DrawRectTab(Canvas: TCanvas; ATabRect: TRect; AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation); virtual;
|
||||
procedure DrawRoundedTab(Canvas: TCanvas; ATabRect: TRect; AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation); virtual;
|
||||
procedure DrawScrollBarGlyph(ACanvas: TCanvas; TabBar: TJvCustomTabBar;
|
||||
X, Y: Integer; ALeft, Disabled, Hot: Boolean); override;
|
||||
procedure DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem; ATabRect: TRect); override;
|
||||
@ -275,8 +280,6 @@ type
|
||||
ExState: Boolean;
|
||||
end;
|
||||
|
||||
TJvTabBarScrollButtonLayout = (sblTop, sblBottom, sblSides);
|
||||
|
||||
TJvCustomTabBar = class(TCustomControl)
|
||||
private
|
||||
FTabs: TJvTabBarItems;
|
||||
@ -299,6 +302,7 @@ type
|
||||
FSelectBeforeClose: Boolean;
|
||||
FPageList: TCustomControl;
|
||||
FHintLocked: Integer;
|
||||
FTabShape: TJvTabShape;
|
||||
|
||||
FOnTabClosing: TJvTabBarClosingEvent;
|
||||
FOnTabSelected: TJvTabBarItemEvent;
|
||||
@ -316,7 +320,6 @@ type
|
||||
FBtnLeftScroll: TJvTabBarScrollButtonInfo;
|
||||
FBtnRightScroll: TJvTabBarScrollButtonInfo;
|
||||
FScrollButtonLayout: TJvTabBarScrollButtonLayout;
|
||||
// FScrollButtonBackground: TBitmap;
|
||||
FHint: TCaption;
|
||||
FFlatScrollButtons: Boolean;
|
||||
FRoundedScrollButtons: Boolean;
|
||||
@ -344,6 +347,7 @@ type
|
||||
function FindSelectableTab(Tab: TJvTabBarItem): TJvTabBarItem;
|
||||
procedure SetFlatScrollButtons(const Value: Boolean);
|
||||
procedure SetRoundedScrollButtons(const Value: Boolean);
|
||||
procedure SetTabShape(const Value: TJvTabShape);
|
||||
procedure SetScrollButtonLayout(const Value: TJvTabBarScrollButtonLayout);
|
||||
procedure SetPageList(const Value: TCustomControl);
|
||||
procedure SetOrientation(const Value: TJvTabBarOrientation);
|
||||
@ -448,6 +452,7 @@ type
|
||||
property FlatScrollButtons: Boolean read FFlatScrollButtons write SetFlatScrollButtons default True;
|
||||
property RoundedScrollButtons: Boolean read FRoundedScrollButtons write SetRoundedScrollButtons default False;
|
||||
property ScrollButtonLayout: TJvTabBarScrollButtonLayout read FScrollButtonLayout write SetScrollButtonLayout default sblTop;
|
||||
property TabShape: TJvTabShape read FTabShape write SetTabShape default tsRectangular;
|
||||
property Height read GetHeight write SetHeight;
|
||||
property Hint: TCaption read FHint write SetHint;
|
||||
property AllowTabMoving: Boolean read FAllowTabMoving write FAllowTabMoving default False;
|
||||
@ -493,6 +498,7 @@ type
|
||||
property FlatScrollButtons;
|
||||
property RoundedScrollButtons;
|
||||
property ScrollButtonLayout;
|
||||
property TabShape;
|
||||
property AllowTabMoving;
|
||||
|
||||
property PageListTabLink;
|
||||
@ -1528,7 +1534,7 @@ begin
|
||||
begin
|
||||
Inc(Offset, X); // this tab is placed too left.
|
||||
X := 0;
|
||||
Tab.FLeft := -Offset - 10;
|
||||
Tab.FLeft := -Offset - Scale96ToFont(10);
|
||||
end;
|
||||
Inc(Index);
|
||||
end
|
||||
@ -1908,6 +1914,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvCustomTabBar.SetTabShape(const Value: TJvTabShape);
|
||||
begin
|
||||
if Value <> FTabShape then
|
||||
begin
|
||||
FTabShape := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvCustomTabBar.SetScrollButtonLayout(const Value: TJvTabBarScrollButtonLayout);
|
||||
begin
|
||||
if Value <> FScrollButtonLayout then
|
||||
@ -2642,6 +2657,123 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvModernTabBarPainter.DrawCutTab(Canvas: TCanvas; ATabRect: TRect;
|
||||
AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation);
|
||||
var
|
||||
P: array[0..7] of TPoint;
|
||||
delta: Integer;
|
||||
begin
|
||||
delta := ATabRect.Height div 4;
|
||||
if AOrientation = toTop then
|
||||
begin
|
||||
P[0] := Point(ATabRect.Left - delta, ATabRect.Bottom);
|
||||
P[1] := Point(ATabRect.Left, ATabRect.Bottom - delta);
|
||||
P[2] := Point(ATabRect.Left, ATabRect.Top + delta);
|
||||
P[3] := Point(ATabRect.Left + delta, ATabRect.Top);
|
||||
P[4] := Point(ATabRect.Right - delta, ATabRect.Top);
|
||||
P[5] := Point(ATabRect.Right, ATabRect.Top + delta);
|
||||
P[6] := Point(ATabRect.Right, ATabRect.Bottom - delta);
|
||||
P[7] := Point(ATabRect.Right + delta, ATabRect.Bottom);
|
||||
end else
|
||||
begin
|
||||
P[0] := Point(ATabRect.Left - delta, ATabRect.Top);
|
||||
P[1] := Point(ATabRect.Left, ATabRect.Top + delta);
|
||||
P[2] := Point(ATabRect.Left, ATabRect.Bottom - delta);
|
||||
P[3] := Point(ATabRect.Left + delta , ATabRect.Bottom);
|
||||
P[4] := Point(ATabRect.Right - delta, ATabRect.Bottom);
|
||||
P[5] := Point(ATabRect.Right, ATabRect.Bottom - delta);
|
||||
P[6] := Point(ATabRect.Right, ATabRect.Top + delta);
|
||||
P[7] := Point(ATabRect.Right + delta, ATabRect.Top);
|
||||
end;
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := AFillColor;
|
||||
Pen.Style := psClear;
|
||||
Polygon(P);
|
||||
Pen.Style := psSolid;
|
||||
Pen.Color := ABorderColor;
|
||||
Pen.Width := 1;
|
||||
PolyLine(P);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvModernTabBarPainter.DrawRectTab(Canvas: TCanvas; ATabRect: TRect;
|
||||
AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation);
|
||||
begin
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := AFillColor;
|
||||
FillRect(ATabRect);
|
||||
|
||||
Pen.Color := ABorderColor;
|
||||
if AOrientation = toBottom then
|
||||
begin
|
||||
MoveTo(ATabRect.Left, ATabRect.Top);
|
||||
LineTo(ATabRect.Left, ATabRect.Bottom - 1);
|
||||
LineTo(ATabRect.Right - 1, ATabRect.Bottom - 1);
|
||||
LineTo(ATabRect.Right - 1, ATabRect.Top - 1{end});
|
||||
end
|
||||
else // toTop
|
||||
begin
|
||||
MoveTo(ATabRect.Left, ATabRect.Bottom - 1);
|
||||
LineTo(ATabRect.Left, ATabRect.Top);
|
||||
LineTo(ATabRect.Right - 1, ATabRect.Top);
|
||||
LineTo(ATabRect.Right - 1, ATabRect.Bottom - 1 + 1{end});
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvModernTabBarPainter.DrawRoundedTab(Canvas: TCanvas; ATabRect: TRect;
|
||||
AFillColor, ABorderColor: TColor; AOrientation: TJvTabBarOrientation);
|
||||
const
|
||||
POINTS_PER_ARC = 9;
|
||||
var
|
||||
P: array[0..4 * POINTS_PER_ARC - 1] of TPoint;
|
||||
R: Integer;
|
||||
|
||||
procedure CalcArcPoints(Center: TPoint; FirstIndex, StartAngle, EndAngle, Radius: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
angle, deltaAngle: Double;
|
||||
begin
|
||||
deltaAngle := (EndAngle - StartAngle) / POINTS_PER_ARC;
|
||||
for i := 0 to POINTS_PER_ARC-1 do
|
||||
begin
|
||||
angle := -(StartAngle + i * deltaAngle)/180 * pi;
|
||||
P[FirstIndex + i].X := Center.X + round(cos(Angle) * Radius);
|
||||
P[FirstIndex + i].Y := Center.Y + round(sin(Angle) * Radius);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
R := ATabRect.Height div 3;
|
||||
if AOrientation = toTop then
|
||||
begin
|
||||
CalcArcPoints(Point(ATabRect.Left - R, ATabRect.Bottom - R), 0, 270, 360, R);
|
||||
CalcArcPoints(Point(ATabRect.Left + R, ATabRect.Top + R), POINTS_PER_ARC, 180, 90, R);
|
||||
CalcArcPoints(Point(ATabRect.Right - R, ATabRect.Top + R), 2*POINTS_PER_ARC, 90, 0, R);
|
||||
CalcArcPoints(Point(ATabRect.Right + R, ATabRect.Bottom - R), 3*POINTS_PER_ARC, 180, 270, R);
|
||||
end else
|
||||
begin
|
||||
CalcArcPoints(Point(ATabRect.Left - R, ATabRect.Top + R), 0, 90, 0, R);
|
||||
CalcArcPoints(Point(ATabRect.Left + R, ATabRect.Bottom - R), POINTS_PER_ARC, 180, 270, R);
|
||||
CalcArcPoints(Point(ATabRect.Right - R, ATabRect.Bottom - R), 2*POINTS_PER_ARC, 270, 360, R);
|
||||
CalcArcPoints(Point(ATabRect.Right + R, ATabRect.Top + R), 3*POINTS_PER_ARC, 180, 90, R);
|
||||
end;
|
||||
|
||||
with Canvas do begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := AFillColor;
|
||||
Pen.Style := psClear;
|
||||
Polygon(P);
|
||||
Pen.Style := psSolid;
|
||||
Pen.Width := 1;
|
||||
Pen.Color := ABorderColor;
|
||||
PolyLine(P);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvModernTabBarPainter.DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem;
|
||||
ATabRect: TRect);
|
||||
@ -2670,24 +2802,13 @@ begin
|
||||
|
||||
if Tab.Selected then
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := TabColor;
|
||||
FillRect(R);
|
||||
|
||||
Pen.Color := ControlDivideColor;
|
||||
if Tab.TabBar.Orientation = toBottom then
|
||||
begin
|
||||
MoveTo(R.Left, R.Top);
|
||||
LineTo(R.Left, R.Bottom - 1);
|
||||
LineTo(R.Right - 1, R.Bottom - 1);
|
||||
LineTo(R.Right - 1, R.Top - 1{end});
|
||||
end
|
||||
else // toTop
|
||||
begin
|
||||
MoveTo(R.Left, R.Bottom - 1);
|
||||
LineTo(R.Left, R.Top);
|
||||
LineTo(R.Right - 1, R.Top);
|
||||
LineTo(R.Right - 1, R.Bottom - 1 + 1{end});
|
||||
case Tab.TabBar.TabShape of
|
||||
tsRectangular:
|
||||
DrawRectTab(Canvas, ATabRect, TabColor, ControLDivideColor, Tab.TabBar.Orientation);
|
||||
tsRounded:
|
||||
DrawRoundedTab(Canvas, ATabRect, TabColor, ControlDivideColor, Tab.TabBar.Orientation);
|
||||
tsCut:
|
||||
DrawCutTab(Canvas, ATabRect, TabColor, ControlDivideColor, Tab.TabBar.Orientation);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user