spiegel-keyman/windows/src/developer/setup/TntDialogHelp.pas
Marc Durdin b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00

101 lines
3.2 KiB
ObjectPascal

(*
Name: TntDialogHelp
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 19 Jun 2007
Modified Date: 18 May 2012
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 19 Jun 2007 - mcdurdin - I817 - Translate to Unicode and remove Forms dependence
23 Aug 2007 - mcdurdin - Initial version from Desktop
18 Mar 2011 - mcdurdin - I2776 - Keyman Developer installer has wrong icon and title
18 May 2012 - mcdurdin - I3306 - V9.0 - Remove TntControls + Win9x support
*)
unit TntDialogHelp; // I3306
interface
uses
Windows;
type
TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
mbAll, mbNoToAll, mbYesToAll, mbHelp);
TMsgDlgButtons = set of TMsgDlgBtn;
const
mbYesNo = [mbYes, mbNo];
mbYesNoCancel = [mbYes, mbNo, mbCancel];
mbYesAllNoAllCancel = [mbYes, mbYesToAll, mbNo, mbNoToAll, mbCancel];
mbOKCancel = [mbOK, mbCancel];
mbAbortRetryIgnore = [mbAbort, mbRetry, mbIgnore];
mbAbortIgnore = [mbAbort, mbIgnore];
const
mrNone = 0;
mrOk = idOk;
mrCancel = idCancel;
mrAbort = idAbort;
mrRetry = idRetry;
mrIgnore = idIgnore;
mrYes = idYes;
mrNo = idNo;
mrAll = mrNo + 1;
mrNoToAll = mrAll + 1;
mrYesToAll = mrNoToAll + 1;
type
TModalResult = Low(Integer)..High(Integer);
procedure ShowMessageW(const Message: WideString);
function MessageDlgW(const Msg: WideString; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
implementation
function Tnt_MessageBoxW(hWnd: HWND; lpText, lpCaption: PWideChar; uType: UINT): Integer;
begin
Result := MessageBoxW{TNT-ALLOW MessageBoxW}(hWnd, lpText, lpCaption, uType)
end;
function MessageDlgW(const Msg: WideString; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
const
//mtWarning, mtError, mtInformation, mtConfirmation, mtCustom
MBFlags: array[TMsgDlgType] of Integer = (MB_ICONWARNING, MB_ICONERROR, MB_ICONINFORMATION, MB_ICONQUESTION, 0);
//MBButtons: array[TMsgDlgBtn] of Integer = (MB_YES, MB_NO, MB_OK, MB_CANCEL, MB_ABORT, MB_RETRY, MB_IGNORE,
var
FButtons: Integer;
begin
if Buttons = [mbOk] then FButtons := MB_OK
else if Buttons = [mbOk, mbCancel] then FButtons := MB_OKCANCEL
else if Buttons = [mbYes, mbNo] then FButtons := MB_YESNO
else if Buttons = [mbYes, mbNo, mbCancel] then FButtons := MB_YESNOCANCEL
else if Buttons = [mbAbort, mbRetry, mbIgnore] then FButtons := MB_ABORTRETRYIGNORE
else if Buttons = [mbRetry, mbCancel] then FButtons := MB_RETRYCANCEL
else FButtons := MB_OK;
case Tnt_MessageBoxW(GetActiveWindow, PWideChar(Msg), 'Keyman Developer Setup', MBFlags[DlgType] or FButtons) of // I2776
IDOK: Result := mrOk;
IDCANCEL: Result := mrCancel;
IDYES: Result := mrYes;
IDNO: Result := mrNo;
else Result := mrOk;
end;
end;
procedure ShowMessageW(const Message: WideString);
begin
Tnt_MessageBoxW(GetActiveWindow, PWideChar(Message), 'Keyman Developer Setup', MB_OK); // I2776
end;
end.