Toshihiro Shimizu 890ddd
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
Toshihiro Shimizu 890ddd
class TPanel : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	int m_border, m_resizeHandleWidth;
Toshihiro Shimizu 890ddd
	TWidget *m_dockWidget;
Toshihiro Shimizu 890ddd
	TButton *m_maximizeButton;
Toshihiro Shimizu 890ddd
	bool m_maximized;
Toshihiro Shimizu 890ddd
	int m_status;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	enum Side {
Toshihiro Shimizu 890ddd
		Center,
Toshihiro Shimizu 890ddd
		Top,
Toshihiro Shimizu 890ddd
		Right,
Toshihiro Shimizu 890ddd
		Bottom,
Toshihiro Shimizu 890ddd
		Left
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPanel(TWidget *parent, string name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void draw();
Toshihiro Shimizu 890ddd
	void keyDown(int key, TUINT32 flags, const TPoint &p);
Toshihiro Shimizu 890ddd
	void close();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void dockToggle();
Toshihiro Shimizu 890ddd
	void maximizeToggle();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void configureNotify(const TDimension &d);
Toshihiro Shimizu 890ddd
	void mouseMove(const TPoint &p);
Toshihiro Shimizu 890ddd
	void leftButtonDown(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
	void leftButtonUp(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void leave(const TPoint &p);
Toshihiro Shimizu 890ddd
	void enter(const TPoint &p);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	Side findSide(const TPoint &p);
Toshihiro Shimizu 890ddd
	bool canMoveSide(Side side);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TPanel *createPanel(TWidget *parent, string name);
Toshihiro Shimizu 890ddd
	void setParent(TWidget *p)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		TWidget::setParent(p);
Toshihiro Shimizu 890ddd
		m_dockWidget = p;
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPanelResizer
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TPanelResizer(){};
Toshihiro Shimizu 890ddd
	virtual bool canMoveSide(TPanel *panel, TPanel::Side side) = 0;
Toshihiro Shimizu 890ddd
	virtual void moveSide(TPanel *panel, TPanel::Side side) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif