VrClasses.pas
上传用户:hbszzs
上传日期:2008-08-20
资源大小:628k
文件大小:35k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. {*****************************************************}
  2. {                                                     }
  3. {     Varian Component Workshop                       }
  4. {                                                     }
  5. {     Varian Software NL (c) 1996-2000                }
  6. {     All Rights Reserved                             }
  7. {                                                     }
  8. {*****************************************************}
  9. unit VrClasses;
  10. {$I VRLIB.INC}
  11. interface
  12. uses
  13.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  14.   VrTypes, VrSysUtils;
  15. type
  16.   TVrPersistent = class(TPersistent)
  17.   private
  18.     FUpdateCount: Integer;
  19.     FOnChange: TNotifyEvent;
  20.   protected
  21.     procedure Changed;
  22.   public
  23.     procedure BeginUpdate;
  24.     procedure EndUpdate;
  25.     property OnChange: TNotifyEvent read FOnChange write FOnChange;
  26.   end;
  27.   TVrBevelStyle = (bsNone, bsLowered, bsRaised);
  28.   TVrBevelOutlineStyle = (osOuter, osInner, osNone);
  29.   TVrBevelWidth = 1..MaxInt;
  30.   TVrBorderWidth = 0..MaxInt;
  31.   TVrBevelSpace = 0..MaxInt;
  32.   TVrBevel = class(TVrPersistent)
  33.   private
  34.     FBorderWidth: TVrBorderWidth;
  35.     FBorderColor: TColor;
  36.     FInnerShadow: TColor;
  37.     FInnerHighlight: TColor;
  38.     FInnerWidth: TVrBevelWidth;
  39.     FInnerStyle: TVrBevelStyle;
  40.     FInnerOutline: TVrBevelOutlineStyle;
  41.     FInnerSpace: TVrBevelSpace;
  42.     FInnerColor: TColor;
  43.     FOuterShadow: TColor;
  44.     FOuterHighlight: TColor;
  45.     FOuterWidth: TVrBevelWidth;
  46.     FOuterStyle: TVrBevelStyle;
  47.     FOuterOutline: TVrBevelOutlineStyle;
  48.     FOuterSpace: TVrBevelSpace;
  49.     FOuterColor: TColor;
  50.     FVisible: Boolean;
  51.     procedure SetBorderWidth(Value: TVrBorderWidth);
  52.     procedure SetBorderColor(Value: TColor);
  53.     procedure SetInnerShadow(Value: TColor);
  54.     procedure SetInnerHighlight(Value: TColor);
  55.     procedure SetInnerWidth(Value: TVrBevelWidth);
  56.     procedure SetInnerStyle(Value: TVrBevelStyle);
  57.     procedure SetInnerOutline(Value: TVrBevelOutlineStyle);
  58.     procedure SetInnerSpace(Value: TVrBevelSpace);
  59.     procedure SetInnerColor(Value: TColor);
  60.     procedure SetOuterShadow(Value: TColor);
  61.     procedure SetOuterHighlight(Value: TColor);
  62.     procedure SetOuterWidth(Value: TVrBevelWidth);
  63.     procedure SetOuterStyle(Value: TVrBevelStyle);
  64.     procedure SetOuterOutline(Value: TVrBevelOutlineStyle);
  65.     procedure SetOuterSpace(Value: TVrBevelSpace);
  66.     procedure SetOuterColor(Value: TColor);
  67.     procedure SetVisible(Value: Boolean);
  68.   public
  69.     constructor Create;
  70.     procedure Assign(Source: TPersistent); override;
  71.     procedure GetVisibleArea(var Rect: TRect);
  72.     procedure Paint(Canvas: TCanvas; var Rect: TRect);
  73.   published
  74.     property BorderWidth: TVrBorderWidth read FBorderWidth write SetBorderWidth default 0;
  75.     property BorderColor: TColor read FBorderColor write SetBorderColor default clBtnFace;
  76. {}  property InnerShadow: TColor read FInnerShadow write SetInnerShadow;
  77. {}  property InnerHighlight: TColor read FInnerHighlight write SetInnerHighlight;
  78. {}  property InnerWidth: TVrBevelWidth read FInnerWidth write SetInnerWidth;
  79. {}  property InnerStyle: TVrBevelStyle read FInnerStyle write SetInnerStyle;
  80.     property InnerOutline: TVrBevelOutlineStyle read FInnerOutline write SetInnerOutline default osNone;
  81. {}  property InnerSpace: TVrBevelSpace read FInnerSpace write SetInnerSpace;
  82. {}  property InnerColor: TColor read FInnerColor write SetInnerColor;
  83. {}  property OuterShadow: TColor read FOuterShadow write SetOuterShadow;
  84. {}  property OuterHighlight: TColor read FOuterHighlight write SetOuterHighlight;
  85.     property OuterWidth: TVrBevelWidth read FOuterWidth write SetOuterWidth default 1;
  86. {}  property OuterStyle: TVrBevelStyle read FOuterStyle write SetOuterStyle;
  87. {}  property OuterOutline: TVrBevelOutlineStyle read FOuterOutline write SetOuterOutline;
  88.     property OuterSpace: TVrBevelSpace read FOuterSpace write SetOuterSpace default 0;
  89.     property OuterColor: TColor read FOuterColor write SetOuterColor default clBtnFace;
  90.     property Visible: Boolean read FVisible write SetVisible default True;
  91.   end;
  92.   TVrPalette = class(TVrPersistent)
  93.   private
  94.     FLow: TColor;
  95.     FHigh: TColor;
  96.     procedure SetLow(Value: TColor);
  97.     procedure SetHigh(Value: TColor);
  98.     function GetColors(Index: Integer): TColor; virtual;
  99.   public
  100.     constructor Create;
  101.     procedure Assign(Source: TPersistent); override;
  102.     procedure ToBMP(Bitmap: TBitmap; DarkColor, LightColor: TColor);
  103.     property Colors[Index: Integer]: TColor read GetColors; default;
  104.   published
  105.     property Low: TColor read FLow write SetLow;
  106.     property High: TColor read FHigh write SetHigh;
  107.   end;
  108.   TVrMinMax = class(TVrPersistent)
  109.   private
  110.     FMinValue: Integer;
  111.     FMaxValue: Integer;
  112.     FPosition: Integer;
  113.     procedure SetMinValue(Value: Integer);
  114.     procedure SetMaxValue(Value: Integer);
  115.     procedure SetPosition(Value: Integer);
  116.   public
  117.     constructor Create;
  118.     procedure Assign(Source: TPersistent); override;
  119.   published
  120.     property MinValue: Integer read FMinValue write SetMinValue;
  121.     property MaxValue: Integer read FMaxValue write SetMaxValue;
  122.     property Position: Integer read FPosition write SetPosition;
  123.   end;
  124.   TVrTextOutline = class(TVrPersistent)
  125.   private
  126.     FColor: TColor;
  127.     FVisible: Boolean;
  128.     procedure SetColor(Value: TColor);
  129.     procedure SetVisible(Value: Boolean);
  130.   public
  131.     constructor Create;
  132.     procedure Assign(Source: TPersistent); override;
  133.   published
  134.     property Color: TColor read FColor write SetColor default clNavy;
  135.     property Visible: Boolean read FVisible write SetVisible default True;
  136.   end;
  137.   TVrBitmaps = class(TVrPersistent)
  138.   private
  139.     FItems: TList;
  140.     function GetCount: Integer;
  141.     function GetBitmap(Index: Integer): TBitmap;
  142.     procedure SetBitmap(Index: Integer; Value: TBitmap);
  143.     procedure ReadData(Stream: TStream);
  144.     procedure WriteData(Stream: TStream);
  145.   protected
  146.     procedure DefineProperties(Filer: TFiler); override;
  147.   public
  148.     constructor Create;
  149.     destructor Destroy; override;
  150.     procedure Clear;
  151.     procedure Assign(Source: TPersistent); override;
  152.     function Add(Value: TBitmap): Integer;
  153.     procedure Delete(Index: Integer);
  154.     procedure Insert(Index: Integer; Value: TBitmap);
  155.     procedure Exchange(Index1, Index2: Integer);
  156.     procedure Move(CurIndex, NewIndex: Integer);
  157.     function IndexOf(Bitmap: TBitmap): Integer;
  158.     procedure LoadFromStream(Stream: TStream); virtual;
  159.     procedure SaveToStream(Stream: TStream); virtual;
  160.     procedure LoadFromFile(const FileName: string); virtual;
  161.     procedure SaveToFile(const FileName: string); virtual;
  162.     property Bitmaps[Index: Integer]: TBitmap read GetBitmap write SetBitmap; default;
  163.     property Count: Integer read GetCount;
  164.   end;
  165.   TVrRect = class(TVrPersistent)
  166.   private
  167.     FLeft: Integer;
  168.     FTop: Integer;
  169.     FWidth: Integer;
  170.     FHeight: Integer;
  171.     function GetBoundsRect: TRect;
  172.     procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
  173.     procedure SetBoundsRect(const Rect: TRect);
  174.     procedure SetLeft(Value: Integer);
  175.     procedure SetTop(Value: Integer);
  176.     procedure SetWidth(Value: Integer);
  177.     procedure SetHeight(Value: Integer);
  178.   public
  179.     constructor Create;
  180.     procedure Assign(Source: TPersistent); override;
  181.     property BoundsRect: TRect read GetBoundsRect write SetBoundsRect;
  182.   published
  183.     property Left: Integer read FLeft write SetLeft default 0;
  184.     property Top: Integer read FTop write SetTop default 0;
  185.     property Width: Integer read FWidth write SetWidth default 0;
  186.     property Height: Integer read FHeight write SetHeight default 0;
  187.   end;
  188.   TVrFont3DStyle = (f3dNone, f3dRaised, f3dSunken, f3dShadow);
  189.   TVrFont3D = class(TVrPersistent)
  190.   private
  191.     FStyle: TVrFont3DStyle;
  192.     FHighlightColor: TColor;
  193.     FShadowColor: TColor;
  194.     FHighlightDepth: Integer;
  195.     FShadowDepth: Integer;
  196.     procedure SetStyle(Value: TVrFont3DStyle);
  197.     procedure SetHighlightColor(Value: TColor);
  198.     procedure SetShadowColor(Value: TColor);
  199.     procedure SetHighlightDepth(Value: Integer);
  200.     procedure SetShadowDepth(Value: Integer);
  201.   public
  202.     constructor Create;
  203.     procedure Assign(Source: TPersistent); override;
  204.     procedure Paint(Canvas: TCanvas; R: TRect;
  205.       const Text: string; Flags: Integer);
  206.   published
  207.     property Style: TVrFont3DStyle read FStyle write SetStyle default f3dNone;
  208.     property HighlightColor: TColor read FHighlightColor write SetHighlightColor default clBtnHighlight;
  209.     property ShadowColor: TColor read FShadowColor write SetShadowColor default clBtnShadow;
  210.     property HighlightDepth: Integer read FHighlightDepth write SetHighlightDepth default 1;
  211.     property ShadowDepth: Integer read FShadowDepth write SetShadowDepth default 1;
  212.   end;
  213.   TVrGlyphs = class(TVrPersistent)
  214.   private
  215.     FBitmap: TBitmap;
  216.     FNumGlyphs: TVrNumGlyphs;
  217.     procedure SetBitmap(Value: TBitmap);
  218.     procedure SetNumGlyphs(Value: TVrNumGlyphs);
  219.   public
  220.     constructor Create;
  221.     destructor Destroy; override;
  222.     procedure Assign(Source: TPersistent); override;
  223.   published
  224.     property Bitmap: TBitmap read FBitmap write SetBitmap;
  225.     property NumGlyphs: TVrNumGlyphs read FNumGlyphs write SetNumGlyphs;
  226.   end;
  227. const
  228.   MaxIntListSize = MaxInt div 16;
  229. type
  230.   PVrIntArray = ^TVrIntArray;
  231.   TVrIntArray = array[0..MaxIntListSize - 1] of Integer;
  232.   TVrIntList = class(TObject)
  233.   private
  234.     FCount: Integer;
  235.     FCapacity: Integer;
  236.     FItems: PVrIntArray;
  237.     procedure SetCapacity(NewCapacity: Integer);
  238.     procedure SetCount(NewCount: Integer);
  239.     procedure Grow;
  240.     function GetCount: Integer;
  241.     function GetItem(Index: Integer): Integer;
  242.   public
  243.     constructor Create;
  244.     destructor Destroy; override;
  245.     procedure Clear;
  246.     function Add(Value: Integer): Integer;
  247.     procedure Delete(Index: Integer);
  248.     property Count: Integer read GetCount;
  249.     property Items[Index: Integer]: Integer read GetItem;
  250.   end;
  251.   TVrCollection = class;
  252.   TVrCollectionItem = class(TObject)
  253.   private
  254.     FCollection: TVrCollection;
  255.     FIndex: Integer;
  256.     procedure SetCollection(Value: TVrCollection);
  257.   protected
  258.     procedure Changed(AllItems: Boolean);
  259.   public
  260.     constructor Create(Collection: TVrCollection); virtual;
  261.     destructor Destroy; override;
  262.     property Collection: TVrCollection read FCollection write SetCollection;
  263.     property Index: Integer read FIndex write FIndex;
  264.   end;
  265.   TVrCollection = class(TObject)
  266.   private
  267.     FItems: TList;
  268.     FUpdateCount: Integer;
  269.     function GetCount: Integer;
  270.     procedure InsertItem(Item: TVrCollectionItem);
  271.     procedure RemoveItem(Item: TVrCollectionItem);
  272.   protected
  273.     procedure Changed;
  274.     function GetItem(Index: Integer): TVrCollectionItem;
  275.     procedure Update(Item: TVrCollectionItem); virtual;
  276.     property UpdateCount: Integer read FUpdateCount;
  277.   public
  278.     constructor Create;
  279.     destructor Destroy; override;
  280.     procedure BeginUpdate; virtual;
  281.     procedure Clear;
  282.     procedure EndUpdate; virtual;
  283.     property Count: Integer read GetCount;
  284.     property Items[Index: Integer]: TVrCollectionItem read GetItem;
  285.   end;
  286. implementation
  287. const
  288.   BitmapsFileId: Integer = $355462;  //Define a unique stream format
  289. { TVrPersistent }
  290. procedure TVrPersistent.Changed;
  291. begin
  292.   if FUpdateCount = 0 then
  293.     if Assigned(FOnChange) then FOnChange(Self);
  294. end;
  295. procedure TVrPersistent.BeginUpdate;
  296. begin
  297.   Inc(FUpdateCount);
  298. end;
  299. procedure TVrPersistent.EndUpdate;
  300. begin
  301.   if FUpdateCount > 0 then Dec(FUpdateCount);
  302.   Changed;
  303. end;
  304. { TVrBevel }
  305. constructor TVrBevel.Create;
  306. begin
  307.   inherited Create;
  308.   FBorderWidth := 0;
  309.   FBorderColor := clBtnFace;
  310.   FInnerShadow := clBtnShadow;
  311.   FInnerHighlight := clBtnHighlight;
  312.   FInnerWidth := 1;
  313.   FInnerStyle := bsLowered;
  314.   FInnerOutline := osNone;
  315.   FInnerSpace := 1;
  316.   FInnerColor := clBtnFace;
  317.   FOuterShadow := clBtnShadow;
  318.   FOuterHighlight := clBtnHighlight;
  319.   FOuterWidth := 1;
  320.   FOuterStyle := bsRaised;
  321.   FOuterOutline := osOuter;
  322.   FOuterSpace := 0;
  323.   FOuterColor := clBtnFace;
  324.   FVisible := True;
  325. end;
  326. procedure TVrBevel.Assign(Source: TPersistent);
  327. begin
  328.   if (Source <> nil) and (Source is TVrBevel) then
  329.   begin
  330.     BeginUpdate;
  331.     try
  332.       BorderWidth := TVrBevel(Source).BorderWidth;
  333.       BorderColor := TVrBevel(Source).BorderColor;
  334.       InnerShadow := TVrBevel(Source).InnerShadow;
  335.       InnerHighlight := TVrBevel(Source).InnerHighlight;
  336.       InnerWidth := TVrBevel(Source).InnerWidth;
  337.       InnerStyle := TVrBevel(Source).InnerStyle;
  338.       InnerOutline := TVrBevel(Source).InnerOutline;
  339.       InnerSpace := TVrBevel(Source).InnerSpace;
  340.       InnerColor := TVrBevel(Source).InnerColor;
  341.       OuterShadow := TVrBevel(Source).OuterShadow;
  342.       OuterHighlight := TVrBevel(Source).OuterHighlight;
  343.       OuterWidth := TVrBevel(Source).OuterWidth;
  344.       OuterStyle := TVrBevel(Source).OuterStyle;
  345.       OuterOutline := TVrBevel(Source).OuterOutline;
  346.       OuterSpace := TVrBevel(Source).OuterSpace;
  347.       OuterColor := TVrBevel(Source).OuterColor;
  348.       Visible := TVrBevel(Source).Visible;
  349.     finally
  350.       EndUpdate;
  351.     end;
  352.   end else inherited Assign(Source);
  353. end;
  354. procedure TVrBevel.SetBorderWidth(Value: TVrBorderWidth);
  355. begin
  356.   if FBorderWidth <> Value then
  357.   begin
  358.     FBorderWidth := Value;
  359.     Changed;
  360.   end;
  361. end;
  362. procedure TVrBevel.SetBorderColor(Value: TColor);
  363. begin
  364.   if FBorderColor <> Value then
  365.   begin
  366.     FBorderColor := Value;
  367.     Changed;
  368.   end;
  369. end;
  370. procedure TVrBevel.SetInnerShadow(Value: TColor);
  371. begin
  372.   if FInnerShadow <> Value then
  373.   begin
  374.     FInnerShadow := Value;
  375.     Changed;
  376.   end;
  377. end;
  378. procedure TVrBevel.SetInnerHighlight(Value: TColor);
  379. begin
  380.   if FInnerHighlight <> Value then
  381.   begin
  382.     FInnerHighlight := Value;
  383.     Changed;
  384.   end;
  385. end;
  386. procedure TVrBevel.SetInnerWidth(Value: TVrBevelWidth);
  387. begin
  388.   if FInnerWidth <> Value then
  389.   begin
  390.     FInnerWidth := Value;
  391.     Changed;
  392.   end;
  393. end;
  394. procedure TVrBevel.SetInnerStyle(Value: TVrBevelStyle);
  395. begin
  396.   if FInnerStyle <> Value then
  397.   begin
  398.     FInnerStyle := Value;
  399.     Changed;
  400.   end;
  401. end;
  402. procedure TVrBevel.SetInnerOutline(Value: TVrBevelOutlineStyle);
  403. begin
  404.   if FInnerOutline <> Value then
  405.   begin
  406.     FInnerOutline := Value;
  407.     Changed;
  408.   end;
  409. end;
  410. procedure TVrBevel.SetInnerSpace(Value: TVrBevelSpace);
  411. begin
  412.   if FInnerSpace <> Value then
  413.   begin
  414.     FInnerSpace := Value;
  415.     Changed;
  416.   end;
  417. end;
  418. procedure TVrBevel.SetInnerColor(Value: TColor);
  419. begin
  420.   if FInnerColor <> Value then
  421.   begin
  422.     FInnerColor := Value;
  423.     Changed;
  424.   end;
  425. end;
  426. procedure TVrBevel.SetOuterShadow(Value: TColor);
  427. begin
  428.   if FOuterShadow <> Value then
  429.   begin
  430.     FOuterShadow := Value;
  431.     Changed;
  432.   end;
  433. end;
  434. procedure TVrBevel.SetOuterHighlight(Value: TColor);
  435. begin
  436.   if FOuterHighlight <> Value then
  437.   begin
  438.     FOuterHighlight := Value;
  439.     Changed;
  440.   end;
  441. end;
  442. procedure TVrBevel.SetOuterWidth(Value: TVrBevelWidth);
  443. begin
  444.   if FOuterWidth <> Value then
  445.   begin
  446.     FOuterWidth := Value;
  447.     Changed;
  448.   end;
  449. end;
  450. procedure TVrBevel.SetOuterStyle(Value: TVrBevelStyle);
  451. begin
  452.   if FOuterStyle <> Value then
  453.   begin
  454.     FOuterStyle := Value;
  455.     Changed;
  456.   end;
  457. end;
  458. procedure TVrBevel.SetOuterOutline(Value: TVrBevelOutlineStyle);
  459. begin
  460.   if FOuterOutline <> Value then
  461.   begin
  462.     FOuterOutline := Value;
  463.     Changed;
  464.   end;
  465. end;
  466. procedure TVrBevel.SetOuterSpace(Value: TVrBevelSpace);
  467. begin
  468.   if FOuterSpace <> Value then
  469.   begin
  470.     FOuterSpace := Value;
  471.     Changed;
  472.   end;
  473. end;
  474. procedure TVrBevel.SetOuterColor(Value: TColor);
  475. begin
  476.   if FOuterColor <> Value then
  477.   begin
  478.     FOuterColor := Value;
  479.     Changed;
  480.   end;
  481. end;
  482. procedure TVrBevel.SetVisible(Value: Boolean);
  483. begin
  484.   if FVisible <> Value then
  485.   begin
  486.     FVisible := Value;
  487.     Changed;
  488.   end;
  489. end;
  490. procedure TVrBevel.GetVisibleArea(var Rect: TRect);
  491. var
  492.   BevelPixels: Integer;
  493. begin
  494.   BevelPixels := 0;
  495.   if Visible then
  496.   begin
  497.     if FBorderWidth <> 0 then Inc(BevelPixels, FBorderWidth);
  498.     if FInnerOutline <> osNone then Inc(BevelPixels);
  499.     if FOuterOutline <> osNone then Inc(BevelPixels);
  500.     Inc(BevelPixels, FInnerSpace);
  501.     Inc(BevelPixels, FOuterSpace);
  502.     if FInnerStyle <> bsNone then Inc(BevelPixels, FInnerWidth);
  503.     if FOuterStyle <> bsNone then Inc(BevelPixels, FOuterWidth);
  504.   end;
  505.   InflateRect(Rect, -BevelPixels, -BevelPixels);
  506. end;
  507. procedure TVrBevel.Paint(Canvas: TCanvas; var Rect: TRect);
  508. var
  509.   TopColor, BottomColor: TColor;
  510.   procedure AdjustColors(BevelStyle: TVrBevelStyle;
  511.     ShadowColor, HighlightColor: TColor);
  512.   begin
  513.     TopColor := HighlightColor;
  514.     if (BevelStyle = bsLowered) then TopColor := ShadowColor;
  515.     BottomColor := ShadowColor;
  516.     if (BevelStyle = bsLowered) then BottomColor := HighlightColor;
  517.   end;
  518. begin
  519.   if Visible then
  520.   begin
  521.     if BorderWidth > 0 then
  522.       DrawFrame3D(Canvas, Rect, BorderColor, BorderColor, BorderWidth);
  523.     if OuterOutline = osOuter then
  524.       DrawFrame3D(Canvas, Rect, clBlack, clBlack, 1);
  525.     if OuterStyle <> bsNone then
  526.     begin
  527.       AdjustColors(OuterStyle, OuterShadow, OuterHighlight);
  528.       DrawFrame3D(Canvas, Rect, TopColor, BottomColor, OuterWidth);
  529.     end;
  530.     if OuterOutline = osInner then
  531.       DrawFrame3D(Canvas, Rect, clBlack, clBlack, 1);
  532.     DrawFrame3D(Canvas, Rect, OuterColor, OuterColor, OuterSpace);
  533.     if InnerOutline = osOuter then
  534.       DrawFrame3D(Canvas, Rect, clBlack, clBlack, 1);
  535.     if InnerStyle <> bsNone then
  536.     begin
  537.       AdjustColors(InnerStyle, InnerShadow, InnerHighlight);
  538.       DrawFrame3D(Canvas, Rect, TopColor, BottomColor, InnerWidth);
  539.     end;
  540.     if InnerOutline = osInner then
  541.       DrawFrame3D(Canvas, Rect, clBlack, clBlack, 1);
  542.     DrawFrame3D(Canvas, Rect, InnerColor, InnerColor, InnerSpace);
  543.   end; //visible
  544. end;
  545. { TVrPalette }
  546. constructor TVrPalette.Create;
  547. begin
  548.   inherited Create;
  549.   FLow := clGreen;
  550.   FHigh := clLime;
  551. end;
  552. procedure TVrPalette.SetLow(Value: TColor);
  553. begin
  554.   if FLow <> Value then
  555.   begin
  556.     FLow := Value;
  557.     Changed;
  558.   end;
  559. end;
  560. procedure TVrPalette.SetHigh(Value: TColor);
  561. begin
  562.   if FHigh <> Value then
  563.   begin
  564.     FHigh := Value;
  565.     Changed;
  566.   end;
  567. end;
  568. procedure TVrPalette.Assign(Source: TPersistent);
  569. begin
  570.   if (Source <> nil) and (Source is TVrPalette) then
  571.   begin
  572.     BeginUpdate;
  573.     try
  574.       Low := TVrPalette(Source).Low;
  575.       High := TVrPalette(Source).High;
  576.     finally
  577.       EndUpdate;
  578.     end;
  579.   end else inherited Assign(Source);
  580. end;
  581. function TVrPalette.GetColors(Index: Integer): TColor;
  582. begin
  583.   Result := FLow;
  584.   if Index > 0 then Result := FHigh;
  585. end;
  586. procedure TVrPalette.ToBMP(Bitmap: TBitmap; DarkColor, LightColor: TColor);
  587. const
  588.   ROP_DSPDxax = $00E20746;
  589. var
  590.   DestDC: HDC;
  591.   DDB, MonoBmp: TBitmap;
  592.   IWidth, IHeight: Integer;
  593.   IRect: TRect;
  594. begin
  595.   IWidth := Bitmap.Width;
  596.   IHeight := Bitmap.Height;
  597.   IRect := Rect(0, 0, IWidth, IHeight);
  598.   MonoBmp := TBitmap.Create;
  599.   DDB := TBitmap.Create;
  600.   try
  601.     DDB.Assign(Bitmap);
  602.     DDB.HandleType := bmDDB;
  603.     with Bitmap.Canvas do
  604.     begin
  605.       MonoBmp.Width := IWidth;
  606.       MonoBmp.Height := IHeight;
  607.       MonoBmp.Monochrome := True;
  608.       { Convert DarkColor to FLow }
  609.       DDB.Canvas.Brush.Color := DarkColor;
  610.       MonoBmp.Canvas.CopyRect(IRect, DDB.Canvas, IRect);
  611.       Brush.Color := FLow;
  612.       DestDC := Bitmap.Canvas.Handle;
  613.       SetTextColor(DestDC, clBlack);
  614.       SetBkColor(DestDC, clWhite);
  615.       BitBlt(DestDC, 0, 0, IWidth, IHeight,
  616.         MonoBmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
  617.       { Convert LightColor to FHigh }
  618.       DDB.Canvas.Brush.Color := LightColor;
  619.       MonoBmp.Canvas.CopyRect(IRect, DDB.Canvas, IRect);
  620.       Brush.Color := FHigh;
  621.       DestDC := Handle;
  622.       SetTextColor(DestDC, clBlack);
  623.       SetBkColor(DestDC, clWhite);
  624.       BitBlt(DestDC, 0, 0, IWidth, IHeight,
  625.         MonoBmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
  626.     end;
  627.   finally
  628.     DDB.Free;
  629.     MonoBmp.Free;
  630.   end;
  631. end;
  632. { TVrMinMax }
  633. constructor TVrMinMax.Create;
  634. begin
  635.   inherited Create;
  636.   FMinValue := 0;
  637.   FMaxValue := 100;
  638.   FPosition := 0;
  639. end;
  640. procedure TVrMinMax.SetMinValue(Value: Integer);
  641. begin
  642.   if (FMinValue <> Value) and (Value < FMaxValue) then
  643.   begin
  644.     FMinValue :=  Value;
  645.     if Position < Value then Position := Value
  646.     else Changed;
  647.   end;
  648. end;
  649. procedure TVrMinMax.SetMaxValue(Value: Integer);
  650. begin
  651.   if (FMaxValue <> Value) and (Value > FMinValue) then
  652.   begin
  653.     FMaxValue := Value;
  654.     if Position > Value then Position := Value
  655.     else Changed;
  656.   end;
  657. end;
  658. procedure TVrMinMax.SetPosition(Value: Integer);
  659. begin
  660.   if Value < FMinValue then Value := FMinValue;
  661.   if Value > FMaxValue then Value := FMaxValue;
  662.   if FPosition <> Value then
  663.   begin
  664.     FPosition := Value;
  665.     Changed;
  666.   end;
  667. end;
  668. procedure TVrMinMax.Assign(Source: TPersistent);
  669. begin
  670.   if Source is TVrMinMax then
  671.   begin
  672.     BeginUpdate;
  673.     try
  674.       MinValue := TVrMinMax(Source).MinValue;
  675.       MaxValue := TVrMinMax(Source).MaxValue;
  676.       Position := TVrMinMax(Source).Position;
  677.     finally
  678.       EndUpdate;
  679.     end;
  680.   end
  681.   else inherited Assign(Source);
  682. end;
  683. { TVrTextOutline }
  684. constructor TVrTextOutline.Create;
  685. begin
  686.   inherited Create;
  687.   FColor := clNavy;
  688.   FVisible := True;
  689. end;
  690. procedure TVrTextOutline.SetColor(Value: TColor);
  691. begin
  692.   if FColor <> Value then
  693.   begin
  694.     FColor :=  Value;
  695.     Changed;
  696.   end;
  697. end;
  698. procedure TVrTextOutline.SetVisible(Value: Boolean);
  699. begin
  700.   if FVisible <> Value then
  701.   begin
  702.     FVisible := Value;
  703.     Changed;
  704.   end;
  705. end;
  706. procedure TVrTextOutline.Assign(Source: TPersistent);
  707. begin
  708.   if Source is TVrTextOutline then
  709.   begin
  710.     BeginUpdate;
  711.     try
  712.       Color := TVrTextOutline(Source).Color;
  713.       Visible := TVrTextOutline(Source).Visible;
  714.     finally
  715.       EndUpdate;
  716.     end;
  717.     Exit;
  718.   end;
  719.   inherited Assign(Source);
  720. end;
  721. { TVrFont3D }
  722. constructor TVrFont3D.Create;
  723. begin
  724.   inherited Create;
  725.   FStyle := f3dNone;
  726.   FHighlightColor := clBtnHighlight;
  727.   FShadowColor := clBtnShadow;
  728.   FHighlightDepth := 1;
  729.   FShadowDepth := 1;
  730. end;
  731. procedure TVrFont3D.Assign(Source: TPersistent);
  732. begin
  733.   if Source is TVrFont3D then
  734.   begin
  735.     BeginUpdate;
  736.     try
  737.       Style := TVrFont3D(Source).Style;
  738.       HighlightColor := TVrFont3D(Source).HighlightColor;
  739.       ShadowColor := TVrFont3D(Source).ShadowColor;
  740.       HighlightDepth := TVrFont3D(Source).HighlightDepth;
  741.       ShadowDepth := TVrFont3D(Source).ShadowDepth;
  742.     finally
  743.       EndUpdate;
  744.     end;
  745.     Exit;
  746.   end;
  747.   inherited Assign(Source);
  748. end;
  749. procedure TVrFont3D.SetStyle(Value: TVrFont3DStyle);
  750. begin
  751.   if FStyle <> Value then
  752.   begin
  753.     FStyle := Value;
  754.     Changed;
  755.   end;
  756. end;
  757. procedure TVrFont3D.SetHighlightColor(Value: TColor);
  758. begin
  759.   if FHighlightColor <> Value then
  760.   begin
  761.     FHighlightColor := Value;
  762.     Changed;
  763.   end;
  764. end;
  765. procedure TVrFont3D.SetShadowColor(Value: TColor);
  766. begin
  767.   if FShadowColor <> Value then
  768.   begin
  769.     FShadowColor := Value;
  770.     Changed;
  771.   end;
  772. end;
  773. procedure TVrFont3D.SetHighlightDepth(Value: Integer);
  774. begin
  775.   if FHighlightDepth <> Value then
  776.   begin
  777.     FHighlightDepth := Value;
  778.     Changed;
  779.   end;
  780. end;
  781. procedure TVrFont3D.SetShadowDepth(Value: Integer);
  782. begin
  783.   if FShadowDepth <> Value then
  784.   begin
  785.     FShadowDepth := Value;
  786.     Changed;
  787.   end;
  788. end;
  789. procedure TVrFont3D.Paint(Canvas: TCanvas; R: TRect; const Text: string; Flags: Integer);
  790. var
  791.   DestRect: TRect;
  792.   OrgColor: TColor;
  793. begin
  794.   with Canvas do
  795.   begin
  796.     OrgColor := Font.Color;
  797.     Brush.Style := bsClear;
  798.     case Style of
  799.       f3dNone: DrawText(Handle, PChar(Text), -1, R, Flags);
  800.       f3dRaised:
  801.         begin
  802.           Font.Color := ShadowColor;
  803.           DestRect := R;
  804.           OffsetRect(DestRect, ShadowDepth, ShadowDepth);
  805.           DrawText(Handle, PChar(Text), -1, DestRect, Flags);
  806.           Font.Color := HighlightColor;
  807.           DestRect := R;
  808.           OffsetRect(DestRect, - HighlightDepth, - HighlightDepth);
  809.           DrawText(Handle, PChar(Text), -1, DestRect, Flags);
  810.           Font.Color := OrgColor;
  811.           DrawText(Handle, PChar(Text), -1, R, Flags);
  812.         end;
  813.       f3dSunken:
  814.         begin
  815.           Font.Color := HighlightColor;
  816.           DestRect := R;
  817.           OffsetRect(DestRect, HighlightDepth, HighlightDepth);
  818.           DrawText(Handle, PChar(Text), -1, DestRect, Flags);
  819.           Font.Color := ShadowColor;
  820.           DestRect := R;
  821.           OffsetRect(DestRect, -ShadowDepth, -ShadowDepth);
  822.           DrawText(Handle, PChar(Text), -1, DestRect, Flags);
  823.           Font.Color := OrgColor;
  824.           DrawText(Handle, PChar(Text), -1, R, Flags);
  825.         end;
  826.       f3dShadow:
  827.         begin
  828.           Font.Color := ShadowColor;
  829.           DestRect := R;
  830.           OffsetRect(DestRect, ShadowDepth, ShadowDepth);
  831.           DrawText(Handle, PChar(Text), -1, DestRect, Flags);
  832.           Font.Color := OrgColor;
  833.           DrawText(Handle, PChar(Text), -1, R, Flags);
  834.         end;
  835.     end; //case
  836.   end;
  837. end;
  838. { TVrGlyphs }
  839. constructor TVrGlyphs.Create;
  840. begin
  841.   inherited Create;
  842.   FBitmap := TBitmap.Create;
  843.   FNumGlyphs := 2;
  844. end;
  845. destructor TVrGlyphs.Destroy;
  846. begin
  847.   FBitmap.Free;
  848.   inherited Destroy;
  849. end;
  850. procedure TVrGlyphs.Assign(Source: TPersistent);
  851. begin
  852.   if Source is TVrGlyphs then
  853.   begin
  854.     BeginUpdate;
  855.     try
  856.       Bitmap := TVrGlyphs(Source).Bitmap;
  857.       NumGlyphs := TVrGlyphs(Source).NumGlyphs;
  858.     finally
  859.       EndUpdate;
  860.     end;
  861.     Exit;
  862.   end;
  863.   inherited Assign(Source);
  864. end;
  865. procedure TVrGlyphs.SetBitmap(Value: TBitmap);
  866. begin
  867.   FBitmap.Assign(Value);
  868.   Changed;
  869. end;
  870. procedure TVrGlyphs.SetNumGlyphs(Value: TVrNumGlyphs);
  871. begin
  872.   if FNumGlyphs <> Value then
  873.   begin
  874.     FNumGlyphs := Value;
  875.     Changed;
  876.   end;
  877. end;
  878. { TVrBitmaps }
  879. constructor TVrBitmaps.Create;
  880. begin
  881.   inherited;
  882.   FItems := TList.Create;
  883. end;
  884. destructor TVrBitmaps.Destroy;
  885. begin
  886.   OnChange := nil;
  887.   if FItems <> nil then Clear;
  888.   FItems.Free;
  889.   inherited Destroy;
  890. end;
  891. procedure TVrBitmaps.Clear;
  892. var
  893.   I: Integer;
  894. begin
  895.   BeginUpdate;
  896.   try
  897.     for I := 0 to Count - 1 do
  898.       TBitmap(FItems[I]).Free;
  899.     FItems.Clear;
  900.   finally
  901.     EndUpdate;
  902.   end;
  903.   Changed;
  904. end;
  905. function TVrBitmaps.Add(Value: TBitmap): Integer;
  906. begin
  907.   Result := FItems.Add(nil);
  908.   FItems[Result] := TBitmap.Create;
  909.   Bitmaps[Result].Assign(Value);
  910.   Changed;
  911. end;
  912. procedure TVrBitmaps.Insert(Index: Integer; Value: TBitmap);
  913. begin
  914.   FItems.Insert(Index, nil);
  915.   FItems[Index] := TBitmap.Create;
  916.   Bitmaps[Index].Assign(Value);
  917.   Changed;
  918. end;
  919. procedure TVrBitmaps.Delete(Index: Integer);
  920. begin
  921.   TBitmap(FItems[Index]).Free;
  922.   FItems.Delete(Index);
  923.   Changed;
  924. end;
  925. procedure TVrBitmaps.Exchange(Index1, Index2: Integer);
  926. begin
  927.   FItems.Exchange(Index1, Index2);
  928.   Changed;
  929. end;
  930. function TVrBitmaps.IndexOf(Bitmap: TBitmap): Integer;
  931. begin
  932.   Result := FItems.IndexOf(Bitmap);
  933. end;
  934. procedure TVrBitmaps.Move(CurIndex, NewIndex: Integer);
  935. begin
  936.   FItems.Move(CurIndex, NewIndex);
  937.   Changed;
  938. end;
  939. function TVrBitmaps.GetCount: Integer;
  940. begin
  941.   Result := FItems.Count;
  942. end;
  943. function TVrBitmaps.GetBitmap(Index: Integer): TBitmap;
  944. begin
  945.   Result := FItems[Index];
  946. end;
  947. procedure TVrBitmaps.SetBitmap(Index: Integer; Value: TBitmap);
  948. begin
  949.   Bitmaps[Index].Assign(Value);
  950.   Changed;
  951. end;
  952. procedure TVrBitmaps.Assign(Source: TPersistent);
  953. var
  954.   I: Integer;
  955. begin
  956.   if Source = nil then Clear
  957.   else if Source is TVrBitmaps then
  958.   begin
  959.     BeginUpdate;
  960.     try
  961.       Clear;
  962.       for I := 0 to TVrBitmaps(Source).Count - 1 do
  963.         Add(TVrBitmaps(Source).Bitmaps[I]);
  964.     finally
  965.       EndUpdate;
  966.     end;
  967.   end;
  968. end;
  969. procedure TVrBitmaps.ReadData(Stream: TStream);
  970. begin
  971.   BeginUpdate;
  972.   try
  973.     Clear;
  974.     LoadFromStream(Stream);
  975.   finally
  976.     EndUpdate;
  977.   end;
  978. end;
  979. procedure TVrBitmaps.WriteData(Stream: TStream);
  980. begin
  981.   BeginUpdate;
  982.   try
  983.     SaveToStream(Stream);
  984.   finally
  985.     EndUpdate;
  986.   end;
  987. end;
  988. procedure TVrBitmaps.DefineProperties(Filer: TFiler);
  989.   function DoWrite: Boolean;
  990.   begin
  991.     Result := Count > 0;
  992.   end;
  993. begin
  994.   Filer.DefineBinaryProperty('Bitmaps', ReadData, WriteData, DoWrite);
  995. end;
  996. procedure TVrBitmaps.LoadFromStream(Stream: TStream);
  997. var
  998.   Bitmap: TBitmap;
  999.   I, Id, Cnt: Integer;
  1000. begin
  1001.   Bitmap := TBitmap.Create;
  1002.   try
  1003.     Stream.Read(Id, Sizeof(Integer));
  1004.     if BitmapsFileId <> Id then
  1005.       raise Exception.Create('Invalid file format');
  1006.     Stream.Read(Cnt, Sizeof(Integer));
  1007.     for I := 0 to Cnt - 1 do
  1008.     begin
  1009.       Bitmap.LoadFromStream(Stream);
  1010.       Add(Bitmap);
  1011.     end;
  1012.   finally
  1013.     Bitmap.Free;
  1014.   end;
  1015. end;
  1016. procedure TVrBitmaps.SaveToStream(Stream: TStream);
  1017. var
  1018.   I, Cnt: Integer;
  1019. begin
  1020.   Stream.Write(BitmapsFileId, Sizeof(Integer));
  1021.   Cnt := Count;
  1022.   Stream.Write(Cnt, Sizeof(Integer));
  1023.   for I := 0 to Count - 1 do
  1024.     TBitmap(Bitmaps[I]).SaveToStream(Stream);
  1025. end;
  1026. procedure TVrBitmaps.LoadFromFile(const FileName: string);
  1027. var
  1028.   Stream: TFileStream;
  1029. begin
  1030.   Stream := TFileStream.Create(FileName, fmOpenRead);
  1031.   try
  1032.     BeginUpdate;
  1033.     try
  1034.       LoadFromStream(Stream);
  1035.     finally
  1036.       EndUpdate;
  1037.     end;
  1038.   finally
  1039.     Stream.Free;
  1040.   end;
  1041. end;
  1042. procedure TVrBitmaps.SaveToFile(const FileName: string);
  1043. var
  1044.   Stream: TFileStream;
  1045. begin
  1046.   Stream := TFileStream.Create(FileName, fmCreate);
  1047.   try
  1048.     SaveToStream(Stream);
  1049.   finally
  1050.     Stream.Free;
  1051.   end;
  1052. end;
  1053. { TVrIntList }
  1054. constructor TVrIntList.Create;
  1055. begin
  1056.   inherited Create;
  1057.   FCount := 0;
  1058.   FCapacity := 0;
  1059. end;
  1060. destructor TVrIntList.Destroy;
  1061. begin
  1062.   Clear;
  1063.   inherited Destroy;
  1064. end;
  1065. procedure TVrIntList.Clear;
  1066. begin
  1067.   SetCount(0);
  1068.   SetCapacity(0);
  1069. end;
  1070. function TVrIntList.GetCount: Integer;
  1071. begin
  1072.   Result := FCount;
  1073. end;
  1074. function TVrIntList.GetItem(Index: Integer): Integer;
  1075. begin
  1076.   Result := FItems[Index];
  1077. end;
  1078. function TVrIntList.Add(Value: Integer): Integer;
  1079. begin
  1080.   Result := FCount;
  1081.   if Result = FCapacity then Grow;
  1082.   FItems^[Result] := Value;
  1083.   Inc(FCount);
  1084. end;
  1085. procedure TVrIntList.Delete(Index: Integer);
  1086. begin
  1087.   if (Index < 0) or (Index >= FCount) then
  1088.     Exception.Create('TVrIntList index out of bounds');
  1089.   Dec(FCount);
  1090.   if Index < FCount then
  1091.     System.Move(FItems^[Index + 1], FItems^[Index],
  1092.     (FCount - Index) * SizeOf(Integer));
  1093. end;
  1094. procedure TVrIntList.Grow;
  1095. var
  1096.   Delta: Integer;
  1097. begin
  1098.   if FCapacity > 64 then Delta := FCapacity div 4 else
  1099.     if FCapacity > 8 then Delta := 16 else
  1100.       Delta := 4;
  1101.   SetCapacity(FCapacity + Delta);
  1102. end;
  1103. procedure TVrIntList.SetCapacity(NewCapacity: Integer);
  1104. begin
  1105.   if (NewCapacity < FCount) or (NewCapacity > MaxIntListSize) then
  1106.     Exception.Create('TVrIntList Capacity overrun');
  1107.   if NewCapacity <> FCapacity then
  1108.   begin
  1109.     ReallocMem(FItems, NewCapacity * SizeOf(Integer));
  1110.     FCapacity := NewCapacity;
  1111.   end;
  1112. end;
  1113. procedure TVrIntList.SetCount(NewCount: Integer);
  1114. begin
  1115.   if (NewCount < 0) or (NewCount > MaxListSize) then
  1116.     Exception.Create('TVrIntList Count overrun');
  1117.   if NewCount > FCapacity then SetCapacity(NewCount);
  1118.   if NewCount > FCount then
  1119.     FillChar(FItems^[FCount], (NewCount - FCount) * SizeOf(Integer), 0);
  1120.   FCount := NewCount;
  1121. end;
  1122. { TVrRect }
  1123. constructor TVrRect.Create;
  1124. begin
  1125.   FLeft := 0;
  1126.   FTop := 0;
  1127.   FWidth := 0;
  1128.   FHeight := 0;
  1129. end;
  1130. procedure TVrRect.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
  1131. begin
  1132.   if (FLeft <> ALeft) or (FTop <> ATop) or
  1133.      (FWidth <> AWidth) or (FHeight <> AHeight) then
  1134.   begin
  1135.     FLeft := ALeft;
  1136.     FTop := ATop;
  1137.     FWidth := AWidth;
  1138.     FHeight := AHeight;
  1139.     Changed;
  1140.   end;
  1141. end;
  1142. procedure TVrRect.Assign(Source: TPersistent);
  1143. begin
  1144.   if (Source <> nil) and (Source is TVrRect) then
  1145.   begin
  1146.     BeginUpdate;
  1147.     try
  1148.       Left := (Source as TVrRect).Left;
  1149.       Top := (Source as TVrRect).Top;
  1150.       Width := (Source as TVrRect).Width;
  1151.       Height := (Source as TVrRect).Height;
  1152.     finally
  1153.       EndUpdate;
  1154.     end;
  1155.   end;
  1156.   inherited Assign(Source);
  1157. end;
  1158. procedure TVrRect.SetLeft(Value: Integer);
  1159. begin
  1160.   SetBounds(Value, FTop, FWidth, FHeight);
  1161. end;
  1162. procedure TVrRect.SetTop(Value: Integer);
  1163. begin
  1164.   SetBounds(FLeft, Value, FWidth, FHeight);
  1165. end;
  1166. procedure TVrRect.SetWidth(Value: Integer);
  1167. begin
  1168.   SetBounds(FLeft, FTop, Value, FHeight);
  1169. end;
  1170. procedure TVrRect.SetHeight(Value: Integer);
  1171. begin
  1172.   SetBounds(FLeft, FTop, FWidth, Value);
  1173. end;
  1174. function TVrRect.GetBoundsRect: TRect;
  1175. begin
  1176.   Result.Left := Left;
  1177.   Result.Top := Top;
  1178.   Result.Right := Left + Width;
  1179.   Result.Bottom := Top + Height;
  1180. end;
  1181. procedure TVrRect.SetBoundsRect(const Rect: TRect);
  1182. begin
  1183.   with Rect do SetBounds(Left, Top, Right - Left, Bottom - Top);
  1184. end;
  1185. { TVrCollectionItem }
  1186. constructor TVrCollectionItem.Create(Collection: TVrCollection);
  1187. begin
  1188.   SetCollection(Collection);
  1189. end;
  1190. destructor TVrCollectionItem.Destroy;
  1191. begin
  1192.   SetCollection(nil);
  1193.   inherited Destroy;
  1194. end;
  1195. procedure TVrCollectionItem.Changed(AllItems: Boolean);
  1196. var
  1197.   Item: TVrCollectionItem;
  1198. begin
  1199.   if (FCollection <> nil) and (FCollection.FUpdateCount = 0) then
  1200.   begin
  1201.     if AllItems then Item := nil
  1202.     else Item := Self;
  1203.     FCollection.Update(Item);
  1204.   end;
  1205. end;
  1206. procedure TVrCollectionItem.SetCollection(Value: TVrCollection);
  1207. begin
  1208.   if FCollection <> Value then
  1209.   begin
  1210.     if FCollection <> nil then FCollection.RemoveItem(Self);
  1211.     if Value <> nil then Value.InsertItem(Self);
  1212.   end;
  1213. end;
  1214. { TVrCollection }
  1215. constructor TVrCollection.Create;
  1216. begin
  1217.   FItems := TList.Create;
  1218. end;
  1219. destructor TVrCollection.Destroy;
  1220. begin
  1221.   FUpdateCount := 1;
  1222.   if FItems <> nil then Clear;
  1223.   FItems.Free;
  1224.   inherited Destroy;
  1225. end;
  1226. procedure TVrCollection.BeginUpdate;
  1227. begin
  1228.   Inc(FUpdateCount);
  1229. end;
  1230. procedure TVrCollection.Changed;
  1231. begin
  1232.   if FUpdateCount = 0 then Update(nil);
  1233. end;
  1234. procedure TVrCollection.Clear;
  1235. begin
  1236.   if FItems.Count > 0 then
  1237.   begin
  1238.     BeginUpdate;
  1239.     try
  1240.       while FItems.Count > 0 do TCollectionItem(FItems.Last).Free;
  1241.     finally
  1242.       EndUpdate;
  1243.     end;
  1244.   end;
  1245. end;
  1246. procedure TVrCollection.EndUpdate;
  1247. begin
  1248.   Dec(FUpdateCount);
  1249.   Changed;
  1250. end;
  1251. procedure TVrCollection.RemoveItem(Item: TVrCollectionItem);
  1252. begin
  1253.   FItems.Remove(Item);
  1254.   Item.FCollection := nil;
  1255. end;
  1256. procedure TVrCollection.InsertItem(Item: TVrCollectionItem);
  1257. begin
  1258.   Item.Index := FItems.Add(Item);
  1259.   Item.FCollection := Self;
  1260. end;
  1261. function TVrCollection.GetCount: Integer;
  1262. begin
  1263.   Result := FItems.Count;
  1264. end;
  1265. function TVrCollection.GetItem(Index: Integer): TVrCollectionItem;
  1266. begin
  1267.   Result := FItems[Index];
  1268. end;
  1269. procedure TVrCollection.Update(Item: TVrCollectionItem);
  1270. begin
  1271. end;
  1272. end.