Initial popup window.
This commit is contained in:
parent
f16dd7c0d9
commit
70220fc6e9
22 changed files with 253 additions and 15 deletions
|
@ -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};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue