unit uMessageBox;

interface

uses
  Windows, SysUtils, Classes, Graphics, Controls, Forms,
  Buttons, StdCtrls, ComCtrls, ExtCtrls;

type
  TFormMessageBox = class(TForm)
    bk_img: TImage;
    ButtonNo: TButton;
    ButtonYes: TButton;
    PanelMessages: TPanel;
    LabelMessage: TRichEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure ButtonYesClick(Sender: TObject);
    procedure ButtonNoClick(Sender: TObject);
  private
    { Private declarations }
  public
    MsgResult: Integer;
    { Public declarations }
  end;

var
  FormMessageBox: TFormMessageBox;

implementation

uses uMain, uPreferences;

{$R *.dfm}

procedure TFormMessageBox.FormCreate(Sender: TObject);
begin
  if FileExists(FormMain.FrontendPath+'resources\images\msgbox.png') then
     bk_img.Picture.LoadFromFile(FormMain.FrontendPath+'resources\images\msgbox.png');
end;

procedure TFormMessageBox.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if (FormPreferences.HotRodSE.Checked) or (FormPreferences.XArcade.Checked) or (FormPreferences.SlikStik.Checked)
     or (FormPreferences.Devastator2.Checked) then
     begin
       if (Key = 'S') or (Key = 's') then
          ButtonYes.Click
       else
       if (Key = 'Q') or (Key = 'q') then
          ButtonNo.Click; // ClickButtonNo
     end
  else
     begin
       if Key = #13 then
          ButtonYes.Click
       else
       if Key = #27 then
          ButtonNo.Click; // ClickButtonNo
     end;
end;

procedure TFormMessageBox.FormShow(Sender: TObject);
begin
  BringToFront;
end;

procedure TFormMessageBox.ButtonYesClick(Sender: TObject);
begin
  MsgResult:= mrYes;
  Close;
end;

procedure TFormMessageBox.ButtonNoClick(Sender: TObject);
begin
  MsgResult:= mrNo;
  Close;
end;

end.
