Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TW_POPUP_INCLUDED
Toshihiro Shimizu 890ddd
#define TW_POPUP_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/tw.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TPopup : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	bool m_isOpen;
Toshihiro Shimizu 890ddd
	bool m_isMenu;
Toshihiro Shimizu 890ddd
	bool m_hasCaption;
Toshihiro Shimizu 890ddd
	bool m_isResizable;
Toshihiro Shimizu 890ddd
	bool m_isTopMost;
Toshihiro Shimizu 890ddd
	virtual void create();
Shinya Kitaoka 3bfa54
	std::wstring m_caption;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TPopup(TWidget *parent, std::string name, bool hasCaption = true, bool isResizable = true, bool isTopMost = false);
Toshihiro Shimizu 890ddd
	~TPopup();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void openPopup();
Toshihiro Shimizu 890ddd
	virtual void openPopup(const TPoint &pos);
Toshihiro Shimizu 890ddd
	virtual void openPopup(const TDimension &size);
Toshihiro Shimizu 890ddd
	virtual void closePopup();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void setGeometry(const TRect &rect);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool onNcPaint(bool is_active, const TDimension &window_size, const TRect &caption_rect);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//if return false, the popup does not close;
Toshihiro Shimizu 890ddd
	virtual bool onClose() { return true; }
Toshihiro Shimizu 890ddd
	virtual void onOpen() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isOpen() { return m_isOpen; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isMenu() const { return m_isMenu; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool hasCaption() const { return m_hasCaption; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isResizable() const { return m_isResizable; }
Toshihiro Shimizu 890ddd
	bool isTopMost() const { return m_isTopMost; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void setCaption(const std::string &name);
Shinya Kitaoka 3bfa54
	void setCaption(const std::wstring &name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	std::wstring getCaption() const { return m_caption; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TDimension getPreferredSize() const;
Toshihiro Shimizu 890ddd
	virtual TDimension getMinimumSize() const { return TDimension(1, 1); };
Toshihiro Shimizu 890ddd
	virtual TDimension getMaximumSize() const { return TDimension(32768, 32768); };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TModalPopup : public TPopup
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	bool m_shellWasDisabled;
Toshihiro Shimizu 890ddd
	bool m_doQuit;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	virtual void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TModalPopup(TWidget *parent, std::string name, bool hasCaption = true, bool isResizable = true, bool isTopMost = true);
Toshihiro Shimizu 890ddd
	~TModalPopup();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// virtual void popup(const TPoint &pos);
Toshihiro Shimizu 890ddd
	virtual void openPopup();
Toshihiro Shimizu 890ddd
	virtual void openPopup(const TDimension &size);
Toshihiro Shimizu 890ddd
	virtual void openPopup(const TPoint &pos);
Toshihiro Shimizu 890ddd
	virtual void closePopup();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static int getTitlebarHeight();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif