From: Peter T. <pe...@us...> - 2003-10-22 14:41:07
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1:/tmp/cvs-serv13467/JVCL3/run Modified Files: JvWizard.pas Log Message: - Added EnableButtons method Index: JvWizard.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvWizard.pas,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JvWizard.pas 27 Sep 2003 03:42:11 -0000 1.3 --- JvWizard.pas 22 Oct 2003 13:52:23 -0000 1.4 *************** *** 334,342 **** {$I JVCL.INC} ! uses Windows, {$IFDEF COMPILER6_UP}Types,{$ENDIF} Classes, Messages, SysUtils, ! Controls, Forms, Graphics, Buttons, ImgList, JvWizardCommon{$IFDEF USEJVCL},JvComponent{$ENDIF}; type ! TJvWizardAboutInfoForm = (JvWizardAbout); // Added by <Steve Forbes> TJvWizardAlign = alTop..alRight; TJvWizardLeftRight = alLeft..alRight; --- 334,342 ---- {$I JVCL.INC} ! uses Windows, {$IFDEF COMPILER6_UP}Types, {$ENDIF}Classes, Messages, SysUtils, ! Controls, Forms, Graphics, Buttons, ImgList, JvWizardCommon{$IFDEF USEJVCL}, JvComponent{$ENDIF}; type ! TJvWizardAboutInfoForm = (JvWizardAbout); // Added by <Steve Forbes> TJvWizardAlign = alTop..alRight; TJvWizardLeftRight = alLeft..alRight; *************** *** 677,680 **** --- 677,681 ---- constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure EnableButton(AButton: TJvWizardButtonKind; AEnabled: boolean); virtual; property Wizard: TJvWizard read FWizard write SetWizard; property PageIndex: Integer *************** *** 682,687 **** published property Header: TJvWizardPageHeader read FHeader write FHeader; ! property Subtitle:TJvWizardPageTitle read GetSubtitle write SetSubtitle stored false; ! property Title:TJvWizardPageTitle read GetTitle write SetTitle stored false; property Image: TJvWizardImage read FImage write FImage; property Panel: TJvWizardPagePanel read FPanel write FPanel; --- 683,688 ---- published property Header: TJvWizardPageHeader read FHeader write FHeader; ! property Subtitle: TJvWizardPageTitle read GetSubtitle write SetSubtitle stored false; ! property Title: TJvWizardPageTitle read GetTitle write SetTitle stored false; property Image: TJvWizardImage read FImage write FImage; property Panel: TJvWizardPagePanel read FPanel write FPanel; *************** *** 758,766 **** { YW - JvWizard Control } ! {$IFDEF USEJVCL} TJvWizard = class(TCustomControl) ! {$ELSE} TJvWizard = class(TJvCustomControl) ! {$ENDIF} private FPages: TJvWizardPageList; --- 759,767 ---- { YW - JvWizard Control } ! {$IFDEF USEJVCL} TJvWizard = class(TCustomControl) ! {$ELSE} TJvWizard = class(TJvCustomControl) ! {$ENDIF} private FPages: TJvWizardPageList; *************** *** 776,782 **** FHeaderImages: TCustomImageList; FImageChangeLink: TChangeLink; ! {$IFNDEF USEJVCL} ! FAboutInfo: TJvWizardAboutInfoForm; // Add by Steve Forbes ! {$ENDIF} procedure SetShowDivider(Value: Boolean); function GetShowRouteMap: Boolean; --- 777,783 ---- FHeaderImages: TCustomImageList; FImageChangeLink: TChangeLink; ! {$IFNDEF USEJVCL} ! FAboutInfo: TJvWizardAboutInfoForm; // Add by Steve Forbes ! {$ENDIF} procedure SetShowDivider(Value: Boolean); function GetShowRouteMap: Boolean; *************** *** 844,851 **** published property Pages: TJvWizardPageList read FPages; ! {$IFNDEF USEJVCL} ! property About: TJvWizardAboutInfoForm // Add by Steve Forbes read FAboutInfo write FAboutInfo stored False; ! {$ENDIF} property ActivePage: TJvWizardCustomPage read FActivePage write SetActivePage; --- 845,852 ---- published property Pages: TJvWizardPageList read FPages; ! {$IFNDEF USEJVCL} ! property About: TJvWizardAboutInfoForm // Add by Steve Forbes read FAboutInfo write FAboutInfo stored False; ! {$ENDIF} property ActivePage: TJvWizardCustomPage read FActivePage write SetActivePage; *************** *** 878,892 **** property OnSelectPriorPage: TJvWizardSelectPageEvent read FOnSelectPriorPage write FOnSelectPriorPage; ! property OnStartButtonClick: TNotifyEvent// index bkStart read GetStartButtonClick write SetStartButtonClick; ! property OnLastButtonClick: TNotifyEvent// index bkLast read GetLastButtonClick write SetLastButtonClick; ! property OnBackButtonClick: TNotifyEvent// index bkBack read GetBackButtonClick write SetBackButtonClick; ! property OnNextButtonClick: TNotifyEvent// index bkNext read GetNextButtonClick write SetNextButtonClick; ! property OnFinishButtonClick: TNotifyEvent// index bkFinish read GetFinishButtonClick write SetFinishButtonClick; ! property OnCancelButtonClick: TNotifyEvent// index bkCancel read GetCancelButtonClick write SetCancelButtonClick; property Color; --- 879,893 ---- property OnSelectPriorPage: TJvWizardSelectPageEvent read FOnSelectPriorPage write FOnSelectPriorPage; ! property OnStartButtonClick: TNotifyEvent // index bkStart read GetStartButtonClick write SetStartButtonClick; ! property OnLastButtonClick: TNotifyEvent // index bkLast read GetLastButtonClick write SetLastButtonClick; ! property OnBackButtonClick: TNotifyEvent // index bkBack read GetBackButtonClick write SetBackButtonClick; ! property OnNextButtonClick: TNotifyEvent // index bkNext read GetNextButtonClick write SetNextButtonClick; ! property OnFinishButtonClick: TNotifyEvent // index bkFinish read GetFinishButtonClick write SetFinishButtonClick; ! property OnCancelButtonClick: TNotifyEvent // index bkCancel read GetCancelButtonClick write SetCancelButtonClick; property Color; *************** *** 917,921 **** ciButtonPlacement = (ciButtonBarHeight - ciButtonHeight) div 2; - type EJvWizard = class(Exception); --- 918,921 ---- *************** *** 977,986 **** if csDesigning in ComponentState then begin ! {$IFDEF COMPILER6_UP} { !!! YW - Add csClickEvents in order to fired the Click method at design time. It does NOT need at run time, otherwise it cause the OnClick event to be called twice. } ControlStyle := ControlStyle + [csClickEvents]; ! {$ENDIF} ControlStyle := ControlStyle + [csNoDesignVisible]; end; --- 977,986 ---- if csDesigning in ComponentState then begin ! {$IFDEF COMPILER6_UP} { !!! YW - Add csClickEvents in order to fired the Click method at design time. It does NOT need at run time, otherwise it cause the OnClick event to be called twice. } ControlStyle := ControlStyle + [csClickEvents]; ! {$ENDIF} ControlStyle := ControlStyle + [csNoDesignVisible]; end; *************** *** 1648,1652 **** AGraphic := FPicture.Graphic; if Assigned(AGraphic) and ! not ((AGraphic is TMetaFile) or (AGraphic is TIcon)) then begin AGraphic.Transparent := Value; --- 1648,1652 ---- AGraphic := FPicture.Graphic; if Assigned(AGraphic) and ! not ((AGraphic is TMetaFile) or (AGraphic is TIcon)) then begin AGraphic.Transparent := Value; *************** *** 1723,1727 **** FWizardPageHeader := Value; if Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) then begin AdjustFont(FWizardPageHeader.WizardPage.Font); --- 1723,1727 ---- FWizardPageHeader := Value; if Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) then begin AdjustFont(FWizardPageHeader.WizardPage.Font); *************** *** 1772,1776 **** begin if FVisible and Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) then begin ACanvas.Font.Assign(FFont); --- 1772,1776 ---- begin if FVisible and Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) then begin ACanvas.Font.Assign(FFont); *************** *** 1786,1790 **** Brush.Style := bsClear; DrawText(ACanvas.Handle, PChar(FText), -1, ATextRect, ! DT_WORDBREAK + Alignments[FAlignment]); { YW - Draw outline at design time. } if csDesigning in FWizardPageHeader.WizardPage.ComponentState then --- 1786,1790 ---- Brush.Style := bsClear; DrawText(ACanvas.Handle, PChar(FText), -1, ATextRect, ! DT_WORDBREAK + Alignments[FAlignment]); { YW - Draw outline at design time. } if csDesigning in FWizardPageHeader.WizardPage.ComponentState then *************** *** 1832,1836 **** begin if (FFont <> Value) and ! not (Assigned(FWizardPageHeader) and FWizardPageHeader.ParentFont) then begin FFont.Assign(Value); --- 1832,1836 ---- begin if (FFont <> Value) and ! not (Assigned(FWizardPageHeader) and FWizardPageHeader.ParentFont) then begin FFont.Assign(Value); *************** *** 1845,1851 **** DoChange; if Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) and ! Assigned(FWizardPageHeader.WizardPage.Wizard) and ! Assigned(FWizardPageHeader.WizardPage.Wizard.FRouteMap) then begin FWizardPageHeader.WizardPage.Wizard.FRouteMap.DoUpdatePage( --- 1845,1851 ---- DoChange; if Assigned(FWizardPageHeader) and ! Assigned(FWizardPageHeader.WizardPage) and ! Assigned(FWizardPageHeader.WizardPage.Wizard) and ! Assigned(FWizardPageHeader.WizardPage.Wizard.FRouteMap) then begin FWizardPageHeader.WizardPage.Wizard.FRouteMap.DoUpdatePage( *************** *** 2191,2195 **** InflateRect(ARect, -FBorderWidth, -FBorderWidth); JvWizardDrawBorderEdges(ACanvas, ARect, fsGroove, beAllEdges); ! if Color <> clNone then // YW - clNone means transparent begin InflateRect(ARect, -2, -2); --- 2191,2195 ---- InflateRect(ARect, -FBorderWidth, -FBorderWidth); JvWizardDrawBorderEdges(ACanvas, ARect, fsGroove, beAllEdges); ! if Color <> clNone then // YW - clNone means transparent begin InflateRect(ARect, -2, -2); *************** *** 2265,2268 **** --- 2265,2283 ---- end; + procedure TJvWizardCustomPage.EnableButton(AButton: TJvWizardButtonKind; AEnabled: boolean); // Arioch + var + IsEnabled: boolean; + tmpSet: TJvWizardButtonSet; + begin + tmpSet := [AButton]; + IsEnabled := (tmpSet * EnabledButtons) <> []; + if AEnabled = IsEnabled then System.Exit; + + if AEnabled then + EnabledButtons := EnabledButtons + tmpSet + else + EnabledButtons := EnabledButtons - tmpSet; + end; + procedure TJvWizardCustomPage.CMEnabledChanged(var Message: TMessage); var *************** *** 2277,2281 **** end; if not ((csDesigning in ComponentState) or Enabled) and ! (FWizard.ActivePage = Self) then begin NextPage := FWizard.FindNextPage(PageIndex, 1, --- 2292,2296 ---- end; if not ((csDesigning in ComponentState) or Enabled) and ! (FWizard.ActivePage = Self) then begin NextPage := FWizard.FindNextPage(PageIndex, 1, *************** *** 2389,2393 **** Canvas.Font.Assign(Font); DrawText(Canvas.Handle, PChar(Caption), -1, ARect, ! DT_SINGLELINE + DT_CENTER + DT_VCENTER); end; finally --- 2404,2408 ---- Canvas.Font.Assign(Font); DrawText(Canvas.Handle, PChar(Caption), -1, ARect, ! DT_SINGLELINE + DT_CENTER + DT_VCENTER); end; finally *************** *** 2414,2418 **** begin if Assigned(FOnEnterPage) and Enabled and ! not (csDesigning in ComponentState) then begin FOnEnterPage(Self, FromPage); --- 2429,2433 ---- begin if Assigned(FOnEnterPage) and Enabled and ! not (csDesigning in ComponentState) then begin FOnEnterPage(Self, FromPage); *************** *** 2423,2427 **** begin if Assigned(FOnExitPage) and Enabled and ! not (csDesigning in ComponentState) then begin FOnExitPage(Self, ToPage); --- 2438,2442 ---- begin if Assigned(FOnExitPage) and Enabled and ! not (csDesigning in ComponentState) then begin FOnExitPage(Self, ToPage); *************** *** 2604,2614 **** begin case AKind of ! bkStart: Result := TJvWizardStartButton; ! bkLast: Result := TJvWizardLastButton; ! bkBack: Result := TJvWizardBackButton; ! bkNext: Result := TJvWizardNextButton; bkFinish: Result := TJvWizardFinishButton; bkCancel: Result := TJvWizardCancelButton; ! bkHelp: Result := TJvWizardHelpButton; else Result := TJvWizardButtonControl; --- 2619,2629 ---- begin case AKind of ! bkStart: Result := TJvWizardStartButton; ! bkLast: Result := TJvWizardLastButton; ! bkBack: Result := TJvWizardBackButton; ! bkNext: Result := TJvWizardNextButton; bkFinish: Result := TJvWizardFinishButton; bkCancel: Result := TJvWizardCancelButton; ! bkHelp: Result := TJvWizardHelpButton; else Result := TJvWizardButtonControl; *************** *** 2646,2650 **** Inc(PageIndex, Step); until (PageIndex < 0) or (PageIndex >= FPages.Count) or ! TJvWizardCustomPage(FPages[PageIndex]).Enabled or not CheckDisable; if csDesigning in ComponentState then begin --- 2661,2665 ---- Inc(PageIndex, Step); until (PageIndex < 0) or (PageIndex >= FPages.Count) or ! TJvWizardCustomPage(FPages[PageIndex]).Enabled or not CheckDisable; if csDesigning in ComponentState then begin *************** *** 2655,2659 **** end; if (PageIndex >= 0) and (PageIndex < FPages.Count) and ! (TJvWizardCustomPage(FPages[PageIndex]).Enabled or not CheckDisable) then Result := TJvWizardCustomPage(FPages[PageIndex]); end; --- 2670,2674 ---- end; if (PageIndex >= 0) and (PageIndex < FPages.Count) and ! (TJvWizardCustomPage(FPages[PageIndex]).Enabled or not CheckDisable) then Result := TJvWizardCustomPage(FPages[PageIndex]); end; *************** *** 2740,2744 **** if not (csLoading in ComponentState) and (not Assigned(Page) or ((Page.Wizard = Self) and ! ((csDesigning in ComponentState) or Page.Enabled))) then begin ChangeActivePage(Page); --- 2755,2759 ---- if not (csLoading in ComponentState) and (not Assigned(Page) or ((Page.Wizard = Self) and ! ((csDesigning in ComponentState) or Page.Enabled))) then begin ChangeActivePage(Page); *************** *** 2754,2758 **** ParentForm := GetParentForm(Self); if Assigned(ParentForm) and Assigned(FActivePage) and ! FActivePage.ContainsControl(ParentForm.ActiveControl) then begin ParentForm.ActiveControl := FActivePage; --- 2769,2773 ---- ParentForm := GetParentForm(Self); if Assigned(ParentForm) and Assigned(FActivePage) and ! FActivePage.ContainsControl(ParentForm.ActiveControl) then begin ParentForm.ActiveControl := FActivePage; *************** *** 2804,2808 **** the following if block never gets called. } if Assigned(ParentForm) and Assigned(FActivePage) and ! (ParentForm.ActiveControl = FActivePage) then begin FActivePage.Done; --- 2819,2823 ---- the following if block never gets called. } if Assigned(ParentForm) and Assigned(FActivePage) and ! (ParentForm.ActiveControl = FActivePage) then begin FActivePage.Done; *************** *** 2826,2830 **** begin NextPage := FindNextPage(Page.PageIndex, 1, not (csDesigning in ComponentState)); ! if NextPage = Page then begin NextPage := nil; --- 2841,2845 ---- begin NextPage := FindNextPage(Page.PageIndex, 1, not (csDesigning in ComponentState)); ! if NextPage = Page then begin NextPage := nil; *************** *** 3146,3150 **** begin if (AControl is TJvWizardCustomPage) and ! (TJvWizardCustomPage(AControl).Wizard = Self) then SetActivePage(TJvWizardCustomPage(AControl)); inherited ShowControl(AControl); --- 3161,3165 ---- begin if (AControl is TJvWizardCustomPage) and ! (TJvWizardCustomPage(AControl).Wizard = Self) then SetActivePage(TJvWizardCustomPage(AControl)); inherited ShowControl(AControl); *************** *** 3160,3167 **** begin if Assigned(FromPage) and Assigned(ToPage) and ! (FromPage.Wizard <> ToPage.Wizard) then raise EJvWizard.Create(rsInvalidWizardPage); Result := not Assigned(FromPage) or (Assigned(ToPage) and ! (FromPage.PageIndex < ToPage.PageIndex)); end; --- 3175,3182 ---- begin if Assigned(FromPage) and Assigned(ToPage) and ! (FromPage.Wizard <> ToPage.Wizard) then raise EJvWizard.Create(rsInvalidWizardPage); Result := not Assigned(FromPage) or (Assigned(ToPage) and ! (FromPage.PageIndex < ToPage.PageIndex)); end; *************** *** 3227,3228 **** --- 3242,3244 ---- end. + |