Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef PALETTE_DATA_INCLUDED
Toshihiro Shimizu 890ddd
#define PALETTE_DATA_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/dvmimedata.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
#include <vector></vector>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPalette;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
// PaletteData
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
/*! Useful to set data in drag and drop event styles or palette.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
class PaletteData : public DvMimeData
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TPalette *m_palette;
Toshihiro Shimizu 890ddd
	std::set<int> m_styleIndicesInPage;</int>
Toshihiro Shimizu 890ddd
	int m_pageIndex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	PaletteData()
Toshihiro Shimizu 890ddd
		: m_palette(0), m_pageIndex(-1)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	~PaletteData()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	PaletteData *clone() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setPaletteData(TPalette *palette, int pageIndex, std::set<int> styleIndicesInPage);</int>
Toshihiro Shimizu 890ddd
	void setPalette(TPalette *palette);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool hasStyleIndeces() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return m_pageIndex != -1 && m_styleIndicesInPage.size() > 0;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool hasOnlyPalette() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return !hasStyleIndeces();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPalette *getPalette() const { return m_palette; }
Toshihiro Shimizu 890ddd
	int getPageIndex() const { return m_pageIndex; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const std::set<int> &getIndicesInPage() const</int>
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return m_styleIndicesInPage;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif