📄 jvqwizard.pas
字号:
| HeaderWidth, HeaderVisible, ... etc. Instead, I group |
| them together into particular class, and it can make |
| the whole component has a very clean property |
| structure. |
| |
| 01/11/2002 1) Add word break feature when display title and subtitle. |
| 2) At Design time, display page name in the wizard page. |
| 3) Let the TWizardCustomPage paint and fill its area first |
| and let TWizardWelcomePage and TWizardInteriorPage |
| do the rest. |
| |
| 01/10/2002 BETA VERSION RELEASED |
| |
| 1) Delete BackButton, NextButton, FinishButton, |
| CancelButton property, instead of a Button array. |
| 2) Introduce TJvWizardBackButton, TJvWizardNextButton, |
| TJvWizardFinishButton and TJvWizardCancelButton Control |
| 3) Add TJvWizardTitle class, HeaderColor, HeaderHeight, |
| HeaderVisible property for TJvWizardCustomPage. |
| 4) Add WaterMarkColor, WaterMarkWidth, WaterMarkVisible |
| property for TJvWizardWelcomePage. |
| 5) Paint method of TJvWizardWelcomPage improved, |
| TJvWizardInteriorPage, so they can display header |
| as well as title and subtitle. |
| |
| 01/06/2002 1) Add TJvWizardRouteMap, Improve all existing functions |
| and class. |
| 2) Add TJvWizardCustomPage. |
| |
| 01/05/2002 1) Add TJvWizardNavigateButton class. |
| 2) Add BackButton, NextButton, FinishButton, |
| CancelButton property for TJvWizard. |
| |
| 01/04/2002 1) Add ShowDivider property for TJvWizard. |
| 2) Add GetButtonClick, SetButtonClick for TJvWizardButtonBar.|
| 3) Draw divider in fsGroove frame style. |
| |
| 12/30/2001 Initial create. |
+---------------------------------------------------------------------------+
| TODO LIST |
+---------------------------------------------------------------------------+
| Wizard page can be transparent |
+---------------------------------------------------------------------------+}
unit JvQWizard;
{$I jvcl.inc}
interface
uses
SysUtils, Classes,
QWindows, QMessages, QControls, QForms, QGraphics, QButtons, QImgList,
Types,
JvQComponent, JvQThemes,
JvQWizardCommon;
type
TJvWizardButtonKind =
(bkStart, bkLast, bkBack, bkNext, bkFinish, bkCancel, bkHelp);
TJvWizardButtonSet = set of TJvWizardButtonKind;
const
bkAllButtons = [bkStart, bkLast, bkBack, bkFinish, bkNext, bkCancel, bkHelp];
type
TJvWizardAboutInfoForm = (JvWizardAbout); // Added by <Steve Forbes>
TJvWizardAlign = alTop..alRight;
TJvWizardLeftRight = alLeft..alRight;
TJvWizardImage = class; // forward
TJvWizardCustomPage = class;
TJvWizard = class;
TJvWizardButtonControl = class(TBitBtn)
private
FWizard: TJvWizard;
FAlignment: TJvWizardLeftRight;
protected
procedure VisibleChanged; override;
property Wizard: TJvWizard read FWizard write FWizard;
property Alignment: TJvWizardLeftRight read FAlignment write FAlignment;
public
constructor Create(AOwner: TComponent); override;
end;
TJvWizardButtonControlClass = class of TJvWizardButtonControl;
{ YW - The wrapper of the TJvWizardButtonControl }
TJvWizardNavigateButton = class(TPersistent)
private
FControl: TJvWizardButtonControl;
procedure SetCaption(const Value: string);
function GetCaption: string;
function GetGlyph: TBitmap;
procedure SetGlyph(const Value: TBitmap);
function GetNumGlyphs: Integer;
procedure SetNumGlyphs(const Value: Integer);
function GetLayout: TButtonLayout;
procedure SetLayout(const Value: TButtonLayout);
function GetModalResult: TModalResult;
procedure SetModalResult(const Value: TModalResult);
function GetButtonWidth: Integer;
procedure SetButtonWidth(const Value: Integer);
protected
property Control: TJvWizardButtonControl read FControl write FControl;
published
property Glyph: TBitmap read GetGlyph write SetGlyph;
property Caption: string read GetCaption write SetCaption;
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs;
property Layout: TButtonLayout read GetLayout write SetLayout default blGlyphLeft;
property ModalResult: TModalResult read GetModalResult write SetModalResult default mrNone;
property Width: Integer read GetButtonWidth write SetButtonWidth;
end;
TJvWizardRouteMapDisplayEvent = procedure(Sender: TObject;
const Page: TJvWizardCustomPage; var AllowDisplay: Boolean) of object;
{ YW - TJvWizardRouteMap base class }
TJvWizardRouteMapControl = class(TCustomControl)
private
FWizard: TJvWizard;
FAlign: TJvWizardAlign;
FPages: TList;
FPageIndex: Integer;
FImage: TJvWizardImage;
FOnDisplaying: TJvWizardRouteMapDisplayEvent;
function GetPage(Index: Integer): TJvWizardCustomPage;
function GetPageCount: Integer;
procedure SetAlign(Value: TJvWizardAlign);
procedure SetPageIndex(Value: Integer);
procedure SetImage(const Value: TJvWizardImage);
procedure DoAddPage(const APage: TJvWizardCustomPage);
procedure DoDeletePage(const APage: TJvWizardCustomPage);
procedure DoUpdatePage(const APage: TJvWizardCustomPage);
procedure DoActivatePage(const APage: TJvWizardCustomPage);
procedure DoMovePage(const APage: TJvWizardCustomPage; const OldIndex: Integer);
procedure DoImageChange(Sender: TObject);
protected
function HasPicture: Boolean;
procedure SetParent(const ParentA: TWidgetControl); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
function PageAtPos(Pt: TPoint): TJvWizardCustomPage; virtual;
procedure WizardPageAdded(const APage: TJvWizardCustomPage); virtual;
procedure WizardPageDeleted(const APage: TJvWizardCustomPage); virtual;
procedure WizardPageUpdated(const APage: TJvWizardCustomPage); virtual;
procedure WizardPageActivated(const APage: TJvWizardCustomPage); virtual;
procedure WizardPageMoved(const APage: TJvWizardCustomPage;
const OldIndex: Integer); virtual;
function CanDisplay(const APage: TJvWizardCustomPage): Boolean; virtual;
property Wizard: TJvWizard read FWizard write FWizard;
property Align: TJvWizardAlign read FAlign write SetAlign default alLeft;
property Image: TJvWizardImage read FImage write SetImage;
property OnDisplaying: TJvWizardRouteMapDisplayEvent
read FOnDisplaying write FOnDisplaying;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Pages[Index: Integer]: TJvWizardCustomPage read GetPage;
property PageCount: Integer read GetPageCount;
property PageIndex: Integer read FPageIndex write SetPageIndex;
published
property Enabled; //WP.Dec 2004.
property Visible; //WP.Dec 2004.
end;
TJvWizardImage = class(TPersistent)
private
FPicture: TPicture;
FAlignment: TJvWizardImageAlignment;
FLayout: TJvWizardImageLayout;
FOnChange: TNotifyEvent;
FTransparent: Boolean;
procedure SetPicture(Value: TPicture);
procedure SetAlignment(Value: TJvWizardImageAlignment);
procedure SetLayout(Value: TJvWizardImageLayout);
function GetTransparent: Boolean;
procedure SetTransparent(Value: Boolean);
procedure DoChange;
procedure DoPictureChange(Sender: TObject);
public
procedure PaintTo(const ACanvas: TCanvas; ARect: TRect);
constructor Create;
destructor Destroy; override;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
published
property Picture: TPicture read FPicture write SetPicture;
property Alignment: TJvWizardImageAlignment read FAlignment write SetAlignment default iaStretch;
property Layout: TJvWizardImageLayout read FLayout write SetLayout default ilStretch;
property Transparent: Boolean read GetTransparent write SetTransparent default False;
end;
TJvWizardGraphicObject = class(TPersistent)
private
FColor: TColor;
FVisible: Boolean;
procedure SetColor(Value: TColor);
procedure SetVisible(Value: Boolean);
protected
procedure VisibleChanged; virtual;
procedure ColorChanged; virtual;
procedure DoChange; virtual; abstract;
public
constructor Create; virtual;
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); virtual; abstract;
published
property Color: TColor read FColor write SetColor default clBtnFace;
property Visible: Boolean read FVisible write SetVisible default True;
end;
TJvWizardPageHeader = class;
{ YW - Wizard Page Title class }
TJvWizardPageTitle = class(TJvWizardGraphicObject)
private
FWizardPageHeader: TJvWizardPageHeader;
FText: string;
FAlignment: TAlignment;
FAnchorPlacement: Integer;
FAnchors: TAnchors;
FIndent: Integer;
FFont: TFont;
procedure SetText(const Value: string);
procedure SetAlignment(Value: TAlignment);
procedure SetAnchors(Value: TAnchors);
procedure SetAnchorPlacement(Value: Integer);
procedure SetIndent(Value: Integer);
procedure SetFont(Value: TFont);
procedure SetWizardPageHeader(Value: TJvWizardPageHeader);
procedure OnChange(Sender: TObject);
procedure AdjustFont(const AFont: TFont);
protected
{ YW - Get the area where the title text should be painted on. }
function GetTextRect(const ACanvas: TCanvas;
const ARect: TRect): TRect; virtual;
procedure DoChange; override;
property WizardPageHeader: TJvWizardPageHeader
read FWizardPageHeader write SetWizardPageHeader;
public
constructor Create; override;
destructor Destroy; override;
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override;
published
property Text: string read FText write SetText;
property Anchors: TAnchors read FAnchors write SetAnchors default [akLeft, akTop];
property AnchorPlacement: Integer read FAnchorPlacement write SetAnchorPlacement default 4;
property Indent: Integer read FIndent write SetIndent default 0;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
property Font: TFont read FFont write SetFont;
end;
TJvWizardPageObject = class(TJvWizardGraphicObject)
private
FWizardPage: TJvWizardCustomPage;
procedure SetWizardPage(Value: TJvWizardCustomPage);
protected
procedure Initialize; virtual;
procedure DoChange; override;
property WizardPage: TJvWizardCustomPage read FWizardPage write SetWizardPage;
end;
{ YW - Wizard Page Header class }
TJvWizardPageHeader = class(TJvWizardPageObject)
private
FHeight: Integer;
FParentFont: Boolean;
FTitle: TJvWizardPageTitle;
FSubtitle: TJvWizardPageTitle;
FImageIndex: Integer;
FImageOffset: Integer;
FImageAlignment: TJvWizardImageLeftRight;
FShowDivider: Boolean;
procedure SetHeight(Value: Integer);
procedure SetImageIndex(Value: Integer);
procedure SetImageOffset(Value: Integer);
procedure SetImageAlignment(Value: TJvWizardImageLeftRight);
procedure SetParentFont(Value: Boolean);
procedure SetShowDivider(Value: Boolean);
procedure AdjustTitleFont;
protected
procedure VisibleChanged; override;
procedure Initialize; override;
{ YW - the return value of ARect is the area where the title should be
painted on. The result of GetImageRect is the image area. }
function GetImageRect(const AImages: TCustomImageList;
var ARect: TRect): TRect; virtual;
public
constructor Create; override;
destructor Destroy; override;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -