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