//#####################################################################
// Copyright 2004-2009, Eran Guendelman, Frank Losasso, Andrew Selle.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class QT_GROUP
//#####################################################################
#ifndef __QT_GROUP__
#define __QT_GROUP__

#include <Core/Matrices/FRAME.h>
#include "QT_COMPONENT.h"
#include <map>
#include <memory>

namespace PhysBAM
{
struct GROUP_OPTIONS;
class QT_GROUP:public QT_COMPONENT
{
public:
    typedef GROUP_OPTIONS OPT;

private:
    OPT opt,raw_opt[4];
    std::map<std::string,std::shared_ptr<QT_COMPONENT>> components;
    FRAME<FV> frame;

    std::string selected_component;
    static const QT_COMPONENT_OPTION options[];
    static const int num_options;
    typedef QT_GROUP SELF;
public:

    QT_GROUP(QT_WORLD& world,const std::string& name);
    virtual ~QT_GROUP();

    void Render(QT_RENDER_UTILS& ru) override;
    void Read() override;
    void Invalidate(bool invalidate_common) override;
    RANGE<FV> Bounding_Box() override;
    void Set_Selection(ARRAY_VIEW<int> selection) override;
    void Clear_Selection() override;
    FV Selection_Point() override;
    void Add_To_Menu(QT_MAIN_WINDOW& main,QMenu* menu) override;
    void Make_Dialog(QT_WINDOW& window) override;
    void Read_Option(std::istream& in,int level) override;
    void Set_Draw(bool draw) override;
    bool Draw() const override;
    void Save_Settings(std::ostream& out) override;
    void Clear_Settings() override;
};
}

#endif
