File: spartaapi.pas

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (117 lines) | stat: -rw-r--r-- 3,190 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
 *****************************************************************************
  See the file COPYING.modifiedLGPL.txt, included in this distribution,
  for details about the license.
 *****************************************************************************

  Author: Maciej Izak

  DaThoX 2004-2015
  FreeSparta.com
}

unit SpartaAPI;

{$mode objfpc}{$H+}

interface

uses
  Classes, Controls;

type
  ISTADesignTimeUtil = interface
  ['{E135BF89-AFA9-402A-9663-4F1536C7717A}']
    function GetRoot: TPersistent;
    procedure SetRoot(ARoot: TPersistent);

    property Root: TPersistent read GetRoot write SetRoot;
  end;

  // Sparta Tools API
  ISTAMainDesignTimeUtil = interface(ISTADesignTimeUtil)
  ['{53491607-D285-4050-9064-C764EB8E59B9}']
    function GetShowNonVisualComponents: Boolean;
    property ShowNonVisualComponents: Boolean read GetShowNonVisualComponents;
  end;

  ISTANonVisualComponentsUtil = interface(ISTADesignTimeUtil)
  ['{A181688F-572E-4724-AAF1-575B979A1EC2}']
    function GetShowNonVisualComponents: Boolean;
    property ShowNonVisualComponents: Boolean read GetShowNonVisualComponents;
  end;

  ISTAExtendedDesignTimeUtil = interface(ISTADesignTimeUtil)
  ['{1F484121-2295-4847-BFD9-A77C643EA3A7}']
    // TODO OnShow
    // TODO OnHide
    // TODO UpdateRoot
    // TODO FreeOnStrongHide...? free mem for some utils
    procedure RefreshValues;

    procedure SetParent(AWinCtrl: TWinControl);
    function GetParent: TWinControl;
    procedure SetVisible(AValue: Boolean);
    function GetVisible: Boolean;

    property Visible: Boolean read GetVisible write SetVisible;
    property Parent: TWinControl read GetParent write SetParent;
  end;

  TSTADesignTimeUtil = class

  end;

  TSTADesignTimeUtilClass = class of TSTADesignTimeUtil;

  TEDTU = class
  public
    class function AvailableForRoot(ARoot: TPersistent): Boolean; virtual; abstract;
    class function CreateEDTUForRoot(TheOwner: TComponent; ARoot: TPersistent): ISTAExtendedDesignTimeUtil; virtual; abstract;
    class function GlyphName: string; virtual; abstract;
  end;

  TEDTUClass = class of TEDTU;

  { TSTADesignTimeUtilsManager }

  TSTADesignTimeUtilsManager = class
  protected
    function GetEDTUCount: Integer; virtual;
    function GetEDTU(Index: Integer): TEDTUClass; virtual; abstract;
  public
    function CreateMainDTU({%H-}AParent, {%H-}AAddons: TWinControl): ISTAMainDesignTimeUtil; virtual;
    procedure RegisterEDTU({%H-}AEDTUClass: TEDTUClass); virtual;
    procedure UnregisterEDTU({%H-}AEDTUClass: TEDTUClass); virtual;
    property EDTUCount: Integer read GetEDTUCount;
    property EDTU[Index: Integer]: TEDTUClass read GetEDTU;
  end;

var
  DTUManager: TSTADesignTimeUtilsManager = nil;

implementation

{ TSTADesignTimeUtilsManager }

function TSTADesignTimeUtilsManager.GetEDTUCount: Integer;
begin
  Result := 0;
end;

function TSTADesignTimeUtilsManager.CreateMainDTU(AParent, AAddons: TWinControl
  ): ISTAMainDesignTimeUtil;
begin
  Result := nil;
end;

procedure TSTADesignTimeUtilsManager.RegisterEDTU(AEDTUClass: TEDTUClass);
begin
end;

procedure TSTADesignTimeUtilsManager.UnregisterEDTU(AEDTUClass: TEDTUClass);
begin
end;

end.