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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
{
fpGUI - Free Pascal GUI Library
fpGFX - Main unit for the core drawing engine of fpGUI
Copyright (C) 2000 - 2006 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
unit fpgfx;
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
interface
uses
Classes, SysUtils,
gfxinterface, gfxbase;
type
{ TFFont }
TFFont = class(TDefFont)
end;
{ TFCanvas }
TFCanvas = class(TDefCanvas)
end;
{ TFBitmap }
TFBitmap = class(TDefBitmap)
end;
{ TFScreen }
TFScreen = class(TDefScreen)
end;
{ TFWindow }
TFWindow = class(TDefWindow)
end;
{ TFApplication }
TFApplication = class(TDefApplication)
private
FDisplayName: String;
protected
FTitle: String;
procedure SetTitle(const ATitle: String);
public
constructor Create; override;
destructor Destroy; override;
// procedure CreateForm(InstanceClass: TComponentClass; var Reference);
property Title: String read FTitle write SetTitle;
end;
{ Using the singleton pattern to hide instance variables and
only instantiate them when they are referred to for the first time. }
function GFScreen: TFScreen;
function GFApplication: TFApplication;
implementation
var
uScreen: TFScreen;
uApplication: TFApplication;
function GFScreen: TFScreen;
begin
if uScreen = nil then
uScreen := TFScreen.Create;
result := uScreen;
end;
function GFApplication: TFApplication;
begin
if uApplication = nil then
uApplication := TFApplication.Create;
result := uApplication;
end;
{ TFApplication }
constructor TFApplication.Create;
begin
inherited Create;
end;
destructor TFApplication.Destroy;
begin
inherited Destroy;
end;
{procedure TFApplication.CreateForm(AForm: TCustomForm);
var
form: PForm;
Filename: String;
TextStream, BinStream: TStream;
begin
form := @Reference;
form^ := TCustomForm(InstanceClass.Create(Self));
Filename := LowerCase(Copy(InstanceClass.ClassName, 2, 255)) + '.frm';
TextStream := TFileStream.Create(Filename, fmOpenRead);
BinStream := TMemoryStream.Create;
ObjectTextToBinary(TextStream, BinStream);
TextStream.Free;
BinStream.Position := 0;
BinStream.ReadComponent(Form^);
BinStream.Free;
Form^.Show;
end;}
procedure TFApplication.SetTitle(const ATitle: String);
begin
if ATitle <> FTitle then FTitle := ATitle;
end;
{*******************************************************************
* Initialization section
*
* DESCRIPTION: Upon startup FApplication and FScreen objects are created
* and memory for them allocated.
*
*******************************************************************}
initialization
uScreen := nil;
uApplication := nil;
{*******************************************************************
* Finalization section
*
* DESCRIPTION: Free memory allocated on the initialization section
*
*******************************************************************}
finalization
uApplication.Free;
uScreen.Free;
end.
|