|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TNZ_SCROLLVIEW_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TNZ_SCROLLVIEW_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 TScrollbar;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TScrollView : public TWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPoint m_delta;
|
|
Toshihiro Shimizu |
890ddd |
TScrollbar *m_vsb, *m_hsb;
|
|
Toshihiro Shimizu |
890ddd |
TDimension m_contentSize;
|
|
Toshihiro Shimizu |
890ddd |
bool m_autopanning;
|
|
Toshihiro Shimizu |
890ddd |
TPoint m_autopanningPos;
|
|
Toshihiro Shimizu |
890ddd |
int m_autopanningOldT;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
3bfa54 |
TScrollView(TWidget *parent, std::string name = "scrollview");
|
|
Toshihiro Shimizu |
890ddd |
~TScrollView();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void middleButtonDown(const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
void middleButtonDrag(const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
void middleButtonUp(const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void configureNotify(const TDimension &d);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void doScrollTo(const TPoint &p);
|
|
Toshihiro Shimizu |
890ddd |
inline void doScrollTo(int x, int y) { doScrollTo(TPoint(x, y)); }
|
|
Toshihiro Shimizu |
890ddd |
inline void doScrollTo_x(int x) { doScrollTo(TPoint(x, m_yoff)); }
|
|
Toshihiro Shimizu |
890ddd |
inline void doScrollTo_y(int y) { doScrollTo(TPoint(m_xoff, y)); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void scrollTo(const TPoint &p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
doScrollTo(p);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
inline void scrollTo(int x, int y) { scrollTo(TPoint(x, y)); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline TPoint getScrollPosition() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return TPoint(m_xoff, m_yoff);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setScrollbars(TScrollbar *hsb, TScrollbar *vsb);
|
|
Toshihiro Shimizu |
890ddd |
void setContentSize(const TDimension &d);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension getContentSize() const { return m_contentSize; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onVsbChange(int value);
|
|
Toshihiro Shimizu |
890ddd |
void onHsbChange(int value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onTimer(int t);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void startAutopanning();
|
|
Toshihiro Shimizu |
890ddd |
void stopAutopanning();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool isAutopanning() const { return m_autopanning; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void autopanningDrag(const TPoint &pos){};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// provvisorio
|
|
Toshihiro Shimizu |
890ddd |
void updateScrollbars();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|