Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TNZ_ITEMBROWSER_INCLUDED
Toshihiro Shimizu 890ddd
#define TNZ_ITEMBROWSER_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/tw.h"
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 TFilePath;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TItemBrowser : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	class Data;
Toshihiro Shimizu 890ddd
	Data *m_data;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TItemBrowser(TWidget *parent, const TFilePath &rootDir, string name = "ItemBrowser");
Toshihiro Shimizu 890ddd
	~TItemBrowser();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setBorder(int dx, int dy);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setItemSize(const TDimension &d);
Toshihiro Shimizu 890ddd
	TDimension getItemSize() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual int getItemCount() const = 0;
Toshihiro Shimizu 890ddd
	virtual void drawItem(
Toshihiro Shimizu 890ddd
		TWidget *w,
Toshihiro Shimizu 890ddd
		const TRect &rect,
Toshihiro Shimizu 890ddd
		int index,
Toshihiro Shimizu 890ddd
		bool selected) const = 0;
Toshihiro Shimizu 890ddd
	virtual bool isItemWide(int index) const { return false; };
Toshihiro Shimizu 890ddd
	virtual void loadItems(const TFilePath &rootDir) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void onSelect(int index) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void select(int index);
Toshihiro Shimizu 890ddd
	void notifyItemCountChange();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void configureNotify(const TDimension &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void update();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void onKey(int key, int index){};
Toshihiro Shimizu 890ddd
	virtual wstring getTooltipString(int) { return wstring(); }
Toshihiro Shimizu 890ddd
	virtual string getContextHelpReference(int) { return string(); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif