|
|
@@ -33,41 +33,46 @@ using namespace tb;
|
|
|
namespace Atomic
|
|
|
{
|
|
|
|
|
|
- UIPopupWindow::UIPopupWindow(Context* context, UIWidget* target, const String& id) : UIWidget(context, false)
|
|
|
+UIPopupWindow::UIPopupWindow(Context* context, bool createWidget, UIWidget* target, const String& id) : UIWidget(context, false)
|
|
|
+{
|
|
|
+ if (createWidget)
|
|
|
{
|
|
|
+ //if we should create widget, then target shouldn't be null
|
|
|
+ assert(target);
|
|
|
widget_ = new TBPopupWindow(target->GetInternalWidget());
|
|
|
widget_->SetID(TBIDC(id.CString()));
|
|
|
widget_->SetDelegate(this);
|
|
|
GetSubsystem<UI>()->WrapWidget(this, widget_);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- UIPopupWindow::~UIPopupWindow()
|
|
|
- {
|
|
|
- }
|
|
|
+UIPopupWindow::~UIPopupWindow()
|
|
|
+{
|
|
|
+}
|
|
|
|
|
|
- void UIPopupWindow::Show(int x, int y)
|
|
|
+void UIPopupWindow::Show(int x, int y)
|
|
|
+{
|
|
|
+ if (x != -1 && y != -1)
|
|
|
{
|
|
|
- if (x != -1 && y != -1)
|
|
|
- {
|
|
|
- ((TBPopupWindow*)widget_)->Show(TBPopupAlignment(TBPoint(x, y)));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ((TBPopupWindow*)widget_)->Show(TBPopupAlignment());
|
|
|
- }
|
|
|
+ ((TBPopupWindow*)widget_)->Show(TBPopupAlignment(TBPoint(x, y)));
|
|
|
}
|
|
|
-
|
|
|
- bool UIPopupWindow::OnEvent(const tb::TBWidgetEvent &ev)
|
|
|
+ else
|
|
|
{
|
|
|
- return false;
|
|
|
+ ((TBPopupWindow*)widget_)->Show(TBPopupAlignment());
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- void UIPopupWindow::Close()
|
|
|
- {
|
|
|
- if (!widget_)
|
|
|
- return;
|
|
|
+bool UIPopupWindow::OnEvent(const tb::TBWidgetEvent &ev)
|
|
|
+{
|
|
|
+ return false;
|
|
|
+}
|
|
|
|
|
|
- ((TBPopupWindow*)widget_)->Close();
|
|
|
- }
|
|
|
+void UIPopupWindow::Close()
|
|
|
+{
|
|
|
+ if (!widget_)
|
|
|
+ return;
|
|
|
+
|
|
|
+ ((TBPopupWindow*)widget_)->Close();
|
|
|
+}
|
|
|
|
|
|
}
|