jvcllaz: Add new JvTabBar demo using a JvNotebookPageList

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6394 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-05-07 20:26:26 +00:00
parent 0eafcd014e
commit 2a7a7830d6
6 changed files with 1289 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="JvTabBarDemo_NotebookPages"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="SynEdit"/>
</Item1>
<Item2>
<PackageName Value="JvPageCompsR"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="JvTabBarDemo_NotebookPages.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\bin\JvTabBarDemo_NotebookPages"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,22 @@
program JvTabBarDemo_NotebookPages;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Main
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
unit Main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
ActnList, StdActns, Menus, SynEdit, SynHighlighterPas, SynHighlighterXML,
JvTabBar, JvNotebookPageList, JvTabBarXPPainter;
type
{ TForm1 }
TForm1 = class(TForm)
Image1: TImage;
JvModernTabBarPainter1: TJvModernTabBarPainter;
JvNotebookPageList1: TJvNotebookPageList;
JvTabBar1: TJvTabBar;
JvTabBarXPPainter1: TJvTabBarXPPainter;
lprPage: TPage;
icoPage: TPage;
lpiPage: TPage;
PasSynEdit: TSynEdit;
SynXMLSyn1: TSynXMLSyn;
XMLSynEdit: TSynEdit;
SynPasSyn1: TSynPasSyn;
procedure AcModernPainterExecute(Sender: TObject);
procedure AcXPStylePainterExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure JvTabBar1TabCloseQuery(Sender: TObject; Item: TJvTabBarItem;
var CanClose: Boolean);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
dir: String;
begin
dir := ExpandFileName(Application.Location + '../examples/JvTabBar_NotebookPages/');
PasSynEdit.Lines.LoadfromFile(dir + 'main.pas');
XMLSynEdit.Lines.LoadFromFile(dir + 'JvTabBarDemo_NotebookPages.lpi');
Image1.Picture.LoadFromFile(dir + 'JvTabBarDemo_NotebookPages.ico');
end;
procedure TForm1.JvTabBar1TabCloseQuery(Sender: TObject; Item: TJvTabBarItem;
var CanClose: Boolean);
begin
CanClose := MessageDlg('Do you really want to close this tab?', mtConfirmation,
[mbYes, mbNo], 0) = mrYes;
end;
procedure TForm1.AcModernPainterExecute(Sender: TObject);
begin
JvTabBar1.Painter := JvModernTabBarPainter1;
end;
procedure TForm1.AcXPStylePainterExecute(Sender: TObject);
begin
JvTabBar1.Painter := JvTabBarXPPainter1;
end;
end.

View File

@ -504,14 +504,14 @@ const
WHEEL_DELTA = 120;
// Pixels at 96 ppi:
LEFT_MARGIN = 4;
RIGHT_MARGIN = 6;
TEXT_MARGIN_LEft = 2;
TEXT_MARGIN_RIGHT = 4;
TOP_MARGIN = 4;
BOTTOM_MARGIN = 4;
CLOSE_BUTTON_SIZE = 12;
CROSS_MARGIN = 3;
LEFT_MARGIN = 8; // Distance left edge to image or text
RIGHT_MARGIN = 8; // Distance right edge to close button or text
TEXT_MARGIN_LEFT = 8; // Distance image to text
TEXT_MARGIN_RIGHT = 8; // Distance text to close btn
TOP_MARGIN = 4; // Distance top edge to text/image/close btn (whichever is highest)
BOTTOM_MARGIN = 4; // Distance bottom edge to text/image/close btn (whichever is lowest)
CLOSE_BUTTON_SIZE = 12; // size of the close button box
CROSS_MARGIN = 8; // Margin of the "x" inside the close button
function DrawButtonFace(ACanvas: TCanvas; const ARect: TRect; AFlat: Boolean;