tahoma2d/toonz/sources/include/tw/popup.h

81 lines
2 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TW_POPUP_INCLUDED
#define TW_POPUP_INCLUDED
#include "tw/tw.h"
2016-06-15 18:43:10 +12:00
class DVAPI TPopup : public TWidget {
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
bool m_isOpen;
bool m_isMenu;
bool m_hasCaption;
bool m_isResizable;
bool m_isTopMost;
virtual void create();
std::wstring m_caption;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TPopup(TWidget *parent, std::string name, bool hasCaption = true,
bool isResizable = true, bool isTopMost = false);
~TPopup();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual void openPopup();
virtual void openPopup(const TPoint &pos);
virtual void openPopup(const TDimension &size);
virtual void closePopup();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual void setGeometry(const TRect &rect);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool onNcPaint(bool is_active, const TDimension &window_size,
const TRect &caption_rect);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// if return false, the popup does not close;
virtual bool onClose() { return true; }
virtual void onOpen() {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool isOpen() { return m_isOpen; };
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool isMenu() const { return m_isMenu; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool hasCaption() const { return m_hasCaption; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool isResizable() const { return m_isResizable; }
bool isTopMost() const { return m_isTopMost; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setCaption(const std::string &name);
void setCaption(const std::wstring &name);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
std::wstring getCaption() const { return m_caption; };
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual TDimension getPreferredSize() const;
virtual TDimension getMinimumSize() const { return TDimension(1, 1); };
virtual TDimension getMaximumSize() const {
return TDimension(32768, 32768);
};
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
class DVAPI TModalPopup : public TPopup {
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
bool m_shellWasDisabled;
bool m_doQuit;
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
virtual void create();
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TModalPopup(TWidget *parent, std::string name, bool hasCaption = true,
bool isResizable = true, bool isTopMost = true);
~TModalPopup();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// virtual void popup(const TPoint &pos);
virtual void openPopup();
virtual void openPopup(const TDimension &size);
virtual void openPopup(const TPoint &pos);
virtual void closePopup();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static int getTitlebarHeight();
2016-03-19 06:57:51 +13:00
};
#endif