/***************************************************************************
 *   Copyright (C) 2018 by Santiago González                               *
 *                                                                         *
 ***( see copyright.txt file at root folder )*******************************/

#pragma once

#include "component.h"

class Shape : public Component
{
    public:
        Shape( QString type, QString id );
        ~Shape();
        
        void updateStep() override;

        QRectF boundingRect() const override {
            return QRectF( m_area.x()-m_border/2-1, m_area.y()-m_border/2-1, 
                           m_area.width()+m_border+2, m_area.height()+m_border+2 ); 
        }
        int hSize() { return m_hSize; }
        void setHSize( int size );
        
        int vSize() { return m_vSize; }
        void setVSize( int size );
        
        int border() { return m_border; }
        void setBorder( int border );
        
        QColor color() { return m_color; }
        void setColor( QColor color );

        double zVal() { return zValue(); }
        void setZVal( double v) { setZValue( v ); }

        double opac() { return m_opac; }
        void setOpac( double op );

        QString colorStr() { return m_color.name(); }
        void setColorStr( QString n ) { setColor( QColor(n) ); }

        bool freeMove( bool ) override { return true; }
        
    protected:
        void changed();

        int m_hSize;
        int m_vSize;
        int m_border;

        double m_opac;

        bool m_changed;
};
