home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
DIALOGS.INT
< prev
next >
Wrap
Text File
|
1997-02-28
|
7KB
|
222 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,96 Borland International }
{ }
{*******************************************************}
unit Dialogs;
{$R-}
interface
uses Windows, Messages, SysUtils, CommDlg, Classes, Graphics, Controls,
Forms;
const
{ Maximum number of custom colors in color dialog }
MaxCustomColors = 16;
type
{ TCommonDialog }
TCommonDialog = class(TComponent)
protected
function Message(var Msg: TMessage): Boolean; virtual;
function TaskModalDialog(DialogFunc: Pointer; var DialogData): Bool; virtual;
public
constructor Create(AOwner: TComponent); override;
published
property Ctl3D: Boolean default True;
property HelpContext: THelpContext default 0;
end;
{ TOpenDialog }
TOpenOption = (ofReadOnly, ofOverwritePrompt, ofHideReadOnly,
ofNoChangeDir, ofShowHelp, ofNoValidate, ofAllowMultiSelect,
ofExtensionDifferent, ofPathMustExist, ofFileMustExist, ofCreatePrompt,
ofShareAware, ofNoReadOnlyReturn, ofNoTestFileCreate, ofNoNetworkButton,
ofNoLongNames, ofOldStyleDialog, ofNoDereferenceLinks);
TOpenOptions = set of TOpenOption;
TFileEditStyle = (fsEdit, fsComboBox);
TOpenDialog = class(TCommonDialog)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean; virtual;
property Files: TStrings;
published
property DefaultExt: string;
property FileEditStyle: TFileEditStyle;
property FileName: TFileName;
property Filter: string;
property FilterIndex: Integer default 1;
property HistoryList: TStrings;
property InitialDir: string;
property Options: TOpenOptions default [];
property Title: string;
end;
{ TSaveDialog }
TSaveDialog = class(TOpenDialog)
function Execute: Boolean; override;
end;
{ TColorDialog }
TColorDialogOption = (cdFullOpen, cdPreventFullOpen, cdShowHelp,
cdSolidColor, cdAnyColor);
TColorDialogOptions = set of TColorDialogOption;
TCustomColors = array[0..MaxCustomColors - 1] of Longint;
TColorDialog = class(TCommonDialog)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean;
published
property Color: TColor default clBlack;
property Ctl3D default False;
property CustomColors: TStrings;
property Options: TColorDialogOptions default [];
end;
{ TFontDialog }
TFontDialogOption = (fdAnsiOnly, fdTrueTypeOnly, fdEffects,
fdFixedPitchOnly, fdForceFontExist, fdNoFaceSel, fdNoOEMFonts,
fdNoSimulations, fdNoSizeSel, fdNoStyleSel, fdNoVectorFonts,
fdShowHelp, fdWysiwyg, fdLimitSize, fdScalableOnly, fdApplyButton);
TFontDialogOptions = set of TFontDialogOption;
TFontDialogDevice = (fdScreen, fdPrinter, fdBoth);
TFDApplyEvent = procedure(Sender: TObject; Wnd: HWND) of object;
TFontDialog = class(TCommonDialog)
protected
procedure Apply(Wnd: HWND); dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean;
published
property Font: TFont;
property Device: TFontDialogDevice default fdScreen;
property MinFontSize: Integer;
property MaxFontSize: Integer;
property Options: TFontDialogOptions default [fdEffects];
property OnApply: TFDApplyEvent;
end;
{ TPrinterSetupDialog }
TPrinterSetupDialog = class(TCommonDialog)
public
procedure Execute;
end;
{ TPrintDialog }
TPrintRange = (prAllPages, prSelection, prPageNums);
TPrintDialogOption = (poPrintToFile, poPageNums, poSelection, poWarning,
poHelp, poDisablePrintToFile);
TPrintDialogOptions = set of TPrintDialogOption;
TPrintDialog = class(TCommonDialog)
public
function Execute: Boolean;
published
property Collate: Boolean default False;
property Copies: Integer default 0;
property FromPage: Integer default 0;
property MinPage: Integer default 0;
property MaxPage: Integer default 0;
property Options: TPrintDialogOptions default [];
property PrintToFile: Boolean default False;
property PrintRange: TPrintRange default prAllPages;
property ToPage: Integer default 0;
end;
{ TFindDialog }
TFindOption = (frDown, frFindNext, frHideMatchCase, frHideWholeWord,
frHideUpDown, frMatchCase, frDisableMatchCase, frDisableUpDown,
frDisableWholeWord, frReplace, frReplaceAll, frWholeWord, frShowHelp);
TFindOptions = set of TFindOption;
TFindReplaceFunc = function(var FindReplace: TFindReplace): HWnd stdcall;
TFindDialog = class(TCommonDialog)
protected
function Message(var Msg: TMessage): Boolean; override;
procedure Find; dynamic;
procedure Replace; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure CloseDialog;
function Execute: Boolean;
property Handle: HWnd;
property Left: Integer;
property Position: TPoint;
property Top: Integer;
published
property FindText: string;
property Options: TFindOptions default [frDown];
property OnFind: TNotifyEvent;
end;
{ TReplaceDialog }
TReplaceDialog = class(TFindDialog)
public
constructor Create(AOwner: TComponent); override;
published
property ReplaceText;
property OnReplace;
end;
{ Message dialog }
type
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
mbAll, mbHelp);
TMsgDlgButtons = set of TMsgDlgBtn;
const
mbYesNoCancel = [mbYes, mbNo, mbCancel];
mbOKCancel = [mbOK, mbCancel];
mbAbortRetryIgnore = [mbAbort, mbRetry, mbIgnore];
function CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons): TForm;
function MessageDlg(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
function MessageDlgPos(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Integer;
procedure ShowMessage(const Msg: string);
procedure ShowMessagePos(const Msg: string; X, Y: Integer);
{ Input dialog }
function InputBox(const ACaption, APrompt, ADefault: string): string;
function InputQuery(const ACaption, APrompt: string;
var Value: string): Boolean;
implementation