tahoma2d/toonz/sources/include/tw/itembrowser.h

55 lines
1.2 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TNZ_ITEMBROWSER_INCLUDED
#define TNZ_ITEMBROWSER_INCLUDED
#include "tw/tw.h"
#undef DVAPI
#undef DVVAR
#ifdef TWIN_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
class TFilePath;
2016-06-15 18:43:10 +12:00
class DVAPI TItemBrowser : public TWidget {
class Data;
Data *m_data;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TItemBrowser(TWidget *parent, const TFilePath &rootDir,
string name = "ItemBrowser");
~TItemBrowser();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setBorder(int dx, int dy);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setItemSize(const TDimension &d);
TDimension getItemSize() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual int getItemCount() const = 0;
virtual void drawItem(TWidget *w, const TRect &rect, int index,
bool selected) const = 0;
virtual bool isItemWide(int index) const { return false; };
virtual void loadItems(const TFilePath &rootDir) {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual void onSelect(int index) {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void select(int index);
void notifyItemCountChange();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void configureNotify(const TDimension &);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void update();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual void onKey(int key, int index){};
virtual wstring getTooltipString(int) { return wstring(); }
virtual string getContextHelpReference(int) { return string(); }
2016-03-19 06:57:51 +13:00
};
#endif