home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / INSTALL / data.z / ANIMIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-05  |  8.8 KB  |  359 lines

  1. unit AnimImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelC_TLB, ComCtrls;
  8.  
  9. type
  10.   TAnimateX = class(TActiveXControl, IAnimateX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TAnimate;
  14.     FEvents: IAnimateXEvents;
  15.     procedure CloseEvent(Sender: TObject);
  16.     procedure OpenEvent(Sender: TObject);
  17.     procedure StartEvent(Sender: TObject);
  18.     procedure StopEvent(Sender: TObject);
  19.   protected
  20.     { Protected declarations }
  21.     procedure InitializeControl; override;
  22.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  23.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  24.     function Get_Active: WordBool; safecall;
  25.     function Get_AutoSize: WordBool; safecall;
  26.     function Get_Center: WordBool; safecall;
  27.     function Get_Color: TColor; safecall;
  28.     function Get_CommonAVI: TxCommonAVI; safecall;
  29.     function Get_Cursor: Smallint; safecall;
  30.     function Get_Enabled: WordBool; safecall;
  31.     function Get_FileName: WideString; safecall;
  32.     function Get_FrameCount: Integer; safecall;
  33.     function Get_FrameHeight: Integer; safecall;
  34.     function Get_FrameWidth: Integer; safecall;
  35.     function Get_Open: WordBool; safecall;
  36.     function Get_ParentColor: WordBool; safecall;
  37.     function Get_Repetitions: Integer; safecall;
  38.     function Get_ResHandle: Integer; safecall;
  39.     function Get_ResId: Integer; safecall;
  40.     function Get_ResName: WideString; safecall;
  41.     function Get_StartFrame: Smallint; safecall;
  42.     function Get_StopFrame: Smallint; safecall;
  43.     function Get_Timers: WordBool; safecall;
  44.     function Get_Transparent: WordBool; safecall;
  45.     function Get_Visible: WordBool; safecall;
  46.     procedure AboutBox; safecall;
  47.     procedure Play(FromFrame, ToFrame: Smallint; Count: Integer); safecall;
  48.     procedure Reset; safecall;
  49.     procedure Seek(Frame: Smallint); safecall;
  50.     procedure Set_Active(Value: WordBool); safecall;
  51.     procedure Set_AutoSize(Value: WordBool); safecall;
  52.     procedure Set_Center(Value: WordBool); safecall;
  53.     procedure Set_Color(Value: TColor); safecall;
  54.     procedure Set_CommonAVI(Value: TxCommonAVI); safecall;
  55.     procedure Set_Cursor(Value: Smallint); safecall;
  56.     procedure Set_Enabled(Value: WordBool); safecall;
  57.     procedure Set_FileName(const Value: WideString); safecall;
  58.     procedure Set_Open(Value: WordBool); safecall;
  59.     procedure Set_ParentColor(Value: WordBool); safecall;
  60.     procedure Set_Repetitions(Value: Integer); safecall;
  61.     procedure Set_ResHandle(Value: Integer); safecall;
  62.     procedure Set_ResId(Value: Integer); safecall;
  63.     procedure Set_ResName(const Value: WideString); safecall;
  64.     procedure Set_StartFrame(Value: Smallint); safecall;
  65.     procedure Set_StopFrame(Value: Smallint); safecall;
  66.     procedure Set_Timers(Value: WordBool); safecall;
  67.     procedure Set_Transparent(Value: WordBool); safecall;
  68.     procedure Set_Visible(Value: WordBool); safecall;
  69.     procedure Stop; safecall;
  70.   end;
  71.  
  72. implementation
  73.  
  74. uses About1;
  75.  
  76. { TAnimateX }
  77.  
  78. procedure TAnimateX.InitializeControl;
  79. begin
  80.   FDelphiControl := Control as TAnimate;
  81.   FDelphiControl.OnClose := CloseEvent;
  82.   FDelphiControl.OnOpen := OpenEvent;
  83.   FDelphiControl.OnStart := StartEvent;
  84.   FDelphiControl.OnStop := StopEvent;
  85. end;
  86.  
  87. procedure TAnimateX.EventSinkChanged(const EventSink: IUnknown);
  88. begin
  89.   FEvents := EventSink as IAnimateXEvents;
  90. end;
  91.  
  92. procedure TAnimateX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  93. begin
  94.   { Define property pages here.  Property pages are defined by calling
  95.     DefinePropertyPage with the class id of the page.  For example,
  96.       DefinePropertyPage(Class_AnimateXPage); }
  97. end;
  98.  
  99. function TAnimateX.Get_Active: WordBool;
  100. begin
  101.   Result := FDelphiControl.Active;
  102. end;
  103.  
  104. function TAnimateX.Get_AutoSize: WordBool;
  105. begin
  106.   Result := FDelphiControl.AutoSize;
  107. end;
  108.  
  109. function TAnimateX.Get_Center: WordBool;
  110. begin
  111.   Result := FDelphiControl.Center;
  112. end;
  113.  
  114. function TAnimateX.Get_Color: TColor;
  115. begin
  116.   Result := FDelphiControl.Color;
  117. end;
  118.  
  119. function TAnimateX.Get_CommonAVI: TxCommonAVI;
  120. begin
  121.   Result := Ord(FDelphiControl.CommonAVI);
  122. end;
  123.  
  124. function TAnimateX.Get_Cursor: Smallint;
  125. begin
  126.   Result := Smallint(FDelphiControl.Cursor);
  127. end;
  128.  
  129. function TAnimateX.Get_Enabled: WordBool;
  130. begin
  131.   Result := FDelphiControl.Enabled;
  132. end;
  133.  
  134. function TAnimateX.Get_FileName: WideString;
  135. begin
  136.   Result := WideString(FDelphiControl.FileName);
  137. end;
  138.  
  139. function TAnimateX.Get_FrameCount: Integer;
  140. begin
  141.   Result := FDelphiControl.FrameCount;
  142. end;
  143.  
  144. function TAnimateX.Get_FrameHeight: Integer;
  145. begin
  146.   Result := FDelphiControl.FrameHeight;
  147. end;
  148.  
  149. function TAnimateX.Get_FrameWidth: Integer;
  150. begin
  151.   Result := FDelphiControl.FrameWidth;
  152. end;
  153.  
  154. function TAnimateX.Get_Open: WordBool;
  155. begin
  156.   Result := FDelphiControl.Open;
  157. end;
  158.  
  159. function TAnimateX.Get_ParentColor: WordBool;
  160. begin
  161.   Result := FDelphiControl.ParentColor;
  162. end;
  163.  
  164. function TAnimateX.Get_Repetitions: Integer;
  165. begin
  166.   Result := FDelphiControl.Repetitions;
  167. end;
  168.  
  169. function TAnimateX.Get_ResHandle: Integer;
  170. begin
  171.   Result := FDelphiControl.ResHandle;
  172. end;
  173.  
  174. function TAnimateX.Get_ResId: Integer;
  175. begin
  176.   Result := FDelphiControl.ResId;
  177. end;
  178.  
  179. function TAnimateX.Get_ResName: WideString;
  180. begin
  181.   Result := WideString(FDelphiControl.ResName);
  182. end;
  183.  
  184. function TAnimateX.Get_StartFrame: Smallint;
  185. begin
  186.   Result := FDelphiControl.StartFrame;
  187. end;
  188.  
  189. function TAnimateX.Get_StopFrame: Smallint;
  190. begin
  191.   Result := FDelphiControl.StopFrame;
  192. end;
  193.  
  194. function TAnimateX.Get_Timers: WordBool;
  195. begin
  196.   Result := FDelphiControl.Timers;
  197. end;
  198.  
  199. function TAnimateX.Get_Transparent: WordBool;
  200. begin
  201.   Result := FDelphiControl.Transparent;
  202. end;
  203.  
  204. function TAnimateX.Get_Visible: WordBool;
  205. begin
  206.   Result := FDelphiControl.Visible;
  207. end;
  208.  
  209. procedure TAnimateX.AboutBox;
  210. begin
  211.   ShowAnimateXAbout;
  212. end;
  213.  
  214. procedure TAnimateX.Play(FromFrame, ToFrame: Smallint; Count: Integer);
  215. begin
  216.  
  217. end;
  218.  
  219. procedure TAnimateX.Reset;
  220. begin
  221.   FDelphiControl.Reset;
  222. end;
  223.  
  224. procedure TAnimateX.Seek(Frame: Smallint);
  225. begin
  226.  
  227. end;
  228.  
  229. procedure TAnimateX.Set_Active(Value: WordBool);
  230. begin
  231.   FDelphiControl.Active := Value;
  232. end;
  233.  
  234. procedure TAnimateX.Set_AutoSize(Value: WordBool);
  235. begin
  236.   FDelphiControl.AutoSize := Value;
  237. end;
  238.  
  239. procedure TAnimateX.Set_Center(Value: WordBool);
  240. begin
  241.   FDelphiControl.Center := Value;
  242. end;
  243.  
  244. procedure TAnimateX.Set_Color(Value: TColor);
  245. begin
  246.   FDelphiControl.Color := Value;
  247. end;
  248.  
  249. procedure TAnimateX.Set_CommonAVI(Value: TxCommonAVI);
  250. begin
  251.   FDelphiControl.CommonAVI := TCommonAVI(Value);
  252. end;
  253.  
  254. procedure TAnimateX.Set_Cursor(Value: Smallint);
  255. begin
  256.   FDelphiControl.Cursor := TCursor(Value);
  257. end;
  258.  
  259. procedure TAnimateX.Set_Enabled(Value: WordBool);
  260. begin
  261.   FDelphiControl.Enabled := Value;
  262. end;
  263.  
  264. procedure TAnimateX.Set_FileName(const Value: WideString);
  265. begin
  266.   FDelphiControl.FileName := String(Value);
  267. end;
  268.  
  269. procedure TAnimateX.Set_Open(Value: WordBool);
  270. begin
  271.   FDelphiControl.Open := Value;
  272. end;
  273.  
  274. procedure TAnimateX.Set_ParentColor(Value: WordBool);
  275. begin
  276.   FDelphiControl.ParentColor := Value;
  277. end;
  278.  
  279. procedure TAnimateX.Set_Repetitions(Value: Integer);
  280. begin
  281.   FDelphiControl.Repetitions := Value;
  282. end;
  283.  
  284. procedure TAnimateX.Set_ResHandle(Value: Integer);
  285. begin
  286.   FDelphiControl.ResHandle := Value;
  287. end;
  288.  
  289. procedure TAnimateX.Set_ResId(Value: Integer);
  290. begin
  291.   FDelphiControl.ResId := Value;
  292. end;
  293.  
  294. procedure TAnimateX.Set_ResName(const Value: WideString);
  295. begin
  296.   FDelphiControl.ResName := String(Value);
  297. end;
  298.  
  299. procedure TAnimateX.Set_StartFrame(Value: Smallint);
  300. begin
  301.   FDelphiControl.StartFrame := Value;
  302. end;
  303.  
  304. procedure TAnimateX.Set_StopFrame(Value: Smallint);
  305. begin
  306.   FDelphiControl.StopFrame := Value;
  307. end;
  308.  
  309. procedure TAnimateX.Set_Timers(Value: WordBool);
  310. begin
  311.   FDelphiControl.Timers := Value;
  312. end;
  313.  
  314. procedure TAnimateX.Set_Transparent(Value: WordBool);
  315. begin
  316.   FDelphiControl.Transparent := Value;
  317. end;
  318.  
  319. procedure TAnimateX.Set_Visible(Value: WordBool);
  320. begin
  321.   FDelphiControl.Visible := Value;
  322. end;
  323.  
  324. procedure TAnimateX.Stop;
  325. begin
  326.   FDelphiControl.Stop;
  327. end;
  328.  
  329. procedure TAnimateX.CloseEvent(Sender: TObject);
  330. begin
  331.   if FEvents <> nil then FEvents.OnClose;
  332. end;
  333.  
  334. procedure TAnimateX.OpenEvent(Sender: TObject);
  335. begin
  336.   if FEvents <> nil then FEvents.OnOpen;
  337. end;
  338.  
  339. procedure TAnimateX.StartEvent(Sender: TObject);
  340. begin
  341.   if FEvents <> nil then FEvents.OnStart;
  342. end;
  343.  
  344. procedure TAnimateX.StopEvent(Sender: TObject);
  345. begin
  346.   if FEvents <> nil then FEvents.OnStop;
  347. end;
  348.  
  349. initialization
  350.   TActiveXControlFactory.Create(
  351.     ComServer,
  352.     TAnimateX,
  353.     TAnimate,
  354.     Class_AnimateX,
  355.     1,
  356.     '{FA7B82DE-9ED7-11D0-AA40-444553540000}',
  357.     0);
  358. end.
  359.