Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TNZ_PANEL_INCLUDED
Toshihiro Shimizu 890ddd
#define TNZ_PANEL_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/tw.h"
Toshihiro Shimizu 890ddd
#include "tw/button.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TPanel : public TWidget {
Shinya Kitaoka 120a6e
  int m_border, m_resizeHandleWidth;
Shinya Kitaoka 120a6e
  TWidget *m_dockWidget;
Shinya Kitaoka 120a6e
  TButton *m_maximizeButton;
Shinya Kitaoka 120a6e
  bool m_maximized;
Shinya Kitaoka 120a6e
  int m_status;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  enum Side { Center, Top, Right, Bottom, Left };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPanel(TWidget *parent, string name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void draw();
Shinya Kitaoka 120a6e
  void keyDown(int key, TUINT32 flags, const TPoint &p);
Shinya Kitaoka 120a6e
  void close();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void dockToggle();
Shinya Kitaoka 120a6e
  void maximizeToggle();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void configureNotify(const TDimension &d);
Shinya Kitaoka 120a6e
  void mouseMove(const TPoint &p);
Shinya Kitaoka 120a6e
  void leftButtonDown(const TMouseEvent &e);
Shinya Kitaoka 120a6e
  void leftButtonUp(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void leave(const TPoint &p);
Shinya Kitaoka 120a6e
  void enter(const TPoint &p);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  Side findSide(const TPoint &p);
Shinya Kitaoka 120a6e
  bool canMoveSide(Side side);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static TPanel *createPanel(TWidget *parent, string name);
Shinya Kitaoka 120a6e
  void setParent(TWidget *p) {
Shinya Kitaoka 120a6e
    TWidget::setParent(p);
Shinya Kitaoka 120a6e
    m_dockWidget = p;
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TPanelResizer {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPanelResizer(){};
Shinya Kitaoka 120a6e
  virtual bool canMoveSide(TPanel *panel, TPanel::Side side) = 0;
Shinya Kitaoka 120a6e
  virtual void moveSide(TPanel *panel, TPanel::Side side)    = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif