/*
    CaPriCe Forever - Amstrad CPC 464/664/6128 emulator
    Copyright (C) 2014-2019 by Frédéric Coste

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef TFormDrivesCatalogueH
#define TFormDrivesCatalogueH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include "..\Emulator\TEmulator.h"
#include "..\Settings\TSettings.h"
#include <Vcl.ComCtrls.hpp>
#include <VCLTee.TeCanvas.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.ExtCtrls.hpp>


//---------------------------------------------------------------------------
class TFormDrivesCatalogue : public TForm
{
__published:	// Composants gérés par l'EDI
  TTabControl *TabControlCatalogue;
  TListBox *ListBoxCatalogEntries;
  TPanel *PanelButtonRUN;
  TPanel *PanelButtonLOAD;
  TPanel *PanelButtonCPM;
  TPanel *PanelButtonDriveA;
  TPanel *PanelButtonDriveB;
  TPanel *PanelButtonCAT;
  TPanel *PanelButtonDIR;
  TLabel *LabelUser;
  TPanel *PanelFormatUser;
  TPanel *PanelUser;
  TEdit *EditUser;
  TCheckBox *CheckBoxReset;
  void __fastcall FormShow(TObject *Sender);
  void __fastcall FormHide(TObject *Sender);
  void __fastcall FormResize(TObject *Sender);
  void __fastcall TabControlCatalogueDrawTab(TCustomTabControl *Control, int TabIndex,
          const TRect &Rect, bool Active);
  void __fastcall ListBoxCatalogEntriesDrawItem(TWinControl *Control, int Index,
          TRect &Rect, TOwnerDrawState State);
  void __fastcall TabControlCatalogueChange(TObject *Sender);
  void __fastcall FormActivate(TObject *Sender);
  void __fastcall PanelButtonMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
  void __fastcall PanelButtonMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
  void __fastcall PanelButtonRUNClick(TObject *Sender);
  void __fastcall PanelButtonLOADClick(TObject *Sender);
  void __fastcall PanelButtonCPMClick(TObject *Sender);
  void __fastcall PanelButtonDriveAClick(TObject *Sender);
  void __fastcall PanelButtonDriveBClick(TObject *Sender);
  void __fastcall PanelButtonCATClick(TObject *Sender);
  void __fastcall PanelButtonDIRClick(TObject *Sender);
  void __fastcall PanelFormatUserClick(TObject *Sender);
  void __fastcall EditUserChange(TObject *Sender);
  void __fastcall CheckBoxResetClick(TObject *Sender);
private:	// Déclarations utilisateur
  //
  // Members
  //
  TEmulator* mEmulatorP;
  TSettings* mSettingsP;
  int mNbMinEntries;
  int mSizeDiff;
  tUChar mUser;

  //
  // Methods
  //
  AnsiString __fastcall GetTitle(void);
  void __fastcall WMMove(TMessage &Message);
  void __fastcall OnDiskEvent(tDrive* DriveP);
  inline void __fastcall SetEmulator(TEmulator* Value) { mEmulatorP=Value; };
  void __fastcall SetSettings(TSettings* Value);
  void __fastcall DisplayCatalogue(void);

  //
  // Private Properties
  //
  __property AnsiString Title = { read=GetTitle };

public:		// Déclarations utilisateur
  //
  // Public Properties
  //
  __property TEmulator* Emulator = { write=SetEmulator };
  __property TSettings* Settings = { write=SetSettings };

  //
  // API
  //
  __fastcall TFormDrivesCatalogue(TComponent* Owner);

#pragma option push -vi-
BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_MOVE, TMessage, WMMove);
END_MESSAGE_MAP(TForm)
#pragma option pop
};
//---------------------------------------------------------------------------
extern PACKAGE TFormDrivesCatalogue *FormDrivesCatalogue;
//---------------------------------------------------------------------------
#endif
