Shinya Kitaoka 810553
#pragma once
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
Shinya Kitaoka 120a6e
class DVAPI TPopup : public TWidget {
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  bool m_isOpen;
Shinya Kitaoka 120a6e
  bool m_isMenu;
Shinya Kitaoka 120a6e
  bool m_hasCaption;
Shinya Kitaoka 120a6e
  bool m_isResizable;
Shinya Kitaoka 120a6e
  bool m_isTopMost;
Shinya Kitaoka 120a6e
  virtual void create();
Shinya Kitaoka 120a6e
  std::wstring m_caption;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TPopup(TWidget *parent, std::string name, bool hasCaption = true,
Shinya Kitaoka 120a6e
         bool isResizable = true, bool isTopMost = false);
Shinya Kitaoka 120a6e
  ~TPopup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void openPopup();
Shinya Kitaoka 120a6e
  virtual void openPopup(const TPoint &pos);
Shinya Kitaoka 120a6e
  virtual void openPopup(const TDimension &size);
Shinya Kitaoka 120a6e
  virtual void closePopup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void setGeometry(const TRect &rect);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool onNcPaint(bool is_active, const TDimension &window_size,
Shinya Kitaoka 120a6e
                 const TRect &caption_rect);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // if return false, the popup does not close;
Shinya Kitaoka 120a6e
  virtual bool onClose() { return true; }
Shinya Kitaoka 120a6e
  virtual void onOpen() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isOpen() { return m_isOpen; };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isMenu() const { return m_isMenu; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool hasCaption() const { return m_hasCaption; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool isResizable() const { return m_isResizable; }
Shinya Kitaoka 120a6e
  bool isTopMost() const { return m_isTopMost; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setCaption(const std::string &name);
Shinya Kitaoka 120a6e
  void setCaption(const std::wstring &name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::wstring getCaption() const { return m_caption; };
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual TDimension getPreferredSize() const;
Shinya Kitaoka 120a6e
  virtual TDimension getMinimumSize() const { return TDimension(1, 1); };
Shinya Kitaoka 120a6e
  virtual TDimension getMaximumSize() const {
Shinya Kitaoka 120a6e
    return TDimension(32768, 32768);
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TModalPopup : public TPopup {
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  bool m_shellWasDisabled;
Shinya Kitaoka 120a6e
  bool m_doQuit;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  virtual void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TModalPopup(TWidget *parent, std::string name, bool hasCaption = true,
Shinya Kitaoka 120a6e
              bool isResizable = true, bool isTopMost = true);
Shinya Kitaoka 120a6e
  ~TModalPopup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // virtual void popup(const TPoint &pos);
Shinya Kitaoka 120a6e
  virtual void openPopup();
Shinya Kitaoka 120a6e
  virtual void openPopup(const TDimension &size);
Shinya Kitaoka 120a6e
  virtual void openPopup(const TPoint &pos);
Shinya Kitaoka 120a6e
  virtual void closePopup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static int getTitlebarHeight();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif