Initial popup window.

This commit is contained in:
James Grogan 2022-12-02 13:44:52 +00:00
parent f16dd7c0d9
commit 70220fc6e9
22 changed files with 253 additions and 15 deletions

View file

@ -6,6 +6,7 @@
#include <vector>
#include <cstdint>
#include <string>
#include <functional>
class PaintEvent;
class MouseEvent;
@ -30,6 +31,8 @@ class Window : public DrawingSurface
public:
using onPopupFunc = std::function<void(mt::Window* parent, std::unique_ptr<Widget> popup)>;
Window();
~Window();
@ -72,11 +75,37 @@ public:
return mTitle;
}
void addPopup(std::unique_ptr<Widget> popupWidget)
{
if (mPopupFunc)
{
mPopupFunc(this, std::move(popupWidget));
}
}
void setPopupHandler(onPopupFunc func)
{
mPopupFunc = func;
}
void setParent(Window* parent)
{
mParent = parent;
}
Window* getParent() const
{
return mParent;
}
private:
WidgetPtr mWidget {nullptr};
std::string mTitle;
IPlatformWindowPtr mPlatformWindow {nullptr};
std::unique_ptr<DrawingContext> mDrawingContext;
onPopupFunc mPopupFunc;
Window* mParent{nullptr};
};
}