From 194923c172167eb3fc33807ec8009b255f86337e Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 8 Oct 2012 09:10:06 +0000 Subject: Plugin is not adapted until someone can compile it and tell others how to do the same git-svn-id: http://svn.miranda-ng.org/main/trunk@1809 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas | 116 +++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas (limited to 'plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas') diff --git a/plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas b/plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas new file mode 100644 index 0000000000..567f049b46 --- /dev/null +++ b/plugins/!NotAdopted/Chess4Net/ConnectingUnit.pas @@ -0,0 +1,116 @@ +//////////////////////////////////////////////////////////////////////////////// +// 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 ConnectingUnit; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, TntStdCtrls, + Forms, {Dialogs, }ExtCtrls, StdCtrls, + DialogUnit, ModalForm; + +type + TConnectingHandler = procedure of object; + + TConnectingForm = class(TModalForm) + AbortButton: TTntButton; + ConnectingLabel: TTntLabel; + ConnectingImage: TImage; + procedure AbortButtonClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure FormShow(Sender: TObject); + procedure FormCreate(Sender: TObject); + private +// dlgOwner: TDialogs; + ConnectingHandler: TConnectingHandler; + shuted: boolean; + procedure FLocalize; + protected + function GetModalID : TModalFormID; override; + public + procedure Shut; + constructor Create(Owner: TForm; h: TConnectingHandler = nil); reintroduce; overload; +// constructor Create(dlgOwner: TDialogs; h: TConnectingHandler); reintroduce; overload; + end; + +implementation + +{$R *.dfm} + +uses + LocalizerUnit; + +//////////////////////////////////////////////////////////////////////////////// +// TConnectiongForm + +procedure TConnectingForm.AbortButtonClick(Sender: TObject); +begin + Close; +end; + + +procedure TConnectingForm.FormShow(Sender: TObject); +var + frmOwner: TForm; +begin + frmOwner := (Owner as TForm); + Left:= frmOwner.Left + (frmOwner.Width - Width) div 2; + Top:= frmOwner.Top + (frmOwner.Height - Height) div 2; +end; + +constructor TConnectingForm.Create(Owner: TForm; h: TConnectingHandler = nil); +begin + self.FormStyle := Owner.FormStyle; + inherited Create(Owner); + shuted := FALSE; + ConnectingHandler := h; +end; + + +procedure TConnectingForm.FormClose(Sender: TObject; + var Action: TCloseAction); +begin + if not shuted then + begin + ModalResult := AbortButton.ModalResult; + if Assigned(ConnectingHandler) then + ConnectingHandler; + end + else + ModalResult := mrNone; +end; + + +procedure TConnectingForm.Shut; +begin + shuted:= TRUE; + Close; +end; + +function TConnectingForm.GetModalID: TModalFormID; +begin + Result := mfConnecting; +end; + + +procedure TConnectingForm.FLocalize; +begin + with TLocalizer.Instance do + begin + Caption := GetLabel(19); + ConnectingLabel.Caption := GetLabel(20); + AbortButton.Caption := GetLabel(21); + end; +end; + + +procedure TConnectingForm.FormCreate(Sender: TObject); +begin + FLocalize; +end; + +end. -- cgit v1.2.3