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