?? iemview.pas
字號:
(*
Copyright (c) 1998-2007 by HiComponents. All rights reserved.
This software comes without express or implied warranty.
In no case shall the author be liable for any damage or unwanted behavior of any
computer hardware and/or software.
HiComponents grants you the right to include the compiled component
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE,
BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM.
ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial,
shareware or freeware libraries or components.
email: support@hicomponents.com
http://www.hicomponents.com
*)
unit iemview;
{$R-}
{$Q-}
{$I ie.inc}
{$IFDEF IEINCLUDEMULTIVIEW}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
ExtCtrls, Clipbrd, stdctrls, hyieutils, hyiedefs, ImageEnView, ImageEnProc, ImageEnIO, ieview, iemio, iepresetim, ievect;
type
{!!
<FS>TIEImageSelectEvent
<FM>Declaration<FC>
type TIEImageSelectEvent = procedure(Sender: TObject; idx: integer) of object;
<FM>Description<FN>
This event occurs whenever the user selects or deselect an image
idx is the index of the selected image.
!!}
TIEImageSelectEvent = procedure(Sender: TObject; idx: integer) of object;
{!!
<FS>TIEImageIDRequestEvent
<FM>Declaration<FC>
type TIEImageIDRequestEvent = procedure(Sender: TObject; ID: integer; var Bitmap: TBitmap) of object;
<FM>Description<FN>
ID is the ID you have specified in <A TImageEnMView.ImageID> property;
Bitmap is the bitmap to show. The bitmap is copied in <A TImageEnMView>, and freed when it is no longer necessary.
!!}
TIEImageIDRequestEvent = procedure(Sender: TObject; ID: integer; var Bitmap: TBitmap) of object;
{!!
<FS>TIEImageIDRequestExEvent
<FM>Declaration<FC>
type TIEImageIDRequestExEvent = procedure(Sender: TObject; ID: integer; var Bitmap: <A TIEBitmap>) of object;
<FM>Description<FN>
ID is the ID you have specified in <A TImageEnMView.ImageID> property;
Bitmap is the bitmap to show. The bitmap is copied in <A TImageEnMView>, and freed when it is no longer necessary.
!!}
TIEImageIDRequestExEvent = procedure(Sender: TObject; ID: integer; var Bitmap: TIEBitmap) of object;
{!!
<FS>TIEMProgressEvent
<FM>Declaration<FC>
TIEMProgressEvent = procedure(Sender: TObject; per: integer; idx: integer) of object;
<FM>Description<FN>
This event occurs during PaintTo (idx=index of the image to paint).
<FC>per<FN> is the percentage of the progress (100 indicates paint is finished).
<FC>idx<FN> is the index of the image currently being drawn.
!!}
TIEMProgressEvent = procedure(Sender: TObject; per: integer; idx: integer) of object;
{!!
<FS>TIEWrongImageEvent
<FM>Declaration<FC>
TIEWrongImageEvent = procedure(Sender: TObject; OutBitmap: <A TIEBitmap>; idx: integer; var Handled: boolean) of object;
<FM>Description<FN>
idx specifies the image index.
If you change the OutBitmap, also set Handled to True, otherwise <A TImageEnMView> replaces the bitmap with a question mark image.
!!}
TIEWrongImageEvent = procedure(Sender: TObject; OutBitmap: TIEBitmap; idx: integer; var Handled: boolean) of object;
{!!
<FS>TIEImageDrawEvent
<FM>Declaration<FC>
TIEImageDrawEvent = procedure(Sender: TObject; idx: integer; Left, Top: integer; Canvas: TCanvas) of object;
<FM>Description<FN>
idx is the index of the image to paint (painted when this event is called);
Left is the X coordinate of the left-top side of the thumbnail
Top is the Y coordinate of the left-top side of the thumbnail.
Canvas is the canvas to draw to.
!!}
TIEImageDrawEvent = procedure(Sender: TObject; idx: integer; Left, Top: integer; Canvas: TCanvas) of object;
{!!
<FS>TIEImageDraw2Event
<FM>Declaration<FC>
TIEImageDraw2Event = procedure(Sender: TObject; idx: integer; Left, Top: integer; ImageRect:TRect; Canvas: TCanvas) of object;
<FM>Description<FN>
idx is the index of the image to paint (painted when this event is called);
Left is the X coordinate of the left-top side of the thumbnail
Top is the Y coordinate of the left-top side of the thumbnail.
ImageRect is the actual image rectangle.
Canvas is the canvas to draw to.
!!}
TIEImageDraw2Event = procedure(Sender: TObject; idx: integer; Left, Top: integer; ImageRect:TRect; Canvas: TCanvas) of object;
{!!
<FS>TIEImageDrawEventEx
<FM>Declaration<FC>
}
TIEImageDrawEventEx = procedure(Sender: TObject; idx: integer; Left, Top: integer; Dest: TBitmap; var ThumbRect:TRect) of object;
{!!}
{!!
<FS>TIEImageEnMViewSortCompare
<FM>Declaration<FC>
TIEImageEnMViewSortCompare = function(Item1, Item2: integer): Integer;
<FM>Description<FN>
This is a comparison function that indicates how the items are to be ordered.
The function returns < 0 if Item1 is less and Item2, 0 if they are equal and > 0 if Item1 is greater than Item2.
!!}
TIEImageEnMViewSortCompare = function(Item1, Item2: integer): Integer;
{!!
<FS>TIEStoreType
<FM>Declaration<FC>
type TIEStoreType = (ietNormal, ietThumb);
<FM>Description<FN>
Specifies how load the images.
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>ietNormal</C> <C>The image is stored with SetXXXX methods. A copy of the full bitmap is maintained.</C> </R>
<R> <C>ietThumb</C> <C>The image is stored with SetXXXX methods. A copy of the sub-sampled bitmap is maintained (size is <A TImageEnMView.ThumbWidth> and <A TImageEnMView.ThumbHeight>).</C> </R>
</TABLE>
!!}
TIEStoreType = (
// the image will be full loaded
ietNormal,
// the image will loaded as thumbnail (see ThumbWidth, ThumbHeight))
ietThumb
);
{!!
<FS>TIEMTextPos
<FM>Declaration<FC>
}
TIEMTextPos = (iemtpTop, iemtpBottom, iemtpInfo);
{!!}
{!!
<FS>TIEMTruncSide
<FM>Declaration<FC>
}
TIEMTruncSide = (iemtsLeft, iemtsRight);
{!!}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TIEMText
{!!
<FS>TIEMText
<FM>Description<FN>
TIEMText is an object that specifies how the text will be written inside a thumbnail.
Three <A TImageEnMView> properties contains this object: <A TImageEnMView.ImageTopText>, <A TImageEnMView.ImageBottomText>, <A TImageEnMView.ImageInfoText>.
<FM>Properties<FN>
<A TIEMText.Caption>
<A TIEMText.Font>
<A TIEMText.Background>
<A TIEMText.BackgroundStyle>
<A TIEMText.TruncSide>
!!}
TIEMText = class
private
fCaption: WideString;
fFont: TFont;
fBackground: TColor;
fBackgroundStyle: TBrushStyle;
fOwner: TComponent;
fPos: TIEMTextPos;
fTruncSide: TIEMTruncSide;
procedure SetCaption(value: WideString);
public
constructor Create(Owner: TComponent; Position: TIEMTextPos);
destructor Destroy; override;
{!!
<FS>TIEMText.Caption
<FM>Declaration<FC>
property Caption: WideString;
<FM>Description<FN>
Specifies the text to write.
!!}
property Caption: WideString read fCaption write SetCaption;
{!!
<FS>TIEMText.Font
<FM>Declaration<FC>
property Font: TFont;
<FM>Description<FN>
Font is the text font (and color).
!!}
property Font: TFont read fFont;
{!!
<FS>TIEMText.Background
<FM>Declaration<FC>
property Background: TColor;
<FM>Description<FN>
Background is the background color.
!!}
property Background: TColor read fBackground write fBackground;
{!!
<FS>TIEMText.BackgroundStyle
<FM>Declaration<FC>
property BackgroundStyle:TBrushStyle;
<FM>Description<FN>
BackgroundStyle specifies the text background style.
!!}
property BackgroundStyle:TBrushStyle read fBackgroundStyle write fBackgroundStyle;
{!!
<FS>TIEMText.TruncSide
<FM>Declaration<FC>
property TruncSide:<A TIEMTruncSide>;
<FM>Description<FN>
TruncSide specifies the side to trunc the text when this is too large to be displayed.
!!}
property TruncSide:TIEMTruncSide read fTruncSide write fTruncSide;
end;
// TIEMText
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// this structure contains single image info (except bitmaps)
TIEImageInfo = record
// the parent TImageEnMView object
parent: TObject; // the TImageEnMView parent object
// image contained in fImageList[]
// if image is nil the image is not handled by component
image: pointer;
// image contained in fCacheList[]
// if nil we need to repaint the image
cacheImage: pointer;
// top/left position
X, Y: integer;
// row/col position (calculated by UpdateCoords)
row, col: integer;
// image background color
Background: TColor;
// File name (''=none) to load.
name: pchar;
// Image ID (-1=none).
ID: integer;
// Delay time, display time for this image (in millisecs)
DTime: integer;
// Texts info
TopText: TIEMText;
BottomText: TIEMText;
InfoText: TIEMText;
// last painted internal rect (this the internal image when there is a shadow)
internalrect:TRect;
end;
PIEImageInfo = ^TIEImageInfo;
// automatic interactions with mouse
{!!
<FS>TIEMMouseInteractItems
<FM>Declaration<FC>
}
TIEMMouseInteractItems = (
mmiScroll, // Hand-scroll. Mouse drag scrolls images.
mmiSelect // Images selection. Mouse click select images.
);
{!!}
{!!
<FS>TIEMMouseInteract
<FM>Declaration<FC>
type TIEMMouseInteract = set of <A TIEMMouseInteractItems>;
<FM>Description<FN>
mmiScroll: mouse drag scrolls images.
mmiSelect: mouse click selects images.
!!}
TIEMMouseInteract = set of TIEMMouseInteractItems;
{!!
<FS>TIEMKeyInteractItems
<FM>Declaration<FC>
}
// automatic interaction with keyboard
TIEMKeyInteractItems = (
mkiMoveSelected // move selected item (up,down,left,right)
);
{!!}
{!!
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -