home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / CHEMPLOT.ZIP / TPlot / Plotimagelist.pas < prev    next >
Pascal/Delphi Source File  |  2001-07-24  |  3KB  |  114 lines

  1. unit Plotimagelist;
  2.  
  3. {$I Plot.inc}
  4.  
  5. {-----------------------------------------------------------------------------
  6. The contents of this file are subject to the Q Public License
  7. ("QPL"); you may not use this file except in compliance
  8. with the QPL. You may obtain a copy of the QPL from 
  9. the file QPL.html in this distribution, derived from:
  10.  
  11. http://www.trolltech.com/products/download/freelicense/license.html
  12.  
  13. The QPL prohibits development of proprietary software. 
  14. There is a Professional Version of this software available for this. 
  15. Contact sales@chemware.hypermart.net for more information.
  16.  
  17. Software distributed under the QPL is distributed on an "AS IS" basis,
  18. WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the QPL for
  19. the specific language governing rights and limitations under the QPL.
  20.  
  21. The Original Code is: Plot.PAS, released 12 September 2000.
  22.  
  23. The Initial Developer of the Original Code is Mat Ballard.
  24. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  25. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  26. All Rights Reserved.
  27.  
  28. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  29.  
  30. Last Modified: 03/28/2001
  31. Current Version: 2.00
  32.  
  33. You may retrieve the latest version of this file from:
  34.  
  35.         http://Chemware.hypermart.net/
  36.  
  37. This work was created with the Project JEDI VCL guidelines:
  38.  
  39.         http://www.delphi-jedi.org/Jedi:VCLVCL
  40.  
  41. in mind.
  42.  
  43. Known Issues:
  44.         - while TImageList exists from Delphi 2 onwards, TMenu and TPopupMenu
  45.           do not have an Images property until Delphi 4, and so this unit is
  46.           not needed until Delphi 4.
  47.         - currently barfs under Kylix: see below  
  48.  
  49. -----------------------------------------------------------------------------}
  50.  
  51. interface
  52.  
  53. uses
  54.   Classes, SysUtils,
  55. {$IFDEF WINDOWS}
  56.   Controls, Graphics
  57. {$ENDIF}
  58. {$IFDEF WIN32}
  59.   Controls, Graphics
  60. {$ENDIF}
  61. {$IFDEF LINUX}
  62.   QControls, QGraphics, QImgList
  63. {$ENDIF}
  64.   ;
  65.  
  66. const
  67.   TPLOTIMAGELIST_VERSION = 200;
  68.  
  69.   IMAGE_BASE = 5000;
  70.  
  71. {.$ IFDEF FUNCTIONS}
  72.   NO_IMAGES = 58;
  73.  
  74. type
  75.   TPlotImageList = class(TImageList)
  76.   private
  77.     { Private declarations }
  78.   protected
  79.     { Protected declarations }
  80.   public
  81.     Constructor Create(AOwner: TComponent); override;
  82.   published
  83.     { Published declarations }
  84.   end;
  85.  
  86. implementation
  87. {$R Images32.res}
  88.  
  89. Constructor TPlotImageList.Create(AOwner: TComponent); 
  90. var
  91.   i: Integer;
  92.   TheBitmap: TBitmap;
  93. begin
  94.   inherited Create(AOwner);
  95.  
  96.   Height := 16;
  97.   Width := 16;
  98.  
  99. {$IFDEF MSWINDOWS}
  100.   AllocBy := NO_IMAGES + 1;
  101. {$ENDIF}
  102.   TheBitmap := TBitmap.Create;
  103.  
  104.   for i := 1 to NO_IMAGES do
  105.   begin
  106. {This is where it goes "image format not recognized" in Kylix:}
  107.     TheBitmap.LoadFromResourceID(HInstance, IMAGE_BASE + i);
  108.     AddMasked(TheBitmap, clOlive);
  109.   end;
  110.   TheBitmap.Free;
  111. end;
  112.  
  113. end.
  114.