#pragma once

#include "DataElement.hpp"
#include "Bar.hpp"
#include "DataGroup.hpp"

/*
   Class: StackedBar

     Implements a stacked bar data element.
     A stacked bar is a grouping of several bar data elements and a common label.

     *Inherits* from <DataElement>.
*/
class StackedBar: public DataElement {
  public:
    /*
       Constructor: StackedBar

         Initializes the object.

       Parameters:

         pDataGroup - Pointer to the data group object that shall be represented by the stacked bar.
         fLeft - The x value of the bars.
         fWidth - The width of the bars.
         dHighestGridValue - Highest grid value indicating how much the bars have to be scaled to fit.
    */
    StackedBar(DataGroup* pDataGroup, float fLeft, float fWidth, double dHighestGridValue);

    /*
       Destructor: ~StackedBar

         Releases all allocated resources.
    */
    ~StackedBar();


    /*
       Function: Draw

         Draws the stacked bar. *Inherited* from <AlterableObject>.

       Parameters:

         pPainter - The QPainter object that shall be used for painting.
    */
    void Draw(QPainter* pPainter);

    /*
       Function: DrawLabels

         Draws the label assigned to the stacked bar. *Inherited* from <AlterableObject>.

       Parameters:

         pPainter - The QPainter object that shall be used for painting.
    */
    void DrawLabels(QPainter* pPainter);

    /*
       Function: ChangePosition

         Changes the position of the stacked bar. *Inherited* from <AlterableObject>.

       Parameters:

         fDeltaLeft - Total horizontal distance.
         fDeltaTop - Unused parameter.
         fDeltaBottom - Unused parameter.
    */
    void ChangePosition(float fDeltaLeft, float fDeltaTop, float fDeltaBottom);

    /*
       Function: Scale

         Scales the object. *Inherited* from <DataElement>.

       Parameters:

         fDeltaWidth - Total horizontal scaling value.
         fDeltaHeight - Unused parameter.
    */
    void Scale(float fDeltaWidth, float fDeltaHeight);

    /*
       Function: ChangeAlpha

         Unused function. *Inherited* from <AlterableObject>.

       Parameters:

         fDeltaAlpha - Unused parameter.
    */
    void ChangeAlpha(float fDeltaAlpha);

    /*
       Function: GetDataGroup

         Returns the data group connected to the stacked bar.

       Returns:

         The data group connected to the stacked bar.
    */
    DataGroup* GetDataGroup();

    /*
       Function: GetBars

         Returns a vector containing all bars of the stacked bar.

       Returns:

         A vector containing all bars of the stacked bar.
    */
    std::vector<Bar*> GetBars();

  private:
    std::vector<Bar*> vBars;
    DataGroup* pDataGroup;
};