unit uStatusBarEditor;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, GR32_Image, ComCtrls, StdCtrls, Buttons;

type
  TFormStatusBarEditor = class(TForm)
    ButtonHideToolBar: TSpeedButton;
    LabelGameDescription: TLabel;
    ButtonOk: TButton;
    ButtonCancel: TButton;
    ButtonDefault: TButton;
    ButtonReset: TButton;
    StatusBarList: TListView;
    TopImage: TImage32;
    procedure ButtonOkClick(Sender: TObject);
    procedure ButtonCancelClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ButtonDefaultClick(Sender: TObject);
    procedure ButtonResetClick(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormStatusBarEditor: TFormStatusBarEditor;

implementation

uses uMain;

{$R *.dfm}

procedure TFormStatusBarEditor.ButtonOkClick(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ToolBarStatusBar.ButtonCount-1 do
      FormMain.ToolBarStatusBar.Buttons[Loop].Visible:= StatusBarList.Items[Loop].Checked;
  FormMain.StatusBarPanel.Visible:= not ButtonHideToolBar.Down;
  FormMain.StatusBarPanel.Tag:= Ord(FormMain.StatusBarPanel.Visible);
  FormMain.UpdateStatusBarGame;
  Close;
end;

procedure TFormStatusBarEditor.ButtonCancelClick(Sender: TObject);
begin
  Close;
end;

procedure TFormStatusBarEditor.FormShow(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ToolBarStatusBar.ButtonCount-1 do
      StatusBarList.Items[Loop].Checked:= FormMain.ToolBarStatusBar.Buttons[Loop].Visible;
  ButtonHideToolBar.Down:= not FormMain.StatusBarPanel.Visible;
  FormMain.LoadTopBar(TopImage, 'toolbar.png');
end;

procedure TFormStatusBarEditor.ButtonDefaultClick(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ToolBarStatusBar.ButtonCount-1 do
      StatusBarList.Items[Loop].Checked:= True;
  ButtonHideToolBar.Down:= False;
end;

procedure TFormStatusBarEditor.ButtonResetClick(Sender: TObject);
begin
  FormStatusBarEditor.OnShow(Self);
end;

procedure TFormStatusBarEditor.FormKeyPress(Sender: TObject;
  var Key: Char);
begin
  if Key = #27 then
     Close;
end;

end.
