home *** CD-ROM | disk | FTP | other *** search
/ PC Expert 29 / Pce29cd.iso / RUNIMAGE / DELPHI40 / DEMOS / ACTIVEX / DELCTRLS / animateimpl1.pas < prev    next >
Pascal/Delphi Source File  |  1998-06-16  |  12KB  |  444 lines

  1. unit AnimateImpl1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelCtrls_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 DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  22.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  23.     procedure InitializeControl; override;
  24.     function ClassNameIs(const Name: WideString): WordBool; safecall;
  25.     function DrawTextBiDiModeFlags(Flags: Integer): Integer; safecall;
  26.     function DrawTextBiDiModeFlagsReadingOnly: Integer; safecall;
  27.     function Get_Active: WordBool; safecall;
  28.     function Get_AutoSize: WordBool; safecall;
  29.     function Get_BiDiMode: TxBiDiMode; safecall;
  30.     function Get_Center: WordBool; safecall;
  31.     function Get_Color: OLE_COLOR; safecall;
  32.     function Get_CommonAVI: TxCommonAVI; safecall;
  33.     function Get_Cursor: Smallint; safecall;
  34.     function Get_DoubleBuffered: WordBool; safecall;
  35.     function Get_Enabled: WordBool; safecall;
  36.     function Get_FileName: WideString; safecall;
  37.     function Get_FrameCount: Integer; safecall;
  38.     function Get_FrameHeight: Integer; safecall;
  39.     function Get_FrameWidth: Integer; safecall;
  40.     function Get_Open: WordBool; safecall;
  41.     function Get_ParentColor: WordBool; safecall;
  42.     function Get_Repetitions: Integer; safecall;
  43.     function Get_ResHandle: Integer; safecall;
  44.     function Get_ResId: Integer; safecall;
  45.     function Get_ResName: WideString; safecall;
  46.     function Get_StartFrame: Smallint; safecall;
  47.     function Get_StopFrame: Smallint; safecall;
  48.     function Get_Timers: WordBool; safecall;
  49.     function Get_Transparent: WordBool; safecall;
  50.     function Get_Visible: WordBool; safecall;
  51.     function GetControlsAlignment: TxAlignment; safecall;
  52.     function IsRightToLeft: WordBool; safecall;
  53.     function UseRightToLeftAlignment: WordBool; safecall;
  54.     function UseRightToLeftReading: WordBool; safecall;
  55.     function UseRightToLeftScrollBar: WordBool; safecall;
  56.     procedure AboutBox; safecall;
  57.     procedure FlipChildren(AllLevels: WordBool); safecall;
  58.     procedure InitiateAction; safecall;
  59.     procedure Play(FromFrame, ToFrame: Smallint; Count: Integer); safecall;
  60.     procedure Reset; safecall;
  61.     procedure Seek(Frame: Smallint); safecall;
  62.     procedure Set_Active(Value: WordBool); safecall;
  63.     procedure Set_AutoSize(Value: WordBool); safecall;
  64.     procedure Set_BiDiMode(Value: TxBiDiMode); safecall;
  65.     procedure Set_Center(Value: WordBool); safecall;
  66.     procedure Set_Color(Value: OLE_COLOR); safecall;
  67.     procedure Set_CommonAVI(Value: TxCommonAVI); safecall;
  68.     procedure Set_Cursor(Value: Smallint); safecall;
  69.     procedure Set_DoubleBuffered(Value: WordBool); safecall;
  70.     procedure Set_Enabled(Value: WordBool); safecall;
  71.     procedure Set_FileName(const Value: WideString); safecall;
  72.     procedure Set_Open(Value: WordBool); safecall;
  73.     procedure Set_ParentColor(Value: WordBool); safecall;
  74.     procedure Set_Repetitions(Value: Integer); safecall;
  75.     procedure Set_ResHandle(Value: Integer); safecall;
  76.     procedure Set_ResId(Value: Integer); safecall;
  77.     procedure Set_ResName(const Value: WideString); safecall;
  78.     procedure Set_StartFrame(Value: Smallint); safecall;
  79.     procedure Set_StopFrame(Value: Smallint); safecall;
  80.     procedure Set_Timers(Value: WordBool); safecall;
  81.     procedure Set_Transparent(Value: WordBool); safecall;
  82.     procedure Set_Visible(Value: WordBool); safecall;
  83.     procedure Stop; safecall;
  84.   end;
  85.  
  86. implementation
  87.  
  88. uses ComObj, About1;
  89.  
  90. { TAnimateX }
  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. procedure TAnimateX.EventSinkChanged(const EventSink: IUnknown);
  100. begin
  101.   FEvents := EventSink as IAnimateXEvents;
  102. end;
  103.  
  104. procedure TAnimateX.InitializeControl;
  105. begin
  106.   FDelphiControl := Control as TAnimate;
  107.   FDelphiControl.OnClose := CloseEvent;
  108.   FDelphiControl.OnOpen := OpenEvent;
  109.   FDelphiControl.OnStart := StartEvent;
  110.   FDelphiControl.OnStop := StopEvent;
  111. end;
  112.  
  113. function TAnimateX.ClassNameIs(const Name: WideString): WordBool;
  114. begin
  115.   Result := FDelphiControl.ClassNameIs(Name);
  116. end;
  117.  
  118. function TAnimateX.DrawTextBiDiModeFlags(Flags: Integer): Integer;
  119. begin
  120.   Result := FDelphiControl.DrawTextBiDiModeFlags(Flags);
  121. end;
  122.  
  123. function TAnimateX.DrawTextBiDiModeFlagsReadingOnly: Integer;
  124. begin
  125.   Result := FDelphiControl.DrawTextBiDiModeFlagsReadingOnly;
  126. end;
  127.  
  128. function TAnimateX.Get_Active: WordBool;
  129. begin
  130.   Result := FDelphiControl.Active;
  131. end;
  132.  
  133. function TAnimateX.Get_AutoSize: WordBool;
  134. begin
  135.   Result := FDelphiControl.AutoSize;
  136. end;
  137.  
  138. function TAnimateX.Get_BiDiMode: TxBiDiMode;
  139. begin
  140.   Result := Ord(FDelphiControl.BiDiMode);
  141. end;
  142.  
  143. function TAnimateX.Get_Center: WordBool;
  144. begin
  145.   Result := FDelphiControl.Center;
  146. end;
  147.  
  148. function TAnimateX.Get_Color: OLE_COLOR;
  149. begin
  150.   Result := OLE_COLOR(FDelphiControl.Color);
  151. end;
  152.  
  153. function TAnimateX.Get_CommonAVI: TxCommonAVI;
  154. begin
  155.   Result := Ord(FDelphiControl.CommonAVI);
  156. end;
  157.  
  158. function TAnimateX.Get_Cursor: Smallint;
  159. begin
  160.   Result := Smallint(FDelphiControl.Cursor);
  161. end;
  162.  
  163. function TAnimateX.Get_DoubleBuffered: WordBool;
  164. begin
  165.   Result := FDelphiControl.DoubleBuffered;
  166. end;
  167.  
  168. function TAnimateX.Get_Enabled: WordBool;
  169. begin
  170.   Result := FDelphiControl.Enabled;
  171. end;
  172.  
  173. function TAnimateX.Get_FileName: WideString;
  174. begin
  175.   Result := WideString(FDelphiControl.FileName);
  176. end;
  177.  
  178. function TAnimateX.Get_FrameCount: Integer;
  179. begin
  180.   Result := FDelphiControl.FrameCount;
  181. end;
  182.  
  183. function TAnimateX.Get_FrameHeight: Integer;
  184. begin
  185.   Result := FDelphiControl.FrameHeight;
  186. end;
  187.  
  188. function TAnimateX.Get_FrameWidth: Integer;
  189. begin
  190.   Result := FDelphiControl.FrameWidth;
  191. end;
  192.  
  193. function TAnimateX.Get_Open: WordBool;
  194. begin
  195.   Result := FDelphiControl.Open;
  196. end;
  197.  
  198. function TAnimateX.Get_ParentColor: WordBool;
  199. begin
  200.   Result := FDelphiControl.ParentColor;
  201. end;
  202.  
  203. function TAnimateX.Get_Repetitions: Integer;
  204. begin
  205.   Result := FDelphiControl.Repetitions;
  206. end;
  207.  
  208. function TAnimateX.Get_ResHandle: Integer;
  209. begin
  210.   Result := Integer(FDelphiControl.ResHandle);
  211. end;
  212.  
  213. function TAnimateX.Get_ResId: Integer;
  214. begin
  215.   Result := FDelphiControl.ResId;
  216. end;
  217.  
  218. function TAnimateX.Get_ResName: WideString;
  219. begin
  220.   Result := WideString(FDelphiControl.ResName);
  221. end;
  222.  
  223. function TAnimateX.Get_StartFrame: Smallint;
  224. begin
  225.   Result := FDelphiControl.StartFrame;
  226. end;
  227.  
  228. function TAnimateX.Get_StopFrame: Smallint;
  229. begin
  230.   Result := FDelphiControl.StopFrame;
  231. end;
  232.  
  233. function TAnimateX.Get_Timers: WordBool;
  234. begin
  235.   Result := FDelphiControl.Timers;
  236. end;
  237.  
  238. function TAnimateX.Get_Transparent: WordBool;
  239. begin
  240.   Result := FDelphiControl.Transparent;
  241. end;
  242.  
  243. function TAnimateX.Get_Visible: WordBool;
  244. begin
  245.   Result := FDelphiControl.Visible;
  246. end;
  247.  
  248. function TAnimateX.GetControlsAlignment: TxAlignment;
  249. begin
  250.  Result := TxAlignment(FDelphiControl.GetControlsAlignment);
  251. end;
  252.  
  253. function TAnimateX.IsRightToLeft: WordBool;
  254. begin
  255.   Result := FDelphiControl.IsRightToLeft;
  256. end;
  257.  
  258. function TAnimateX.UseRightToLeftAlignment: WordBool;
  259. begin
  260.   Result := FDelphiControl.UseRightToLeftAlignment;
  261. end;
  262.  
  263. function TAnimateX.UseRightToLeftReading: WordBool;
  264. begin
  265.   Result := FDelphiControl.UseRightToLeftReading;
  266. end;
  267.  
  268. function TAnimateX.UseRightToLeftScrollBar: WordBool;
  269. begin
  270.   Result := FDelphiControl.UseRightToLeftScrollBar;
  271. end;
  272.  
  273. procedure TAnimateX.AboutBox;
  274. begin
  275.   ShowAnimateXAbout;
  276. end;
  277.  
  278. procedure TAnimateX.FlipChildren(AllLevels: WordBool);
  279. begin
  280.   FDelphiControl.FlipChildren(AllLevels);
  281. end;
  282.  
  283. procedure TAnimateX.InitiateAction;
  284. begin
  285.   FDelphiControl.InitiateAction;
  286. end;
  287.  
  288. procedure TAnimateX.Play(FromFrame, ToFrame: Smallint; Count: Integer);
  289. begin
  290.   FDelphiControl.Play(FromFrame, ToFrame, Count);
  291. end;
  292.  
  293. procedure TAnimateX.Reset;
  294. begin
  295.   FDelphiControl.Reset;
  296. end;
  297.  
  298. procedure TAnimateX.Seek(Frame: Smallint);
  299. begin
  300.   FDelphiControl.Seek(Frame);
  301. end;
  302.  
  303. procedure TAnimateX.Set_Active(Value: WordBool);
  304. begin
  305.   FDelphiControl.Active := Value;
  306. end;
  307.  
  308. procedure TAnimateX.Set_AutoSize(Value: WordBool);
  309. begin
  310.   FDelphiControl.AutoSize := Value;
  311. end;
  312.  
  313. procedure TAnimateX.Set_BiDiMode(Value: TxBiDiMode);
  314. begin
  315.   FDelphiControl.BiDiMode := TBiDiMode(Value);
  316. end;
  317.  
  318. procedure TAnimateX.Set_Center(Value: WordBool);
  319. begin
  320.   FDelphiControl.Center := Value;
  321. end;
  322.  
  323. procedure TAnimateX.Set_Color(Value: OLE_COLOR);
  324. begin
  325.   FDelphiControl.Color := TColor(Value);
  326. end;
  327.  
  328. procedure TAnimateX.Set_CommonAVI(Value: TxCommonAVI);
  329. begin
  330.   FDelphiControl.CommonAVI := TCommonAVI(Value);
  331. end;
  332.  
  333. procedure TAnimateX.Set_Cursor(Value: Smallint);
  334. begin
  335.   FDelphiControl.Cursor := TCursor(Value);
  336. end;
  337.  
  338. procedure TAnimateX.Set_DoubleBuffered(Value: WordBool);
  339. begin
  340.   FDelphiControl.DoubleBuffered := Value;
  341. end;
  342.  
  343. procedure TAnimateX.Set_Enabled(Value: WordBool);
  344. begin
  345.   FDelphiControl.Enabled := Value;
  346. end;
  347.  
  348. procedure TAnimateX.Set_FileName(const Value: WideString);
  349. begin
  350.   FDelphiControl.FileName := String(Value);
  351. end;
  352.  
  353. procedure TAnimateX.Set_Open(Value: WordBool);
  354. begin
  355.   FDelphiControl.Open := Value;
  356. end;
  357.  
  358. procedure TAnimateX.Set_ParentColor(Value: WordBool);
  359. begin
  360.   FDelphiControl.ParentColor := Value;
  361. end;
  362.  
  363. procedure TAnimateX.Set_Repetitions(Value: Integer);
  364. begin
  365.   FDelphiControl.Repetitions := Value;
  366. end;
  367.  
  368. procedure TAnimateX.Set_ResHandle(Value: Integer);
  369. begin
  370.   FDelphiControl.ResHandle := Cardinal(Value);
  371. end;
  372.  
  373. procedure TAnimateX.Set_ResId(Value: Integer);
  374. begin
  375.   FDelphiControl.ResId := Value;
  376. end;
  377.  
  378. procedure TAnimateX.Set_ResName(const Value: WideString);
  379. begin
  380.   FDelphiControl.ResName := String(Value);
  381. end;
  382.  
  383. procedure TAnimateX.Set_StartFrame(Value: Smallint);
  384. begin
  385.   FDelphiControl.StartFrame := Value;
  386. end;
  387.  
  388. procedure TAnimateX.Set_StopFrame(Value: Smallint);
  389. begin
  390.   FDelphiControl.StopFrame := Value;
  391. end;
  392.  
  393. procedure TAnimateX.Set_Timers(Value: WordBool);
  394. begin
  395.   FDelphiControl.Timers := Value;
  396. end;
  397.  
  398. procedure TAnimateX.Set_Transparent(Value: WordBool);
  399. begin
  400.   FDelphiControl.Transparent := Value;
  401. end;
  402.  
  403. procedure TAnimateX.Set_Visible(Value: WordBool);
  404. begin
  405.   FDelphiControl.Visible := Value;
  406. end;
  407.  
  408. procedure TAnimateX.Stop;
  409. begin
  410.   FDelphiControl.Stop;
  411. end;
  412.  
  413. procedure TAnimateX.CloseEvent(Sender: TObject);
  414. begin
  415.   if FEvents <> nil then FEvents.OnClose;
  416. end;
  417.  
  418. procedure TAnimateX.OpenEvent(Sender: TObject);
  419. begin
  420.   if FEvents <> nil then FEvents.OnOpen;
  421. end;
  422.  
  423. procedure TAnimateX.StartEvent(Sender: TObject);
  424. begin
  425.   if FEvents <> nil then FEvents.OnStart;
  426. end;
  427.  
  428. procedure TAnimateX.StopEvent(Sender: TObject);
  429. begin
  430.   if FEvents <> nil then FEvents.OnStop;
  431. end;
  432.  
  433. initialization
  434.   TActiveXControlFactory.Create(
  435.     ComServer,
  436.     TAnimateX,
  437.     TAnimate,
  438.     Class_AnimateX,
  439.     1,
  440.     '{695CDAD3-02E5-11D2-B20D-00C04FA368D4}',
  441.     0,
  442.     tmApartment);
  443. end.
  444.