Merged: menubaractions branch into trunk
This commit is contained in:
parent
669cf750dc
commit
5574566444
@ -32,6 +32,6 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-N"..\..\Lib\D7"
|
-N"P:\algemeen\lib"
|
||||||
-LE"..\..\Lib\D7"
|
-LE"P:\algemeen\bin"
|
||||||
-LN"..\..\Lib\D7"
|
-LN"P:\algemeen\bin"
|
||||||
|
@ -91,9 +91,9 @@ ImageBase=4194304
|
|||||||
ExeDescription=X²CL GraphicList
|
ExeDescription=X²CL GraphicList
|
||||||
[Directories]
|
[Directories]
|
||||||
OutputDir=
|
OutputDir=
|
||||||
UnitOutputDir=..\..\Lib\D7
|
UnitOutputDir=$(DELPHILIB)
|
||||||
PackageDLLOutputDir=..\..\Lib\D7
|
PackageDLLOutputDir=$(DELPHIBIN)
|
||||||
PackageDCPOutputDir=..\..\Lib\D7
|
PackageDCPOutputDir=$(DELPHIBIN)
|
||||||
SearchPath=
|
SearchPath=
|
||||||
Packages=vcl;rtl;dbrtl;vcldb;vclx;dss;dsnapcrba;dsnapcon;inetdb;webdsnap;websnap;dbxcds;Irc;parsdpk;hotspotter
|
Packages=vcl;rtl;dbrtl;vcldb;vclx;dss;dsnapcrba;dsnapcon;inetdb;webdsnap;websnap;dbxcds;Irc;parsdpk;hotspotter
|
||||||
Conditionals=
|
Conditionals=
|
||||||
@ -135,7 +135,8 @@ ProductName=
|
|||||||
ProductVersion=1.0.0.0
|
ProductVersion=1.0.0.0
|
||||||
Comments=
|
Comments=
|
||||||
[Excluded Packages]
|
[Excluded Packages]
|
||||||
P:\Algemeen\components\X2CL\Lib\D7\X2CLGLD.bpl=X²CL GraphicList (Designtime)
|
P:\algemeen\bin\X2CLGLD.bpl=X²CL GraphicList (Designtime)
|
||||||
|
P:\Algemeen\bin\unageneral_d7_design.bpl=UnameIT's General Components - Design-time Editors
|
||||||
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
||||||
[HistoryLists\hlUnitAliases]
|
[HistoryLists\hlUnitAliases]
|
||||||
Count=1
|
Count=1
|
||||||
@ -144,14 +145,18 @@ Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
|||||||
Count=1
|
Count=1
|
||||||
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
||||||
[HistoryLists\hlUnitOutputDirectory]
|
[HistoryLists\hlUnitOutputDirectory]
|
||||||
Count=3
|
Count=4
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHILIB)
|
||||||
Item1=..\Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
Item2=Lib\D7
|
Item2=..\Lib\D7
|
||||||
|
Item3=Lib\D7
|
||||||
[HistoryLists\hlBPLOutput]
|
[HistoryLists\hlBPLOutput]
|
||||||
Count=2
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
Item1=Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
|
Item2=Lib\D7
|
||||||
[HistoryLists\hlDCPOutput]
|
[HistoryLists\hlDCPOutput]
|
||||||
Count=1
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
|
Item1=$(DELPHILIB)
|
||||||
|
Item2=..\..\Lib\D7
|
||||||
|
@ -32,6 +32,6 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-N"..\..\Lib\D7"
|
-N"P:\algemeen\lib\D7"
|
||||||
-LE"..\..\Lib\D7"
|
-LE"P:\algemeen\bin\D7"
|
||||||
-LN"..\..\Lib\D7"
|
-LN"P:\algemeen\bin\D7"
|
||||||
|
@ -91,9 +91,9 @@ ImageBase=4194304
|
|||||||
ExeDescription=X²CL GraphicList (Designtime)
|
ExeDescription=X²CL GraphicList (Designtime)
|
||||||
[Directories]
|
[Directories]
|
||||||
OutputDir=
|
OutputDir=
|
||||||
UnitOutputDir=..\..\Lib\D7
|
UnitOutputDir=$(DELPHILIB)
|
||||||
PackageDLLOutputDir=..\..\Lib\D7
|
PackageDLLOutputDir=$(DELPHIBIN)
|
||||||
PackageDCPOutputDir=..\..\Lib\D7
|
PackageDCPOutputDir=$(DELPHIBIN)
|
||||||
SearchPath=
|
SearchPath=
|
||||||
Packages=vcl;rtl;dbrtl;vcldb;vclx;dss;dsnapcrba;dsnapcon;inetdb;webdsnap;websnap;dbxcds;Irc;parsdpk;hotspotter
|
Packages=vcl;rtl;dbrtl;vcldb;vclx;dss;dsnapcrba;dsnapcon;inetdb;webdsnap;websnap;dbxcds;Irc;parsdpk;hotspotter
|
||||||
Conditionals=
|
Conditionals=
|
||||||
@ -105,10 +105,6 @@ HostApplication=
|
|||||||
Launcher=
|
Launcher=
|
||||||
UseLauncher=0
|
UseLauncher=0
|
||||||
DebugCWD=
|
DebugCWD=
|
||||||
[Language]
|
|
||||||
ActiveLang=
|
|
||||||
ProjectLang=
|
|
||||||
RootDir=
|
|
||||||
[Version Info]
|
[Version Info]
|
||||||
IncludeVerInfo=1
|
IncludeVerInfo=1
|
||||||
AutoIncBuild=0
|
AutoIncBuild=0
|
||||||
@ -135,6 +131,8 @@ ProductName=
|
|||||||
ProductVersion=1.0.0.0
|
ProductVersion=1.0.0.0
|
||||||
Comments=
|
Comments=
|
||||||
[Excluded Packages]
|
[Excluded Packages]
|
||||||
|
P:\algemeen\bin\X2CLGLD.bpl=X²CL GraphicList (Designtime)
|
||||||
|
P:\Algemeen\bin\unageneral_d7_design.bpl=UnameIT's General Components - Design-time Editors
|
||||||
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
||||||
[HistoryLists\hlUnitAliases]
|
[HistoryLists\hlUnitAliases]
|
||||||
Count=1
|
Count=1
|
||||||
@ -143,14 +141,18 @@ Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
|||||||
Count=1
|
Count=1
|
||||||
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
||||||
[HistoryLists\hlUnitOutputDirectory]
|
[HistoryLists\hlUnitOutputDirectory]
|
||||||
Count=3
|
Count=4
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHILIB)
|
||||||
Item1=..\Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
Item2=Lib\D7
|
Item2=..\Lib\D7
|
||||||
|
Item3=Lib\D7
|
||||||
[HistoryLists\hlBPLOutput]
|
[HistoryLists\hlBPLOutput]
|
||||||
Count=2
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
Item1=Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
|
Item2=Lib\D7
|
||||||
[HistoryLists\hlDCPOutput]
|
[HistoryLists\hlDCPOutput]
|
||||||
Count=1
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
|
Item1=$(DELPHILIB)
|
||||||
|
Item2=..\..\Lib\D7
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
-M
|
-M
|
||||||
-$M16384,1048576
|
-$M16384,1048576
|
||||||
-K$00400000
|
-K$00400000
|
||||||
-N"..\..\Lib\D7"
|
-N"P:\algemeen\lib\D7"
|
||||||
-LE"..\..\Lib\D7"
|
-LE"P:\algemeen\bin\D7"
|
||||||
-LN"..\..\Lib\D7"
|
-LN"P:\algemeen\lib\D7"
|
||||||
-Z
|
-Z
|
||||||
-w-UNSAFE_TYPE
|
-w-UNSAFE_TYPE
|
||||||
-w-UNSAFE_CODE
|
-w-UNSAFE_CODE
|
||||||
|
@ -91,9 +91,9 @@ ImageBase=4194304
|
|||||||
ExeDescription=X²CL MenuBar (Designtime)
|
ExeDescription=X²CL MenuBar (Designtime)
|
||||||
[Directories]
|
[Directories]
|
||||||
OutputDir=
|
OutputDir=
|
||||||
UnitOutputDir=..\..\Lib\D7
|
UnitOutputDir=$(DELPHILIB)
|
||||||
PackageDLLOutputDir=..\..\Lib\D7
|
PackageDLLOutputDir=$(DELPHIBIN)
|
||||||
PackageDCPOutputDir=..\..\Lib\D7
|
PackageDCPOutputDir=$(DELPHILIB)
|
||||||
SearchPath=
|
SearchPath=
|
||||||
Packages=vcl;rtl;vclx;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;CLXIB;ibxpress;VCLIB;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;dclOfficeXP;Indy70;cxLibraryVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxBarExtItemsD7;dxDockingD7;dxsbD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxPageControlVCLD7;cxGridVCLD7;cxSchedulerVCLD7;dxMasterViewD7;dxmdsD7;dxPSCoreD7;dxPSTeeChartD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSdxMVLnkD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxPCProdD7;dxPScxGridLnkD7;dxPScxExtCommonD7;dxPScxScheduler2LnkD7;wpViewPDF_D7;Rave50CLX;Rave50VCL;xtx_d7;IBSQLProperty;SamPackage;rbTCUI107;rbTC107;rbRCL107;rbIDE107;rbBDE107;rbUSERDesign107;rbUSER107;madBasic_;madDisAsm_;madExcept_;unageneral_d7
|
Packages=vcl;rtl;vclx;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;CLXIB;ibxpress;VCLIB;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;dclOfficeXP;Indy70;cxLibraryVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxBarExtItemsD7;dxDockingD7;dxsbD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxPageControlVCLD7;cxGridVCLD7;cxSchedulerVCLD7;dxMasterViewD7;dxmdsD7;dxPSCoreD7;dxPSTeeChartD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSdxMVLnkD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxPCProdD7;dxPScxGridLnkD7;dxPScxExtCommonD7;dxPScxScheduler2LnkD7;wpViewPDF_D7;Rave50CLX;Rave50VCL;xtx_d7;IBSQLProperty;SamPackage;rbTCUI107;rbTC107;rbRCL107;rbIDE107;rbBDE107;rbUSERDesign107;rbUSER107;madBasic_;madDisAsm_;madExcept_;unageneral_d7
|
||||||
Conditionals=
|
Conditionals=
|
||||||
@ -105,10 +105,6 @@ HostApplication=
|
|||||||
Launcher=
|
Launcher=
|
||||||
UseLauncher=0
|
UseLauncher=0
|
||||||
DebugCWD=
|
DebugCWD=
|
||||||
[Language]
|
|
||||||
ActiveLang=
|
|
||||||
ProjectLang=
|
|
||||||
RootDir=C:\Program Files\Borland\Delphi7\Bin\
|
|
||||||
[Version Info]
|
[Version Info]
|
||||||
IncludeVerInfo=1
|
IncludeVerInfo=1
|
||||||
AutoIncBuild=0
|
AutoIncBuild=0
|
||||||
@ -135,8 +131,6 @@ ProductName=
|
|||||||
ProductVersion=1.0.0.0
|
ProductVersion=1.0.0.0
|
||||||
Comments=
|
Comments=
|
||||||
[Excluded Packages]
|
[Excluded Packages]
|
||||||
P:\Algemeen\components\X2CL\Lib\D7\X2CLMBD.bpl=X²CL MenuBar (Designtime)
|
|
||||||
P:\Algemeen\components\X2CL\Lib\D7\X2CLGLD.bpl=X²CL GraphicList (Designtime)
|
|
||||||
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
|
||||||
[HistoryLists\hlUnitAliases]
|
[HistoryLists\hlUnitAliases]
|
||||||
Count=1
|
Count=1
|
||||||
@ -145,14 +139,18 @@ Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
|||||||
Count=1
|
Count=1
|
||||||
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
Item0=P:\Algemeen\Indy10;P:\Algemeen\Indy10\Core;P:\Algemeen\Indy10\Protocols;P:\Algemeen\Indy10\SuperCore;P:\Algemeen\Indy10\System
|
||||||
[HistoryLists\hlUnitOutputDirectory]
|
[HistoryLists\hlUnitOutputDirectory]
|
||||||
Count=3
|
Count=4
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHILIB)
|
||||||
Item1=..\Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
Item2=Lib\D7
|
Item2=..\Lib\D7
|
||||||
|
Item3=Lib\D7
|
||||||
[HistoryLists\hlBPLOutput]
|
[HistoryLists\hlBPLOutput]
|
||||||
Count=2
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
Item1=Lib\D7
|
Item1=..\..\Lib\D7
|
||||||
|
Item2=Lib\D7
|
||||||
[HistoryLists\hlDCPOutput]
|
[HistoryLists\hlDCPOutput]
|
||||||
Count=1
|
Count=3
|
||||||
Item0=..\..\Lib\D7
|
Item0=$(DELPHIBIN)
|
||||||
|
Item1=$(DELPHILIB)
|
||||||
|
Item2=..\..\Lib\D7
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
:: the problems I thought we would face. His original (Dutch) article can
|
:: the problems I thought we would face. His original (Dutch) article can
|
||||||
:: be found at:
|
:: be found at:
|
||||||
:: http://www.erikstok.net/delphi/artikelen/xpicons.html
|
:: http://www.erikstok.net/delphi/artikelen/xpicons.html
|
||||||
|
::
|
||||||
:: Last changed: $Date$
|
:: Last changed: $Date$
|
||||||
:: Revision: $Rev$
|
:: Revision: $Rev$
|
||||||
:: Author: $Author$
|
:: Author: $Author$
|
||||||
@ -24,6 +25,13 @@ uses
|
|||||||
{$IFDEF VER150}
|
{$IFDEF VER150}
|
||||||
{$WARN UNSAFE_CODE OFF}
|
{$WARN UNSAFE_CODE OFF}
|
||||||
{$WARN UNSAFE_CAST OFF}
|
{$WARN UNSAFE_CAST OFF}
|
||||||
|
{$WARN UNSAFE_TYPE OFF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$WARN UNSAFE_CODE OFF}
|
||||||
|
{$WARN UNSAFE_CAST OFF}
|
||||||
|
{$WARN UNSAFE_TYPE OFF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +40,13 @@ type
|
|||||||
TX2GraphicList = class;
|
TX2GraphicList = class;
|
||||||
TX2GraphicContainer = class;
|
TX2GraphicContainer = class;
|
||||||
|
|
||||||
|
|
||||||
|
TX2GLCustomDrawImageProc = function(ACanvas: TCanvas;
|
||||||
|
AGraphicList: TX2GraphicList;
|
||||||
|
AIndex: Integer;
|
||||||
|
AX, AY: Integer;
|
||||||
|
AEnabled: Boolean): Boolean;
|
||||||
|
|
||||||
{
|
{
|
||||||
:$ Holds a single graphic.
|
:$ Holds a single graphic.
|
||||||
}
|
}
|
||||||
@ -41,28 +56,30 @@ type
|
|||||||
FPicture: TPicture;
|
FPicture: TPicture;
|
||||||
FPictureName: String;
|
FPictureName: String;
|
||||||
|
|
||||||
function GetIndex(): Integer;
|
function GetIndex: Integer;
|
||||||
procedure SetContainer(const Value: TX2GraphicContainer);
|
procedure SetContainer(const Value: TX2GraphicContainer);
|
||||||
procedure SetIndex(const Value: Integer);
|
procedure SetIndex(const Value: Integer);
|
||||||
procedure SetPicture(const Value: TPicture);
|
procedure SetPicture(const Value: TPicture);
|
||||||
procedure SetPictureName(const Value: String);
|
procedure SetPictureName(const Value: String);
|
||||||
protected
|
protected
|
||||||
procedure Changed(); virtual;
|
procedure Changed; virtual;
|
||||||
procedure InternalSetContainer(const AContainer: TX2GraphicContainer); virtual;
|
procedure InternalSetContainer(const AContainer: TX2GraphicContainer); virtual;
|
||||||
|
|
||||||
function GenerateName(): String;
|
function GenerateName: String;
|
||||||
|
|
||||||
procedure NotifierChanged();
|
procedure NotifierChanged;
|
||||||
procedure IChangeNotifier.Changed = NotifierChanged;
|
procedure IChangeNotifier.Changed = NotifierChanged;
|
||||||
|
|
||||||
procedure ReadState(Reader: TReader); override;
|
procedure ReadState(Reader: TReader); override;
|
||||||
procedure SetParentComponent(AParent: TComponent); override;
|
procedure SetParentComponent(AParent: TComponent); override;
|
||||||
|
|
||||||
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function GetParentComponent(): TComponent; override;
|
function GetParentComponent: TComponent; override;
|
||||||
function HasParent(): Boolean; override;
|
function HasParent: Boolean; override;
|
||||||
|
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
public
|
public
|
||||||
@ -85,7 +102,7 @@ type
|
|||||||
FGraphics: TList;
|
FGraphics: TList;
|
||||||
FLists: TList;
|
FLists: TList;
|
||||||
|
|
||||||
function GetGraphicCount(): Integer;
|
function GetGraphicCount: Integer;
|
||||||
function GetGraphics(Index: Integer): TX2GraphicContainerItem;
|
function GetGraphics(Index: Integer): TX2GraphicContainerItem;
|
||||||
procedure SetGraphics(Index: Integer; const Value: TX2GraphicContainerItem);
|
procedure SetGraphics(Index: Integer; const Value: TX2GraphicContainerItem);
|
||||||
protected
|
protected
|
||||||
@ -112,9 +129,9 @@ type
|
|||||||
property Lists: TList read FLists;
|
property Lists: TList read FLists;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure Clear();
|
procedure Clear;
|
||||||
|
|
||||||
function IndexByName(const AName: String): Integer;
|
function IndexByName(const AName: String): Integer;
|
||||||
function GraphicByName(const AName: String): TX2GraphicContainerItem;
|
function GraphicByName(const AName: String): TX2GraphicContainerItem;
|
||||||
@ -170,18 +187,21 @@ type
|
|||||||
procedure DeleteImage(const AIndex: Integer); virtual;
|
procedure DeleteImage(const AIndex: Integer); virtual;
|
||||||
procedure MoveImage(const AOldIndex, ANewIndex: Integer); virtual;
|
procedure MoveImage(const AOldIndex, ANewIndex: Integer); virtual;
|
||||||
|
|
||||||
procedure RebuildImages(); virtual;
|
function CanConvert: Boolean;
|
||||||
|
|
||||||
procedure BeginUpdate();
|
procedure UpdateImageCount; virtual;
|
||||||
procedure EndUpdate();
|
procedure RebuildImages; virtual;
|
||||||
|
|
||||||
|
procedure BeginUpdate;
|
||||||
|
procedure EndUpdate;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
|
|
||||||
procedure Loaded(); override;
|
procedure Loaded; override;
|
||||||
procedure Change(); override;
|
procedure Change; override;
|
||||||
published
|
published
|
||||||
property Background: TColor read FBackground write SetBackground default clBtnFace;
|
property Background: TColor read FBackground write SetBackground default clBtnFace;
|
||||||
property Container: TX2GraphicContainer read FContainer write SetContainer;
|
property Container: TX2GraphicContainer read FContainer write SetContainer;
|
||||||
@ -190,13 +210,23 @@ type
|
|||||||
property StretchMode: TX2GLStretchMode read FStretchMode write SetStretchMode default smCrop;
|
property StretchMode: TX2GLStretchMode read FStretchMode write SetStretchMode default smCrop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure X2GLRegisterCustomDrawImageProc(ACustomDrawImageProc: TX2GLCustomDrawImageProc);
|
||||||
|
procedure X2GLUnregisterCustomDrawImageProc(ACustomDrawImageProc: TX2GLCustomDrawImageProc);
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
|
CommCtrl,
|
||||||
Forms,
|
Forms,
|
||||||
ImgList,
|
ImgList,
|
||||||
SysUtils;
|
SysUtils;
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
CustomDrawImageProcs: TList;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
PClass = ^TClass;
|
PClass = ^TClass;
|
||||||
|
|
||||||
@ -215,7 +245,7 @@ type
|
|||||||
procedure SetPicture(const Value: TPicture);
|
procedure SetPicture(const Value: TPicture);
|
||||||
public
|
public
|
||||||
constructor Create(Collection: TCollection); override;
|
constructor Create(Collection: TCollection); override;
|
||||||
destructor Destroy(); override;
|
destructor Destroy; override;
|
||||||
published
|
published
|
||||||
property Name: String read FName write FName;
|
property Name: String read FName write FName;
|
||||||
property Picture: TPicture read FPicture write SetPicture;
|
property Picture: TPicture read FPicture write SetPicture;
|
||||||
@ -223,6 +253,47 @@ type
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure X2GLRegisterCustomDrawImageProc(ACustomDrawImageProc: TX2GLCustomDrawImageProc);
|
||||||
|
var
|
||||||
|
procPointer: Pointer absolute ACustomDrawImageProc;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if CustomDrawImageProcs.IndexOf(procPointer) = -1 then
|
||||||
|
CustomDrawImageProcs.Add(procPointer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure X2GLUnregisterCustomDrawImageProc(ACustomDrawImageProc: TX2GLCustomDrawImageProc);
|
||||||
|
var
|
||||||
|
procPointer: Pointer absolute ACustomDrawImageProc;
|
||||||
|
|
||||||
|
begin
|
||||||
|
CustomDrawImageProcs.Remove(procPointer);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function CustomDrawImage(ACanvas: TCanvas; AGraphicList: TX2GraphicList;
|
||||||
|
AIndex: Integer; AX, AY: Integer; AEnabled: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
customProcIndex: Integer;
|
||||||
|
customProc: TX2GLCustomDrawImageProc;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
for customProcIndex := Pred(CustomDrawImageProcs.Count) downto 0 do
|
||||||
|
begin
|
||||||
|
customProc := TX2GLCustomDrawImageProc(CustomDrawImageProcs[customProcIndex]);
|
||||||
|
|
||||||
|
if customProc(ACanvas, AGraphicList, AIndex, AX, AY, AEnabled) then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{================ TX2GraphicContainerItem
|
{================ TX2GraphicContainerItem
|
||||||
Initialization
|
Initialization
|
||||||
========================================}
|
========================================}
|
||||||
@ -230,12 +301,12 @@ constructor TX2GraphicContainerItem.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
FPicture := TPicture.Create();
|
FPicture := TPicture.Create;
|
||||||
FPicture.PictureAdapter := Self;
|
FPicture.PictureAdapter := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TX2GraphicContainerItem.Destroy();
|
destructor TX2GraphicContainerItem.Destroy;
|
||||||
begin
|
begin
|
||||||
if Assigned(Container) then
|
if Assigned(Container) then
|
||||||
Container.RemoveGraphic(Self);
|
Container.RemoveGraphic(Self);
|
||||||
@ -259,20 +330,38 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicContainerItem.NotifierChanged();
|
procedure TX2GraphicContainerItem.NotifierChanged;
|
||||||
begin
|
begin
|
||||||
Changed();
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TX2GraphicContainerItem.Notification(AComponent: TComponent; Operation: TOperation);
|
||||||
|
begin
|
||||||
|
if (Operation = opRemove) and (AComponent = FContainer) then
|
||||||
|
FContainer := nil;
|
||||||
|
|
||||||
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicContainerItem.InternalSetContainer(const AContainer: TX2GraphicContainer);
|
procedure TX2GraphicContainerItem.InternalSetContainer(const AContainer: TX2GraphicContainer);
|
||||||
begin
|
begin
|
||||||
|
if AContainer <> FContainer then
|
||||||
|
begin
|
||||||
|
if Assigned(FContainer) then
|
||||||
|
FContainer.RemoveFreeNotification(Self);
|
||||||
|
|
||||||
FContainer := AContainer;
|
FContainer := AContainer;
|
||||||
|
|
||||||
|
if Assigned(FContainer) then
|
||||||
|
FContainer.FreeNotification(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicContainerItem.Changed();
|
procedure TX2GraphicContainerItem.Changed;
|
||||||
begin
|
begin
|
||||||
if Assigned(Container) then
|
if Assigned(Container) then
|
||||||
Container.UpdateGraphic(Self);
|
Container.UpdateGraphic(Self);
|
||||||
@ -280,21 +369,21 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TX2GraphicContainerItem.GetParentComponent(): TComponent;
|
function TX2GraphicContainerItem.GetParentComponent: TComponent;
|
||||||
begin
|
begin
|
||||||
if Assigned(Container) then
|
if Assigned(Container) then
|
||||||
Result := Container
|
Result := Container
|
||||||
else
|
else
|
||||||
Result := inherited GetParentComponent();
|
Result := inherited GetParentComponent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TX2GraphicContainerItem.HasParent(): Boolean;
|
function TX2GraphicContainerItem.HasParent: Boolean;
|
||||||
begin
|
begin
|
||||||
if Assigned(Container) then
|
if Assigned(Container) then
|
||||||
Result := True
|
Result := True
|
||||||
else
|
else
|
||||||
Result := inherited HasParent();
|
Result := inherited HasParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -303,19 +392,20 @@ procedure TX2GraphicContainerItem.ReadState(Reader: TReader);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if Reader.Parent is TX2GraphicContainer then
|
if Assigned(Reader.Parent) and (Reader.Parent is TX2GraphicContainer) then
|
||||||
Container := TX2GraphicContainer(Reader.Parent);
|
Container := TX2GraphicContainer(Reader.Parent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicContainerItem.SetParentComponent(AParent: TComponent);
|
procedure TX2GraphicContainerItem.SetParentComponent(AParent: TComponent);
|
||||||
begin
|
begin
|
||||||
if not (csLoading in ComponentState) and (AParent is TX2GraphicContainer) then
|
if (not (csLoading in ComponentState)) and
|
||||||
|
Assigned(AParent) and (AParent is TX2GraphicContainer) then
|
||||||
Container := TX2GraphicContainer(AParent);
|
Container := TX2GraphicContainer(AParent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TX2GraphicContainerItem.GetIndex(): Integer;
|
function TX2GraphicContainerItem.GetIndex: Integer;
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := -1;
|
||||||
if Assigned(Container) then
|
if Assigned(Container) then
|
||||||
@ -334,7 +424,7 @@ begin
|
|||||||
Value.AddGraphic(Self);
|
Value.AddGraphic(Self);
|
||||||
|
|
||||||
if not (csLoading in ComponentState) then
|
if not (csLoading in ComponentState) then
|
||||||
Name := GenerateName();
|
Name := GenerateName;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -358,12 +448,12 @@ begin
|
|||||||
FPictureName := Value;
|
FPictureName := Value;
|
||||||
|
|
||||||
if not (csLoading in ComponentState) then
|
if not (csLoading in ComponentState) then
|
||||||
Name := GenerateName();
|
Name := GenerateName;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TX2GraphicContainerItem.GenerateName(): String;
|
function TX2GraphicContainerItem.GenerateName: String;
|
||||||
function ValidComponentName(const AComponent: TComponent; const AName: String): Boolean;
|
function ValidComponentName(const AComponent: TComponent; const AName: String): Boolean;
|
||||||
var
|
var
|
||||||
checkOwner: TComponent;
|
checkOwner: TComponent;
|
||||||
@ -428,14 +518,14 @@ constructor TX2GraphicContainer.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
FGraphics := TList.Create();
|
FGraphics := TList.Create;
|
||||||
FLists := TList.Create();
|
FLists := TList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TX2GraphicContainer.Destroy();
|
destructor TX2GraphicContainer.Destroy;
|
||||||
begin
|
begin
|
||||||
Clear();
|
Clear;
|
||||||
|
|
||||||
FreeAndNil(FGraphics);
|
FreeAndNil(FGraphics);
|
||||||
FreeAndNil(FLists);
|
FreeAndNil(FLists);
|
||||||
@ -493,7 +583,7 @@ begin
|
|||||||
if Dest is TX2GraphicContainer then
|
if Dest is TX2GraphicContainer then
|
||||||
begin
|
begin
|
||||||
destContainer := TX2GraphicContainer(Dest);
|
destContainer := TX2GraphicContainer(Dest);
|
||||||
destContainer.Clear();
|
destContainer.Clear;
|
||||||
|
|
||||||
for graphicIndex := 0 to Pred(Self.GraphicCount) do
|
for graphicIndex := 0 to Pred(Self.GraphicCount) do
|
||||||
with TX2GraphicContainerItem.Create(destContainer) do
|
with TX2GraphicContainerItem.Create(destContainer) do
|
||||||
@ -508,10 +598,10 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicContainer.Clear();
|
procedure TX2GraphicContainer.Clear;
|
||||||
begin
|
begin
|
||||||
while GraphicsList.Count > 0 do
|
while GraphicsList.Count > 0 do
|
||||||
TX2GraphicContainerItem(GraphicsList.Last).Free();
|
TX2GraphicContainerItem(GraphicsList.Last).Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -550,7 +640,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
{ Re-generate names for graphic components }
|
{ Re-generate names for graphic components }
|
||||||
for graphicIndex := 0 to Pred(GraphicCount) do
|
for graphicIndex := 0 to Pred(GraphicCount) do
|
||||||
Graphics[graphicIndex].Name := Graphics[graphicIndex].GenerateName();
|
Graphics[graphicIndex].Name := Graphics[graphicIndex].GenerateName;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -739,7 +829,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TX2GraphicContainer.GetGraphicCount(): Integer;
|
function TX2GraphicContainer.GetGraphicCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := GraphicsList.Count;
|
Result := GraphicsList.Count;
|
||||||
end;
|
end;
|
||||||
@ -772,24 +862,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.Loaded();
|
procedure TX2GraphicList.Loaded;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.Change();
|
procedure TX2GraphicList.Change;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if FUpdateCount = 0 then
|
if FUpdateCount = 0 then
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TX2GraphicList.Destroy();
|
destructor TX2GraphicList.Destroy;
|
||||||
begin
|
begin
|
||||||
SetContainer(nil);
|
SetContainer(nil);
|
||||||
|
|
||||||
@ -851,7 +941,7 @@ function TX2GraphicList.DrawGraphic(const AIndex: Integer;
|
|||||||
case FStretchMode of
|
case FStretchMode of
|
||||||
smCrop:
|
smCrop:
|
||||||
begin
|
begin
|
||||||
bmpTemp := TBitmap.Create();
|
bmpTemp := TBitmap.Create;
|
||||||
try
|
try
|
||||||
with bmpTemp do
|
with bmpTemp do
|
||||||
begin
|
begin
|
||||||
@ -896,24 +986,28 @@ begin
|
|||||||
if (AIndex < 0) or (AIndex >= FContainer.GraphicCount) then
|
if (AIndex < 0) or (AIndex >= FContainer.GraphicCount) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if (not Assigned(FContainer.Graphics[AIndex].Picture.Graphic)) or
|
if (not Assigned(FContainer.Graphics[AIndex].Picture)) or
|
||||||
|
(not Assigned(FContainer.Graphics[AIndex].Picture.Graphic)) or
|
||||||
(FContainer.Graphics[AIndex].Picture.Graphic.Empty) then
|
(FContainer.Graphics[AIndex].Picture.Graphic.Empty) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
{ First see if any custom draw handlers want to draw the image }
|
||||||
|
if not CustomDrawImage(ACanvas, Self, AIndex, AX, AY, AEnabled) then
|
||||||
|
begin
|
||||||
if AEnabled then
|
if AEnabled then
|
||||||
// Enabled, simply draw the graphic
|
{ Enabled, simply draw the graphic }
|
||||||
InternalDrawGraphic(ACanvas, AX, AY)
|
InternalDrawGraphic(ACanvas, AX, AY)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// Disabled, need to draw the image using 50% transparency. There's only
|
{ Disabled, need to draw the image using 50% transparency. There's only
|
||||||
// one problem; not all TGraphic's support that, and neither is there a
|
one problem; not all TGraphic's support that, and neither is there a
|
||||||
// generic way of determining a pixel's transparency. So instead, we
|
generic way of determining a pixel's transparency. So instead, we
|
||||||
// blend the background with a copy of the background with the graphic
|
blend the background with a copy of the background with the graphic
|
||||||
// painted on it...
|
painted on it... }
|
||||||
bmpBackground := TBitmap.Create();
|
bmpBackground := TBitmap.Create;
|
||||||
bmpBlend := TBitmap.Create();
|
bmpBlend := TBitmap.Create;
|
||||||
try
|
try
|
||||||
// Get background from canvas
|
{ Get background from canvas }
|
||||||
with bmpBackground do
|
with bmpBackground do
|
||||||
begin
|
begin
|
||||||
Width := Self.Width;
|
Width := Self.Width;
|
||||||
@ -926,7 +1020,7 @@ begin
|
|||||||
bmpBlend.Assign(bmpBackground);
|
bmpBlend.Assign(bmpBackground);
|
||||||
InternalDrawGraphic(bmpBlend.Canvas, 0, 0);
|
InternalDrawGraphic(bmpBlend.Canvas, 0, 0);
|
||||||
|
|
||||||
// Blend graphic with background at 50%
|
{ Blend graphic with background at 50% }
|
||||||
for iY := 0 to bmpBackground.Height - 1 do
|
for iY := 0 to bmpBackground.Height - 1 do
|
||||||
begin
|
begin
|
||||||
pBackground := bmpBackground.ScanLine[iY];
|
pBackground := bmpBackground.ScanLine[iY];
|
||||||
@ -944,13 +1038,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Copy blended graphic back
|
{ Copy blended graphic back }
|
||||||
ACanvas.Draw(AX, AY, bmpBlend);
|
ACanvas.Draw(AX, AY, bmpBlend);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(bmpBlend);
|
FreeAndNil(bmpBlend);
|
||||||
FreeAndNil(bmpBackground);
|
FreeAndNil(bmpBackground);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
@ -999,17 +1094,6 @@ var
|
|||||||
pMask: PByteArray;
|
pMask: PByteArray;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not FConvert then
|
|
||||||
begin
|
|
||||||
AImage.Width := Self.Width;
|
|
||||||
AImage.Height := Self.Height;
|
|
||||||
AImage.Canvas.Brush.Color := clWhite;
|
|
||||||
AImage.Canvas.FillRect(Rect(0, 0, AImage.Width, AImage.Height));
|
|
||||||
|
|
||||||
AMask.Assign(AImage);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Technique used here: draw the image twice, once on the background color,
|
// Technique used here: draw the image twice, once on the background color,
|
||||||
// once on black. Loop through the two images, check if a pixel is the
|
// once on black. Loop through the two images, check if a pixel is the
|
||||||
// background color on one image and black on the other; if so then it's
|
// background color on one image and black on the other; if so then it's
|
||||||
@ -1051,7 +1135,7 @@ begin
|
|||||||
if not bOk then
|
if not bOk then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
bmpCompare := TBitmap.Create();
|
bmpCompare := TBitmap.Create;
|
||||||
try
|
try
|
||||||
with bmpCompare do
|
with bmpCompare do
|
||||||
begin
|
begin
|
||||||
@ -1114,10 +1198,12 @@ begin
|
|||||||
if csLoading in ComponentState then
|
if csLoading in ComponentState then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
BeginUpdate();
|
if CanConvert then
|
||||||
|
begin
|
||||||
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
bmpImage := TBitmap.Create();
|
bmpImage := TBitmap.Create;
|
||||||
bmpMask := TBitmap.Create();
|
bmpMask := TBitmap.Create;
|
||||||
try
|
try
|
||||||
BuildImage(AIndex, bmpImage, bmpMask);
|
BuildImage(AIndex, bmpImage, bmpMask);
|
||||||
Assert(AIndex <= Self.Count, 'AAAH! Images out of sync! *panics*');
|
Assert(AIndex <= Self.Count, 'AAAH! Images out of sync! *panics*');
|
||||||
@ -1131,8 +1217,10 @@ begin
|
|||||||
FreeAndNil(bmpImage);
|
FreeAndNil(bmpImage);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
EndUpdate();
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
end else
|
||||||
|
UpdateImageCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1145,13 +1233,16 @@ begin
|
|||||||
if csLoading in ComponentState then
|
if csLoading in ComponentState then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
if not CanConvert then
|
||||||
|
Exit;
|
||||||
|
|
||||||
if (AIndex < 0) or (AIndex >= Count) then
|
if (AIndex < 0) or (AIndex >= Count) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
BeginUpdate();
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
bmpImage := TBitmap.Create();
|
bmpImage := TBitmap.Create;
|
||||||
bmpMask := TBitmap.Create();
|
bmpMask := TBitmap.Create;
|
||||||
try
|
try
|
||||||
BuildImage(AIndex, bmpImage, bmpMask);
|
BuildImage(AIndex, bmpImage, bmpMask);
|
||||||
Replace(AIndex, bmpImage, bmpMask);
|
Replace(AIndex, bmpImage, bmpMask);
|
||||||
@ -1160,55 +1251,77 @@ begin
|
|||||||
FreeAndNil(bmpImage);
|
FreeAndNil(bmpImage);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
EndUpdate();
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.DeleteImage(const AIndex: Integer);
|
procedure TX2GraphicList.DeleteImage(const AIndex: Integer);
|
||||||
begin
|
begin
|
||||||
BeginUpdate();
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
Delete(AIndex);
|
Delete(AIndex);
|
||||||
finally
|
finally
|
||||||
EndUpdate();
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.MoveImage(const AOldIndex, ANewIndex: Integer);
|
procedure TX2GraphicList.MoveImage(const AOldIndex, ANewIndex: Integer);
|
||||||
begin
|
begin
|
||||||
BeginUpdate();
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
Move(AOldIndex, ANewIndex);
|
Move(AOldIndex, ANewIndex);
|
||||||
finally
|
finally
|
||||||
EndUpdate();
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.RebuildImages();
|
procedure TX2GraphicList.UpdateImageCount;
|
||||||
|
begin
|
||||||
|
if not Assigned(Container) then
|
||||||
|
Clear
|
||||||
|
else
|
||||||
|
ImageList_SetImageCount(Self.Handle, Container.GraphicCount);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TX2GraphicList.RebuildImages;
|
||||||
var
|
var
|
||||||
iIndex: Integer;
|
iIndex: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (csLoading in ComponentState) or
|
if (csLoading in ComponentState) or
|
||||||
(Width = 0) or (Height = 0) then
|
(Width = 0) or (Height = 0) then
|
||||||
exit;
|
Exit;
|
||||||
|
|
||||||
BeginUpdate();
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
Clear();
|
|
||||||
|
|
||||||
if not Assigned(FContainer) then
|
if not Assigned(FContainer) then
|
||||||
exit;
|
begin
|
||||||
|
Clear;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
UpdateImageCount;
|
||||||
|
|
||||||
|
if CanConvert then
|
||||||
|
begin
|
||||||
for iIndex := 0 to Pred(FContainer.GraphicCount) do
|
for iIndex := 0 to Pred(FContainer.GraphicCount) do
|
||||||
AddImage(iIndex);
|
UpdateImage(iIndex);
|
||||||
finally
|
|
||||||
EndUpdate();
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
EndUpdate;
|
||||||
|
inherited Change;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TX2GraphicList.CanConvert: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FConvert or (csDesigning in ComponentState);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{========================= TX2GraphicList
|
{========================= TX2GraphicList
|
||||||
@ -1250,7 +1363,7 @@ end;
|
|||||||
procedure TX2GraphicList.SetBackground(const Value: TColor);
|
procedure TX2GraphicList.SetBackground(const Value: TColor);
|
||||||
begin
|
begin
|
||||||
FBackground := Value;
|
FBackground := Value;
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1270,7 +1383,7 @@ begin
|
|||||||
FContainer.RegisterList(Self);
|
FContainer.RegisterList(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1279,7 +1392,7 @@ begin
|
|||||||
if Value <> FConvert then
|
if Value <> FConvert then
|
||||||
begin
|
begin
|
||||||
FConvert := Value;
|
FConvert := Value;
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1287,24 +1400,24 @@ end;
|
|||||||
procedure TX2GraphicList.SetEnabled(const Value: Boolean);
|
procedure TX2GraphicList.SetEnabled(const Value: Boolean);
|
||||||
begin
|
begin
|
||||||
FEnabled := Value;
|
FEnabled := Value;
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.SetStretchMode(const Value: TX2GLStretchMode);
|
procedure TX2GraphicList.SetStretchMode(const Value: TX2GLStretchMode);
|
||||||
begin
|
begin
|
||||||
FStretchMode := Value;
|
FStretchMode := Value;
|
||||||
RebuildImages();
|
RebuildImages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.BeginUpdate();
|
procedure TX2GraphicList.BeginUpdate;
|
||||||
begin
|
begin
|
||||||
Inc(FUpdateCount);
|
Inc(FUpdateCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2GraphicList.EndUpdate();
|
procedure TX2GraphicList.EndUpdate;
|
||||||
begin
|
begin
|
||||||
Assert(FUpdateCount > 0, 'EndUpdate without matching BeginUpdate!');
|
Assert(FUpdateCount > 0, 'EndUpdate without matching BeginUpdate!');
|
||||||
Dec(FUpdateCount);
|
Dec(FUpdateCount);
|
||||||
@ -1317,11 +1430,11 @@ constructor TDeprecatedGraphicItem.Create(Collection: TCollection);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
FPicture := TPicture.Create();
|
FPicture := TPicture.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TDeprecatedGraphicItem.Destroy();
|
destructor TDeprecatedGraphicItem.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FPicture);
|
FreeAndNil(FPicture);
|
||||||
|
|
||||||
@ -1335,8 +1448,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterClass(TX2GraphicContainerItem);
|
RegisterClass(TX2GraphicContainerItem);
|
||||||
|
CustomDrawImageProcs := TList.Create;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
FreeAndNil(CustomDrawImageProcs);
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -395,7 +395,7 @@ type
|
|||||||
procedure SetSelectedItem(const Value: TX2CustomMenuBarItem);
|
procedure SetSelectedItem(const Value: TX2CustomMenuBarItem);
|
||||||
protected
|
protected
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
procedure CreateHandle(); override;
|
procedure Loaded(); override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
procedure PainterUpdate(Sender: TX2CustomMenuBarPainter);
|
procedure PainterUpdate(Sender: TX2CustomMenuBarPainter);
|
||||||
procedure GroupsNotify(Sender: TObject; Item: TCollectionItem; Action: TCollectionNotification);
|
procedure GroupsNotify(Sender: TObject; Item: TCollectionItem; Action: TCollectionNotification);
|
||||||
@ -1357,7 +1357,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TX2CustomMenuBar.CreateHandle();
|
procedure TX2CustomMenuBar.Loaded();
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ object frmMain: TfrmMain
|
|||||||
Font.Style = []
|
Font.Style = []
|
||||||
OldCreateOrder = False
|
OldCreateOrder = False
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
|
OnClick = FormClick
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
PixelsPerInch = 96
|
PixelsPerInch = 96
|
||||||
TextHeight = 13
|
TextHeight = 13
|
||||||
@ -369,6 +370,7 @@ object frmMain: TfrmMain
|
|||||||
end>
|
end>
|
||||||
end>
|
end>
|
||||||
Images = glMenu
|
Images = glMenu
|
||||||
|
TabOrder = 14
|
||||||
OnCollapsed = mbTestCollapsed
|
OnCollapsed = mbTestCollapsed
|
||||||
OnCollapsing = mbTestCollapsing
|
OnCollapsing = mbTestCollapsing
|
||||||
OnExpanded = mbTestExpanded
|
OnExpanded = mbTestExpanded
|
||||||
|
@ -73,6 +73,7 @@ type
|
|||||||
procedure AnimationClick(Sender: TObject);
|
procedure AnimationClick(Sender: TObject);
|
||||||
procedure seAnimationTimeChange(Sender: TObject);
|
procedure seAnimationTimeChange(Sender: TObject);
|
||||||
procedure actTestExecute(Sender: TObject);
|
procedure actTestExecute(Sender: TObject);
|
||||||
|
procedure FormClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
procedure Event(const AMsg: String);
|
procedure Event(const AMsg: String);
|
||||||
end;
|
end;
|
||||||
@ -231,4 +232,12 @@ begin
|
|||||||
mbTest.AnimationTime := seAnimationTime.AsInteger;
|
mbTest.AnimationTime := seAnimationTime.AsInteger;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.FormClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Assigned(ActiveControl) then
|
||||||
|
Self.Caption := ActiveControl.Name
|
||||||
|
else
|
||||||
|
Self.Caption := '';
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user