#pragma once

namespace xtr::ui {

// don't sugget noexcept for default virtual implementations
#pragma warning( push )
#pragma warning( disable : 26440 )

//! Frame: 2 pane splitter
class Split2ViewFrame : public CMDIChildWndEx {
  CString registryName;
  SIZE minSize;
  uint32_t minPane2Width;

  int32_t& secondViewWidth;

  CSplitterWnd splitterWnd{};

public:
  ~Split2ViewFrame() override = default;
  Split2ViewFrame(const Split2ViewFrame&) = delete;
  Split2ViewFrame& operator=(const Split2ViewFrame&) = delete;

protected:
  Split2ViewFrame(uint32_t registryID, SIZE minSize, 
                  uint32_t minPane2Width, int& splitterTracker);

private:
  BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) override;

private:
  DECLARE_MESSAGE_MAP()
  afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  afx_msg void OnDestroy();
  afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);

private:
  virtual CRuntimeClass* SecondViewClass() { return nullptr; }
  virtual void PostCreateSetup(CWnd* /*firstView*/, CWnd* /*secondView*/) {}
};

class RSFormFrame : public Split2ViewFrame {
  DECLARE_DYNCREATE(RSFormFrame)
  RSFormFrame();
  CRuntimeClass* SecondViewClass() override;
};

class RSModelFrame final : public Split2ViewFrame {
  DECLARE_DYNCREATE(RSModelFrame)
  RSModelFrame();
  CRuntimeClass* SecondViewClass() override;
};

class OSSFrame final : public Split2ViewFrame {
  DECLARE_DYNCREATE(OSSFrame)
  OSSFrame();
  CRuntimeClass* SecondViewClass() override;
  void PostCreateSetup(CWnd* firstView, CWnd* secondView) override;
};

#pragma warning( pop )

} // namespace xtr::ui