MMBMPLST.INT 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Fax.: +49 (0)351-8037944 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 13.04.98 - 18:24:10 $ =}
  24. {========================================================================}
  25. unit MMBmpLst;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. Windows,
  30. Messages,
  31. SysUtils,
  32. Classes,
  33. Controls,
  34. Graphics,
  35. Buttons,
  36. MMObj,
  37. MMUtils,
  38. MMString,
  39. MMObsrv;
  40. const
  41. CM_TRANSCOLORCHANGED = CM_BASE + 250;
  42. type
  43. {$IFNDEF DELPHI3}
  44. TTransparentMode = (tmAuto, tmFixed);
  45. {$ENDIF}
  46. {-- TMMBitmapList ---------------------------------------------------------}
  47. TMMBitmapList = class(TMMComponent)
  48. public
  49. constructor Create(aOwner: TComponent); override;
  50. destructor Destroy; override;
  51. procedure AddObserver(O: TMMObserver);
  52. procedure RemoveObserver(O: TMMObserver);
  53. procedure BeginUpdate;
  54. procedure EndUpdate;
  55. procedure Assign(Source: TPersistent); virtual;
  56. procedure LoadFromStream(Stream: TStream);
  57. procedure SaveToStream(Stream: TStream);
  58. procedure LoadFromFile(const FName: TFileName);
  59. procedure SaveToFile(const FName: TFileName);
  60. procedure AddListFromFile(const FName: TFileName);
  61. function First: TBitmap;
  62. function Last: TBitmap;
  63. procedure Clear;
  64. procedure AddFromFile(const FName: TFileName);
  65. procedure ExtractToFile(index: integer; const FName: TFileName);
  66. function Add(Item: TBitmap): integer;
  67. procedure AddList(List: TMMBitmapList);
  68. procedure Insert(Index: integer; Item: TBitmap);
  69. procedure Move(OldIndex, NewIndex: integer);
  70. procedure Exchange(Index1, Index2: integer);
  71. procedure Delete(index: integer);
  72. function Remove(Item: TBitmap): integer;
  73. function IndexOf(Item: TBitmap): integer;
  74. property Count: integer read GetCount;
  75. property Empty: Boolean read GetEmpty;
  76. property Items[Index: integer]: TBitmap read Get write Put; default;
  77. published
  78. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  79. property OnChanging: TNotifyEvent read FOnChanging write FOnChanging;
  80. end;
  81. {-- TMMCustomBitmapListControl --------------------------------------------}
  82. TMMCustomBitmapListControl = class(TMMGraphicControl)
  83. public
  84. constructor Create(AOwner: TComponent); override;
  85. destructor Destroy; override;
  86. function BitmapValid: Boolean;
  87. property Bitmap: TBitmap read GetBitmap;
  88. property BitmapList: TMMBitmapList read FBitmaps write SetBitmaps;
  89. property BitmapIndex: Integer read FBitmapIndex write SetBitmapIndex default -1;
  90. property TransparentColor: TColor read GetTransparentColor write SetTransparentColor stored TransparentColorStored;
  91. property TransparentMode: TTransparentMode read FTransMode write SetTransparentMode default tmAuto;
  92. end;
  93. TMMGlyphOrientation = (goHorizontal,goVertical);
  94. {-- TMMBitmapListImage ----------------------------------------------------}
  95. TMMBitmapListImage = class(TMMCustomBitmapListControl)
  96. public
  97. constructor Create(AOwner: TComponent); override;
  98. published
  99. property OnClick;
  100. property OnDblClick;
  101. property OnDragDrop;
  102. property OnDragOver;
  103. property OnEndDrag;
  104. property OnMouseDown;
  105. property OnMouseMove;
  106. property OnMouseUp;
  107. property OnStartDrag;
  108. property Align;
  109. property Enabled;
  110. property PopupMenu;
  111. property ShowHint;
  112. property Visible;
  113. property BitmapList;
  114. property BitmapIndex;
  115. property AutoSize: Boolean read FAutoSize write SetAutoSize default False;
  116. property NumGlyphs: integer read FNumGlyphs write SetNumGlyphs default 1;
  117. property GlyphOrientation: TMMGlyphOrientation read FGlyphOrient write SetGlyphOrient default goHorizontal;
  118. property GlyphIndex: integer read FGlyphIndex write SetGlyphIndex default 0;
  119. end;
  120. implementation