// File RTMDockWidget.cpp by az

#include "RTMDockWidget.h"
#include "RTMTabWidget.h"
#include "RTMTabWidget.h"

#include <QTabWidget>
#include <QSizePolicy>
#include <QDockWidget>

/**
 * Constructor for the RTMDockWidget base class.
 * This class is intended to be a base class only.
 * Creates dockable widget with the appropriate allowed docking areas set and a tab widget, to be used with RTMSimulator.
 * @param strTitle Title for this dockable widget
 * @param parent Parent widget for this RTMDockWidget.
 */
RTMDockWidget::RTMDockWidget(QString strTitle, QWidget* parent) :
        QDockWidget(strTitle, parent)
{
    m_pTabWidget = new QTabWidget(this);
    setWidget(m_pTabWidget);
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
}

/**
 * Adds a tab to the tab widget of this RTMDockWidget.
 * @param pWidget Pointer to a tab that should be added to m_pTabWidget of this RTMDockWidget.
 * @param strLabel Label for this tab
 */
void RTMDockWidget::addTab(RTMTabWidget* pWidget, QString strLabel)
{
    int index = m_pTabWidget->addTab(pWidget,strLabel);
    m_pTabWidget->setTabWhatsThis(index, pWidget->whatsThis());
}

