#pragma once

#include "../Common/Resource.h"


// Zivid grabber parameters dialog
class ZividParamDialog : public CDialog
{
public:
  ZividParamDialog(std::string cc, int color) :CDialog(IDD_ZIVID_PARAMETERS),
    camera_config(cc), retrive_color(color)
  {}

protected:
  DECLARE_MESSAGE_MAP()

  virtual void DoDataExchange(CDataExchange* pDX)
  {
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_ZIVID_FOLDER, camera_config_ctrl);
    DDX_Control(pDX, IDC_ZIVID_COLOR, retrieve_color_ctrl);
  }

  virtual BOOL OnInitDialog()
  {
    CDialog::OnInitDialog();

    camera_config_ctrl.SetWindowText(CString(camera_config.c_str()));
    camera_config_ctrl.EnableFileBrowseButton(TEXT("yml"), TEXT("yml Files|*.yml||"));

    retrieve_color_ctrl.SetCheck(retrive_color);

    return TRUE;
  }

  void OnOK()
  {
    CString str = _T("");
    camera_config_ctrl.GetWindowTextW(str);
    camera_config = CT2A(str.GetString());

    retrive_color = retrieve_color_ctrl.GetCheck();

    CDialog::EndDialog(1);
  }

  // edit controls
  CMFCEditBrowseCtrl camera_config_ctrl;
  CButton retrieve_color_ctrl;

public:
  std::string camera_config;
  int retrive_color;
};

BEGIN_MESSAGE_MAP(ZividParamDialog, CDialog)
END_MESSAGE_MAP()

