25 m_wTarget = targetWidget;
26 m_OverlayComponent = overlayComponent;
32 override void HandlerDeattached(Widget w)
38 if (m_OverlayComponent)
40 if (m_OverlayComponent.m_wRoot)
41 GetGame().GetWorkspace().RemoveChild(m_OverlayComponent.m_wRoot);
57 protected bool m_bRenderTopMost =
false;
59 protected bool m_bShown =
true;
63 [
Attribute(defvalue:
"true", uiwidget: UIWidgets.CheckBox,
desc:
"The overlay is shown at start")]
66 [
Attribute(
"true", uiwidget: UIWidgets.CheckBox,
desc:
"Should background image be visible?")]
67 protected bool m_bShowBackground;
72 static SCR_LoadingOverlay ShowForWidget(Widget targetWidget,
string text =
string.Empty,
bool showBlur =
true,
bool showBackground =
true)
88 targetWidget.AddHandler(helper);
92 comp = helper.m_OverlayComponent;
93 overlayRoot = comp.m_wRoot;
104 if (!overlayRoot || !comp || !helper)
107 helper.Init(targetWidget, comp);
108 comp.Init(overlayRoot, helper);
111 comp.ShowBlur(showBlur);
112 comp.ShowBackground(showBackground);
122 static void HideForWidget(Widget targetWidget)
132 comp.HideAndDelete();
144 if (m_Helper.m_wTarget)
146 m_Helper.m_wTarget.RemoveHandler(m_Helper);
162 void SetShown(
bool show)
176 void SetText(
string text)
178 this.widgets.m_Text.SetText(text);
184 void ShowBackground(
bool show)
186 this.widgets.m_BackgroundImage.SetVisible(show);
192 void ShowBlur(
bool show)
194 this.widgets.m_Blur.SetVisible(show);
200 Widget GetRootWidget()
222 override void HandlerAttached(Widget w)
226 if (w.GetParent() ==
GetGame().GetWorkspace())
228 m_bRenderTopMost =
true;
235 this.SetShown(m_bShownAtStart);
236 ShowBackground(m_bShowBackground);
253 if (helper && m_bRenderTopMost)
256 if (helper.m_wTarget ==
GetGame().GetWorkspace())
260 GetGame().GetCallqueue().CallLater(SetSizeFromTarget, 0);
267 protected void SetSizeFromTarget()
272 if (!m_Helper.m_wTarget)
275 Widget targetWidget = m_Helper.m_wTarget;
277 float x, y, sizex, sizey;
278 targetWidget.GetScreenPos(x, y);
279 targetWidget.GetScreenSize(sizex, sizey);
281 WorkspaceWidget ww =
GetGame().GetWorkspace();
283 x = ww.DPIUnscale(x);
284 y = ww.DPIUnscale(y);
285 sizex = ww.DPIUnscale(sizex);
286 sizey = ww.DPIUnscale(sizey);
288 FrameSlot.SetPos(
m_wRoot, x, y);
289 FrameSlot.SetSize(
m_wRoot, sizex, sizey);
295 override bool OnUpdate(Widget w)
299 if (!m_bRenderTopMost)
302 if (!
m_wRoot || !m_Helper || !m_Helper.m_wTarget)
307 GetGame().GetCallqueue().CallLater(SetSizeFromTarget, 0);
316 override bool OnClick(Widget w,
int x,
int y,
int button)
320 override bool OnModalResult(Widget w,
int x,
int y,
int code,
int result) {
return true;}
321 override bool OnDoubleClick(Widget w,
int x,
int y,
int button) {
return true;}
322 override bool OnSelect(Widget w,
int x,
int y) {
return true;}
323 override bool OnItemSelected(Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn) {
return true;}
324 override bool OnFocus(Widget w,
int x,
int y) {
return true; }
325 override bool OnFocusLost(Widget w,
int x,
int y) {
return true; }
326 override bool OnMouseEnter(Widget w,
int x,
int y) {
return true;}
327 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y) {
return true;}
328 override bool OnMouseWheel(Widget w,
int x,
int y,
int wheel) {
return true;}
329 override bool OnMouseButtonDown(Widget w,
int x,
int y,
int button) {
return true;}
330 override bool OnMouseButtonUp(Widget w,
int x,
int y,
int button) {
return true;}
332 override bool OnController(Widget w,
int control,
int value) {
return true;}
333 override bool OnKeyDown(Widget w,
int x,
int y,
int key) {
return true;}
334 override bool OnKeyUp(Widget w,
int x,
int y,
int key) {
return true;}
335 override bool OnKeyPress(Widget w,
int x,
int y,
int key) {
return true;}
336 override bool OnChange(Widget w,
int x,
int y,
bool finished) {
return true;}
337 override bool OnResize(Widget w,
int x,
int y) {
return true;}
338 override bool OnEvent(EventType eventType, Widget target,
int parameter0,
int parameter1) {
return true;}
339 override bool OnModalClickOut(Widget modalRoot,
int x,
int y,
int button) {
return true;}