home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / CHEMPLOT.ZIP / Misc / Splshdlg.pas < prev    next >
Pascal/Delphi Source File  |  2001-05-02  |  5KB  |  172 lines

  1. unit Splshdlg;
  2.  
  3. {-----------------------------------------------------------------------------
  4. The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  5.  
  6. http://www.mozilla.org/MPL/MPL-1.1.html
  7.  
  8. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License.
  9.  
  10. The Original Code is: SplashDlg.pas, released 12 September 2000.
  11.  
  12. The Initial Developer of the Original Code is Mat Ballard.
  13. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  14. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  15. All Rights Reserved.
  16.  
  17. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  18.  
  19. Last Modified: 05/25/2000
  20. Current Version: 2.00
  21.  
  22. You may retrieve the latest version of this file from:
  23.  
  24.         http://Chemware.hypermart.net/
  25.  
  26. This work was created with the Project JEDI VCL guidelines:
  27.  
  28.         http://www.delphi-jedi.org/Jedi:VCLVCL
  29.  
  30. in mind. 
  31.  
  32.  
  33. Purpose:
  34. This file contains a component wrapper for the SplashBox form.
  35. A component wrapper presents a form as a Delphi Component,
  36. which can be added to the component palette.
  37.  
  38.  
  39. Known Issues:
  40. -----------------------------------------------------------------------------}
  41.  
  42. interface
  43.  
  44. uses
  45.   Classes, SysUtils,
  46. {$IFDEF WINDOWS}
  47.   WinTypes, WinProcs,
  48.   Forms,
  49. {$ENDIF}
  50. {$IFDEF WIN32}
  51.   Windows,
  52.   Forms,
  53. {$ENDIF}
  54. {$IFDEF LINUX}
  55.   QT,
  56.   QForms,
  57. {$ENDIF}
  58.   Splash;
  59.  
  60. const
  61.   TSPLASH_VERSION = 100;
  62.  
  63. type
  64.   TSplashDlg = class(TComponent)
  65.   private
  66.     FCaption: String;
  67.     FComments: String;
  68.     FHelpContext: Integer;
  69.     FInterval: Integer;
  70. {    FLogo: TPicture;}
  71.     FPrice: String;
  72.     FRegistered: Boolean;
  73.     FURL: String;
  74. {procedures:}
  75.  
  76.   public
  77.     constructor Create(AOwner: TComponent); override;
  78.     {This is the normal constructor. It initializes properties.}
  79.     function Execute: Boolean; virtual;
  80.     {This function creates and runs the SplashBox. It is similar to the Execute
  81.      function of the common dialog boxes.}
  82.     {}
  83.     {Its purpose is to display the SplashBox.}
  84.  
  85.   published
  86.     property Caption: String read FCaption write FCaption;
  87.     {This is the caption of the Splash form.}
  88.     property Comments: String read FComments write FComments;
  89.     {General comments from the file resources, or your input.}
  90.     property HelpContext: Integer read FHelpContext write FHelpContext;
  91.     {This is the appropriate help context for the help file license.}
  92.     property Interval: Integer read FInterval write FInterval;
  93.     {How long to show the splash screen: 0 => indefinite.}
  94. {    property Logo: TPicture read FLogo write FLogo;}
  95.     {This is your product's logo as a picture.}
  96.     property Price: String read FPrice write FPrice;
  97.     {This is the price of your product.}
  98.     property Registered: Boolean read FRegistered write FRegistered;
  99.     {Do we have to demand money ?}
  100.     property URL: String read FURL write FURL;
  101.     {This is the URL of your website. Clicking on it will start your web browser
  102.      and load that URL.}
  103.   end;
  104.  
  105. var
  106.   SplashBox: TSplashBox;
  107.  
  108. implementation
  109.  
  110. {------------------------------------------------------------------------------
  111.     Procedure: TSplashDlg.Create
  112.   Description: standard constructor
  113.        Author: Mat Ballard
  114.  Date created: 04/25/2000
  115. Date modified: 04/25/2000 by Mat Ballard
  116.       Purpose: sets various Properties
  117.  Known Issues:
  118.  ------------------------------------------------------------------------------}
  119. constructor TSplashDlg.Create(AOwner: TComponent);
  120. begin
  121.   inherited Create(AOwner);
  122.   FCaption := 'Wait a minute ...';
  123.   FComments := 'Register for only A$35';
  124.   FInterval := 5000;
  125.   FRegistered := FALSE;
  126.   FURL := 'http://chemware.hypermart.net/';
  127. end;
  128.  
  129. {------------------------------------------------------------------------------
  130.      Function: TSplashDlg.Execute
  131.   Description: runs the Splash dialog box
  132.        Author: Mat Ballard
  133.  Date created: 04/25/2000
  134. Date modified: 04/25/2000 by Mat Ballard
  135.       Purpose: see Description
  136.  Return Value: TRUE or FALSE
  137.  Known Issues:
  138.  ------------------------------------------------------------------------------}
  139. function TSplashDlg.Execute: Boolean;
  140. begin
  141.   SplashBox := TSplashBox.Create(Application);        
  142.   with SplashBox do
  143.   begin
  144.     Caption := FCaption;
  145.     if (Length(FComments) > 0) then
  146.       CommentsLabel.Caption:= FComments;
  147.     HelpContext := FHelpContext;
  148.     PriceLabel.Caption := FPrice;
  149.     URLLabel.Caption := FURL;
  150.     Timer1.Interval := FInterval;
  151. {    LogoImage.Picture.Assign(FLogo);}
  152.     if (FRegistered) then
  153.     begin
  154.       Timer1.Enabled := TRUE;
  155.       LeftImage.Visible := FALSE;
  156.       RightImage.Visible := FALSE;
  157.       CommentsLabel.Visible := FALSE;
  158.       Panel1.Height := CommentsLabel.Top;
  159.     end;
  160.   end;
  161.  
  162.   try
  163.     Result := (SplashBox.ShowModal = 1{mrOk});
  164.   finally
  165. {    SplashBox.LogoImage.Picture.Assign(nil);}
  166.     SplashBox.Free;
  167.   end;
  168. end;
  169.  
  170.  
  171. end.
  172.