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
*/
Shinya Kitaoka d1f6c4
class PaletteData final : public DvMimeData {
Shinya Kitaoka 120a6e
  TPalette *m_palette;
Shinya Kitaoka 120a6e
  std::set<int> m_styleIndicesInPage;</int>
Shinya Kitaoka 120a6e
  int m_pageIndex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PaletteData() : m_palette(0), m_pageIndex(-1) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~PaletteData() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  PaletteData *clone() const override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setPaletteData(TPalette *palette, int pageIndex,
Shinya Kitaoka 120a6e
                      std::set<int> styleIndicesInPage);</int>
Shinya Kitaoka 120a6e
  void setPalette(TPalette *palette);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool hasStyleIndeces() const {
Shinya Kitaoka 120a6e
    return m_pageIndex != -1 && m_styleIndicesInPage.size() > 0;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool hasOnlyPalette() const { return !hasStyleIndeces(); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *getPalette() const { return m_palette; }
Shinya Kitaoka 120a6e
  int getPageIndex() const { return m_pageIndex; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const std::set<int> &getIndicesInPage() const { return m_styleIndicesInPage; }</int>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif