#pragma once
// ── RectangleDialog ──────────────────────────────────────────────────────────
// Asks for the width and height of a rectangular scenery shape.
//
// Drawing an exact footprint freehand is fiddly -- you can get a rough shape
// with the mouse easily enough, but hitting a precise 2400 x 1200 baseboard is
// near impossible. This lets the user type the dimensions instead. The
// rectangle is dropped at the centre of the current view; they can drag it
// where they want afterwards.
// ─────────────────────────────────────────────────────────────────────────────
#include <wx/wx.h>
#include <wx/spinctrl.h>

class RectangleDialog : public wxDialog {
public:
    // units: 0 = mm, 1 = cm, 2 = inch. Governs both the labels and the
    // numbers shown, but Width()/Height() always return millimetres.
    RectangleDialog(wxWindow* parent, int units = 0,
                    double defaultWmm = 1000.0, double defaultHmm = 600.0);

    double WidthMm()  const { return m_wMm; }
    double HeightMm() const { return m_hMm; }

private:
    void OnOK(wxCommandEvent&);

    int    m_units = 0;
    double m_wMm   = 0.0;
    double m_hMm   = 0.0;

    wxSpinCtrlDouble* m_spW = nullptr;
    wxSpinCtrlDouble* m_spH = nullptr;
};
