Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FILMSTRIP_INCLUDED
Toshihiro Shimizu 890ddd
#define FILMSTRIP_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/tw.h"
Toshihiro Shimizu 890ddd
//#include "tw/scrollbar.h"
Toshihiro Shimizu 890ddd
#include "tlevel_io.h"
Toshihiro Shimizu 890ddd
#include "tthread.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
// forward declaration
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TScrollbar;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=========================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TWIN_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TFilmStripPanel : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TPoint m_lastPos;
Toshihiro Shimizu 890ddd
	int m_offset;
Toshihiro Shimizu 890ddd
	TScrollbar *m_scrollbar;
Toshihiro Shimizu 890ddd
	TLevelP m_level;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TUINT32 m_loaderId;
Toshihiro Shimizu 890ddd
	TLevelReaderP m_levelReader;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool m_loaded;
Toshihiro Shimizu 890ddd
	TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	friend class FilmStripLoader;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	static const int m_xsize;
Toshihiro Shimizu 890ddd
	static const int m_ysize;
Toshihiro Shimizu 890ddd
	static const int m_frameHeight;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TFilmStripPanel(TWidget *parent, string name = "FilmStripPanel");
Toshihiro Shimizu 890ddd
	~TFilmStripPanel();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void repaint();
Toshihiro Shimizu 890ddd
	void draw();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void leftButtonDown(const TMouseEvent &);
Toshihiro Shimizu 890ddd
	void leftButtonDrag(const TMouseEvent &);
Toshihiro Shimizu 890ddd
	void leftButtonUp(const TMouseEvent &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void onDrop(string s);
Toshihiro Shimizu 890ddd
	void onTimer(int);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setScrollbar(TScrollbar *sb);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setLevel(TLevelP level);
Toshihiro Shimizu 890ddd
	TLevelP getLevel() { return m_level; };
Toshihiro Shimizu 890ddd
	void onScrollbarMove(int value);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void updateScrollbar();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TFilmStrip : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TFilmStripPanel *m_panel;
Toshihiro Shimizu 890ddd
	TScrollbar *m_scrollbar;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TFilmStrip(TWidget *parent, string name = "FilmStrip");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void configureNotify(const TDimension &d);
Toshihiro Shimizu 890ddd
	void drop(string s) { m_panel->onDrop(s); };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif