Two-dimensional model for ferromagnetic martensites