summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/Chess4Net/DontShowMessageDlgUnit.pas
blob: 357b56c8be24f42245267723e8a46ebcdc479893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
////////////////////////////////////////////////////////////////////////////////
// All code below is exclusively owned by author of Chess4Net - Pavel Perminov
// (packpaul@mail.ru, packpaul1@gmail.com).
// Any changes, modifications, borrowing and adaptation are a subject for
// explicit permition from the owner.

unit DontShowMessageDlgUnit;

interface

uses
  Forms, StdCtrls,
  //
  DialogUnit, ModalForm;

type
  TDontShowMessageDlg = class(TDialogForm)
  private
    m_DontShowCheckBox: TCheckBox;
    function FGetDontShow: boolean;
    procedure FSetDontShow(bValue: boolean);
  protected
    function GetModalID: TModalFormID; override;
  public
    class function Create(const ADialogs: TDialogs; const wstrMsg: WideString): TDontShowMessageDlg; overload;
    constructor Create(Owner: TForm; modHandler: TModalFormHandler = nil); overload; override;
    property DontShow: boolean read FGetDontShow write FSetDontShow;    
  end;

implementation

uses
  Dialogs, Controls;

////////////////////////////////////////////////////////////////////////////////
// TDontShowMessageDlg

var
  g_wstrMsg: WideString;

constructor TDontShowMessageDlg.Create(Owner: TForm; modHandler: TModalFormHandler = nil);
begin
  inherited Create(Owner, g_wstrMsg, mtInformation, [mbOK], GetModalID, modHandler);

  MsgDlg.Height := MsgDlg.Height + 10;

  m_DontShowCheckBox := TCheckBox.Create(MsgDlg);
  m_DontShowCheckBox.Parent := MsgDlg;
  m_DontShowCheckBox.Caption := 'Don''t Show'; // TODO: Localize

  m_DontShowCheckBox.Left := 10;
  m_DontShowCheckBox.Top := MsgDlg.ClientHeight - m_DontShowCheckBox.Height - 5;
end;


class function TDontShowMessageDlg.Create(const ADialogs: TDialogs;
  const wstrMsg: WideString): TDontShowMessageDlg;
begin
  g_wstrMsg := wstrMsg;
  Result := ADialogs.CreateDialog(TDontShowMessageDlg) as TDontShowMessageDlg;
  g_wstrMsg := '';
end;


function TDontShowMessageDlg.FGetDontShow: boolean;
begin
  Result := m_DontShowCheckBox.Checked;
end;


procedure TDontShowMessageDlg.FSetDontShow(bValue: boolean);
begin
  m_DontShowCheckBox.Checked := bValue;
end;


function TDontShowMessageDlg.GetModalID: TModalFormID;
begin
  Result := mfDontShowDlg;
end;

end.