unit uImagesToolBarEditor;

interface

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

type
  TFormImagesToolBarEditor = class(TForm)
    ToolBarList: TListView;
    ButtonOk: TButton;
    ButtonCancel: TButton;
    ButtonDefault: TButton;
    ButtonReset: TButton;
    ButtonHideToolBar: TSpeedButton;
    LabelGameDescription: TLabel;
    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
  FormImagesToolBarEditor: TFormImagesToolBarEditor;

implementation

uses uMain;

{$R *.dfm}

procedure TFormImagesToolBarEditor.ButtonOkClick(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ImagesToolbarButtons.ButtonCount-2 do
      FormMain.ImagesToolbarButtons.Buttons[Loop].Visible:= ToolBarList.Items[Loop].Checked;
  FormMain.ImagesToolBarPanel.Visible:= not ButtonHideToolBar.Down;
  Close;
end;

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

procedure TFormImagesToolBarEditor.FormShow(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ImagesToolbarButtons.ButtonCount-2 do
      ToolBarList.Items[Loop].Checked:= FormMain.ImagesToolbarButtons.Buttons[Loop].Visible;
  ButtonHideToolBar.Down:= not FormMain.ImagesToolBarPanel.Visible;
  FormMain.LoadTopBar(TopImage, 'toolbar.png');
end;

procedure TFormImagesToolBarEditor.ButtonDefaultClick(Sender: TObject);
var
  Loop: ShortInt;
begin
  for Loop:=0 to FormMain.ImagesToolbarButtons.ButtonCount-2 do
      ToolBarList.Items[Loop].Checked:= ToolBarList.Items[Loop].Caption <> 'Images View Mode';
  ButtonHideToolBar.Down:= False;
end;

procedure TFormImagesToolBarEditor.ButtonResetClick(Sender: TObject);
begin
  FormImagesToolBarEditor.OnShow(Self);
end;

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

end.
