/*
    CaPriCe Forever - Amstrad CPC 464/664/6128 emulator
    Copyright (C) 2014-2015 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 TFormGameControllerSettingsH
#define TFormGameControllerSettingsH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.ComCtrls.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.Grids.hpp>
#include <Vcl.StdCtrls.hpp>
#include "..\Inputs\TInputContext.h"
#include "..\Settings\TSettings.h"
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TFormGameControllerSettings : public TForm
{
__published:	// Composants gérés par l'EDI
  TComboBox *ComboBoxControllersList;
  TPageControl *PageControlActions;
  TTabSheet *TabSheetButtons;
  TTabSheet *TabSheetPOV;
  TComboBox *ComboBoxPOVId;
  TLabel *POVId;
  TTabSheet *TabSheetAnalog;
  TComboBox *ComboBoxAnalogAxis;
  TLabel *LabelAxis;
  TTrackBar *TrackBarAnalogPressThreshold;
  TLabel *LabelAnalogPressThreshold;
  TGroupBox *GroupBoxProfile;
  TLabel *LabelFromProfile;
  TLabel *LabelSaveProfile;
  TComboBox *ComboBoxProfiles;
  TCheckBox *CheckBoxAnalogMouseX;
  TCheckBox *CheckBoxAnalogMouseY;
  TLabel *LabelAnalogDeadZone;
  TTrackBar *TrackBarAnalogDeadZone;
  TPanel *PanelFromProfile;
  TPanel *PanelButtonRefresh;
  TPanel *PanelButtonProperties;
  TPanel *PanelButtonApply;
  TPanel *PanelButtonCancel;
  TPanel *PanelListButtons;
  TStringGrid *StringGridButtons;
  TPanel *PanelButtonUpdateButtons;
  TPanel *PanelListPOV;
  TPanel *PanelButtonUpdatePOV;
  TStringGrid *StringGridPOV;
  TPanel *PanelListAnalog;
  TPanel *PanelButtonUpdateAnalog;
  TStringGrid *StringGridAnalog;
  void __fastcall FormShow(TObject *Sender);
  void __fastcall ComboBoxControllersListChange(TObject *Sender);
  void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  void __fastcall FormResize(TObject *Sender);
  void __fastcall StringGridButtonsDrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, TGridDrawState State);
  void __fastcall ComboBoxProfilesChange(TObject *Sender);
  void __fastcall ComboBoxPOVIdChange(TObject *Sender);
  void __fastcall StringGridPOVDrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, TGridDrawState State);
  void __fastcall ComboBoxAnalogAxisChange(TObject *Sender);
  void __fastcall StringGridAnalogDrawCell(TObject *Sender, int ACol,
          int ARow, TRect &Rect, TGridDrawState State);
  void __fastcall TrackBarAnalogPressThresholdChange(TObject *Sender);
  void __fastcall TabSheetButtonsShow(TObject *Sender);
  void __fastcall TabSheetPOVShow(TObject *Sender);
  void __fastcall TabSheetAnalogShow(TObject *Sender);
  void __fastcall CheckBoxAnalogMouseXClick(TObject *Sender);
  void __fastcall CheckBoxAnalogMouseYClick(TObject *Sender);
  void __fastcall TrackBarAnalogDeadZoneChange(TObject *Sender);
  void __fastcall ComboBoxControllersListDrawItem(TWinControl *Control, int Index,
          TRect &Rect, TOwnerDrawState State);
  void __fastcall ComboBoxProfilesDrawItem(TWinControl *Control, int Index, TRect &Rect,
          TOwnerDrawState State);
  void __fastcall ComboBoxPOVIdDrawItem(TWinControl *Control, int Index, TRect &Rect,
          TOwnerDrawState State);
  void __fastcall ComboBoxAnalogAxisDrawItem(TWinControl *Control, int Index, TRect &Rect,
          TOwnerDrawState State);
  void __fastcall PageControlActionsDrawTab(TCustomTabControl *Control, int TabIndex,
          const TRect &Rect, bool Active);
  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 PanelButtonRefreshClick(TObject *Sender);
  void __fastcall PanelButtonPropertiesClick(TObject *Sender);
  void __fastcall PanelButtonApplyClick(TObject *Sender);
  void __fastcall PanelButtonCancelClick(TObject *Sender);
  void __fastcall StringGridButtonsDblClick(TObject *Sender);
  void __fastcall PanelButtonUpdateButtonsClick(TObject *Sender);
  void __fastcall PanelButtonUpdatePOVClick(TObject *Sender);
  void __fastcall StringGridPOVDblClick(TObject *Sender);
  void __fastcall PanelButtonUpdateAnalogClick(TObject *Sender);
  void __fastcall StringGridAnalogDblClick(TObject *Sender);
private:	// Déclarations utilisateur
  // Members
  TInputContext* mInputContextP;
  TInputDevice* mSelectedDeviceP;
  TSettings* mSettingsP;
  bool mModified;
  AnsiString mDefaultProfile;
  AnsiString mDriveAProfile;
  AnsiString mDriveBProfile;
  AnsiString mCurrentProfile;
  TInputActionAnalog* mSelectedAnalogP;
  int mSelectedAnalogIndex;
  TInputRemoveDevice mPreviousOnRemoveDevice;
  // Methods
  inline void __fastcall SetInputContext(TInputContext* Value) { mInputContextP = Value; };
  inline void __fastcall SetSettings(TSettings* Value) { mSettingsP = Value; };
  void __fastcall OnIdle(TObject *Sender, bool &Done);
  inline bool __fastcall GetModified(void) { return mModified; };
  void __fastcall SetCurrentProfile(AnsiString Value);
  void __fastcall SetDefaultProfile(AnsiString Value);
  void __fastcall SetDriveAProfile(AnsiString Value);
  void __fastcall SetDriveBProfile(AnsiString Value);
  AnsiString __fastcall GetSelectedProfile(void);
  void __fastcall OnRemoveGameController(AnsiString Name);

public:		// Déclarations utilisateur
  // Properties
  __property TInputContext* InputContextP = { write=SetInputContext };
  __property TSettings* Settings = { write=SetSettings };
  __property bool Modified = { read=GetModified };
  __property AnsiString CurrentProfile = { write=SetCurrentProfile };
  __property AnsiString DefaultProfile = { write=SetDefaultProfile };
  __property AnsiString DriveAProfile = { write=SetDriveAProfile };
  __property AnsiString DriveBProfile = { write=SetDriveBProfile };
  __property AnsiString SelectedProfile = { read=GetSelectedProfile };
  // Methods
  __fastcall TFormGameControllerSettings(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormGameControllerSettings *FormGameControllerSettings;
//---------------------------------------------------------------------------
#endif
