internal static IDisposable RegisterOpenPopup(IPopup popup) { var weakPopup = new WeakReference <IPopup>(popup); _openPopups.AddDistinct(weakPopup); return(Disposable.Create(() => _openPopups.Remove(weakPopup))); }
public LayoutDropDown(ActionDispatcher dispatcher, WebDropDownAction action, WebIconSize iconSize) { InitializeComponent(); _iconSize = iconSize; _actionDispatcher = dispatcher; _actionItem = action; _popup = new LayoutPopup(dispatcher, action.DropDownActions).AsSingleton(); dispatcher.Register(_actionItem.Identifier, this); SetIcon(); ToolTipService.SetToolTip(LayoutDropDownButton, _actionItem.ToolTip); ButtonComponent.Click += OnDropClick; LayoutDropDownButton.MouseEnter += ButtonComponent_MouseEnter; LayoutDropDownButton.MouseLeave += ButtonComponent_MouseLeave; Visibility = _actionItem.DesiredVisiblility; ButtonComponent.IsEnabled = _actionItem.Enabled; IndicateChecked(false); //This button doesn't have a checked state. }
public static void Add(IPopup aPopup) { lock (iLock) { iCount++; } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); if (_popup is PopupBase oldPopup) { oldPopup.CustomLayouter = null; } _popup = this.GetTemplateChild("Popup") as IPopup; _popupBorder = this.GetTemplateChild("PopupBorder") as Border; _contentPresenter = this.GetTemplateChild("ContentPresenter") as ContentPresenter; if (_popup is PopupBase popup) { popup.CustomLayouter = new DropDownLayouter(this, popup); popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayMode)); popup.BindToEquivalentProperty(this, nameof(LightDismissOverlayBackground)); } UpdateHeaderVisibility(); UpdateContentPresenter(); if (_contentPresenter != null) { _contentPresenter.SetBinding( ContentPresenter.ContentTemplateProperty, new Binding(new PropertyPath("ItemTemplate"), null) { RelativeSource = RelativeSource.TemplatedParent }); _contentPresenter.SetBinding( ContentPresenter.ContentTemplateSelectorProperty, new Binding(new PropertyPath("ItemTemplateSelector"), null) { RelativeSource = RelativeSource.TemplatedParent }); _contentPresenter.DataContextChanged += (snd, evt) => { // The ContentPresenter will automatically clear its local DataContext // on first load. // // When there's no selection, this will cause this ContentPresenter to // received the same DataContext as the ComboBox itself, which could // lead to strange result or errors. // // See comments in ContentPresenter.ResetDataContextOnFirstLoad() method. // Fixed in this PR: https://github.com/unoplatform/uno/pull/1465 if (evt.NewValue != null && SelectedItem == null) { _contentPresenter.DataContext = null; // Remove problematic inherited DataContext } }; UpdateCommonStates(); } }
public static void Remove(IPopup aPopup) { lock (iLock) { iCount--; } }
/// <summary> /// Requests an image based Engagement for popping up on screen. This is a convience around RequestEngagement /// that loads the image resource automatically from the original engage request. Register a function with the /// Popup's AfterLoad event to be notified when the image has be been downloaded from our server. /// </summary> /// <param name="decisionPoint">The decision point the request is for, must match the string in Portal.</param> /// <param name="engageParams">Additional parameters for the engagement.</param> /// <param name="popup">A Popup object to display the image.</param> public void RequestImageMessage( string decisionPoint, Dictionary <string, object> engageParams, IPopup popup) { this.RequestImageMessage(decisionPoint, engageParams, popup, null); }
public DropDownButton(ActionDispatcher dispatcher, WebDropDownButtonAction action, WebIconSize iconSize) { InitializeComponent(); _iconSize = iconSize; _actionDispatcher = dispatcher; _actionItem = action; dispatcher.Register(_actionItem.Identifier, this); SetIcon(); ToolTipService.SetToolTip(StackPanelVerticalComponent, _actionItem.ToolTip); ButtonComponent.Click += OnClick; DropButtonComponent.Height = ButtonComponent.Height; DropButtonComponent.Click += OnDropClick; _dropMenu = MenuBuilder.BuildContextMenu(action, _actionDispatcher); StackPanelVerticalComponent.MouseEnter += ButtonComponent_MouseEnter; StackPanelVerticalComponent.MouseLeave += ButtonComponent_MouseLeave; Visibility = _actionItem.DesiredVisiblility; ButtonComponent.IsEnabled = _actionItem.Enabled; DropButtonComponent.IsEnabled = _actionItem.Enabled; IndicateChecked(_actionItem.IsCheckAction && _actionItem.Checked); OverlayCheckedIndicator.Opacity = _actionItem.IconSet.HasOverlay ? 1 : 0; }
public DropDownButton(ActionDispatcher dispatcher, WebDropDownButtonAction action, WebIconSize iconSize) { InitializeComponent(); _iconSize = iconSize; _actionDispatcher = dispatcher; _actionItem = action; dispatcher.Register(_actionItem.Identifier, this); SetIcon(); ToolTipService.SetToolTip(StackPanelVerticalComponent, _actionItem.ToolTip); ButtonComponent.Click += OnClick; DropButtonComponent.Height = ButtonComponent.Height; DropButtonComponent.Click += OnDropClick; _dropMenu = MenuBuilder.BuildContextMenu(action, _actionDispatcher); StackPanelVerticalComponent.MouseEnter += ButtonComponent_MouseEnter; StackPanelVerticalComponent.MouseLeave += ButtonComponent_MouseLeave; Visibility = _actionItem.DesiredVisiblility; ButtonComponent.IsEnabled = _actionItem.Enabled; DropButtonComponent.IsEnabled = _actionItem.Enabled; IndicateChecked(_actionItem.IsCheckAction && _actionItem.Checked); OverlayCheckedIndicator.Opacity = _actionItem.IconSet.HasOverlay ? 1 : 0; }
public static void Dispose(this IPopup popup) { if (popup is IDisposable) { ((IDisposable)popup).Dispose(); } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (_actionDispatcher != null) { _actionDispatcher.Remove(_actionItem.Identifier); _actionDispatcher = null; } StackPanelVerticalComponent.MouseEnter -= ButtonComponent_MouseEnter; StackPanelVerticalComponent.MouseLeave -= ButtonComponent_MouseLeave; ButtonComponent.Click -= OnClick; DropButtonComponent.Click -= OnDropClick; if (_dropMenu != null) { if (disposing) { _dropMenu.Dispose(); } _dropMenu = null; } _disposed = true; } }
//######################################################## // set interfaces //######################################################## private void SetInterfaces() { if (popup == null) { popup = PopupManager.Instance; } }
public LayoutDropDown(ActionDispatcher dispatcher, WebDropDownAction action, WebIconSize iconSize) { InitializeComponent(); _iconSize = iconSize; _actionDispatcher = dispatcher; _actionItem = action; _popup = new LayoutPopup(dispatcher, action.DropDownActions).AsSingleton(); dispatcher.Register(_actionItem.Identifier, this); SetIcon(); ToolTipService.SetToolTip(LayoutDropDownButton, _actionItem.ToolTip); ButtonComponent.Click += OnDropClick; LayoutDropDownButton.MouseEnter += ButtonComponent_MouseEnter; LayoutDropDownButton.MouseLeave += ButtonComponent_MouseLeave; Visibility = _actionItem.DesiredVisiblility; ButtonComponent.IsEnabled = _actionItem.Enabled; IndicateChecked(false); //This button doesn't have a checked state. }
public void Destroy() { _destroyed = true; if (_eventMediator != null) { _eventMediator.UnregisterEventHandler(ServerEntity.Identifier); _eventMediator.TileHasCaptureChanged -= EventBrokerTileHasCaptureChanged; _eventMediator = null; } if (_menu != null) { _menu.Dispose(); _menu = null; } if (_fpsPublisher != null) { _fpsPublisher.Dispose(); _fpsPublisher = null; } StopMouseMoveTimer(); }
public PopupWrapper(IPopup popup) { _popup = popup; AttachEvents(); SyncWrapper(); }
public void Handle(ShowPopupEvent message) { object vm = null; switch (message.PopupType) { case PopupType.ClosingPopup: vm = IoC.Get <ClosingPopupViewModel>(); break; case PopupType.GameOverPopup: vm = IoC.Get <GameOverPopupViewModel>(); break; case PopupType.CountdownPopup: vm = IoC.Get <CountdownPopupViewModel>(); break; case PopupType.ButtonsPopup: vm = IoC.Get <ButtonsPopupViewModel>(); break; } if (vm != null) { if (message.PopupSettings != null) { message.PopupSettings(vm); } PopupItem = vm as IPopup; PopupItem.IsShowing = true; } }
public PopupPresenter(IPopup IPop) { if (IPop != null) { IPopupObj = IPop; } }
private ToolStrip GetChildToolMenu(IPopup childMenuSettings, MergeAction mergeAction) { ToolStrip toolStrip1 = new System.Windows.Forms.ToolStrip(); toolStrip1.RenderMode = ToolStripRenderMode.Professional; toolStrip1.CanOverflow = false; toolStrip1.Font = new System.Drawing.Font("Tahoma", 8, FontStyle.Regular); toolStrip1.GripStyle = ToolStripGripStyle.Visible; // перемещение toolStrip1.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow; toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32); toolStrip1.BackColor = System.Drawing.SystemColors.ActiveBorder; toolStrip1.Name = childMenuSettings.tittle; toolStrip1.AllowMerge = true; for (int i = 0; i < childMenuSettings.items.Count; i++) { ToolStripButton toolStripButton = new ToolStripButton(); toolStripButton.ImageScaling = ToolStripItemImageScaling.SizeToFit; toolStripButton.Image = childMenuSettings.items[i].image; toolStripButton.AutoSize = true; toolStripButton.ToolTipText = childMenuSettings.items[i].tittle; toolStripButton.Margin = new Padding(1, 1, 1, 3); toolStripButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128))))); toolStripButton.MergeAction = mergeAction; toolStripButton.Tag = childMenuSettings.items[i]; toolStripButton.Click += (t, e) => { IItem button = ((t as ToolStripButton).Tag) as IItem; button.sendClickItem(); }; toolStripButton.Name = childMenuSettings.tittle + i.ToString(); toolStrip1.Items.Add(toolStripButton); } return toolStrip1; }
public static void SwitchBackToParent(this IPopup popup, WaitForPopupToClose waitForClose = WaitForPopupToClose.No) { PopUpWindow.SwitchTo(ParentWindowTitles[popup]); if (waitForClose == WaitForPopupToClose.Yes) { Wait.Until(d => !popup.IsDisplayed()); } }
private static void OnPopupOpened(object sender, EventArgs e) { ActivePopup = (IPopup)sender; if (PopupOpened != null) { PopupOpened(sender, e); } }
private static void OnPopupClosed(object sender, EventArgs e) { var popup = (IPopup)sender; if (ReferenceEquals(_activePopup, popup)) { ActivePopup = null; if (PopupClosed != null) PopupClosed(sender, e); } }
public void Open(IPopup target) { Debug.Assert(target != null); if (target.DoOpen() == false) { return; } stack.Push(target); }
public void Close(IPopup target) { Debug.Assert(target != null); if (stack.Peek() != target) { Debug.LogError("Invalid order of close popup.\nCurrent stack : " + stack.Join()); } CloseLastPopup(); }
public override void ClosePopup(IPopup popup) { if (!(bool)Manager.Bars[0].Tag) { Manager.Bars[0].Tag = true; return; } base.ClosePopup(popup); }
public static void SwitchTo(this IPopup popup, bool partialMatch = false) { ParentWindowTitles[popup] = Web.PortalDriver.Title; if (partialMatch) { PopUpWindow.SwitchTo(popup.Title, true); } else { PopUpWindow.SwitchTo(popup.Title); } }
private static void OnPopupClosed(object sender, EventArgs e) { var popup = (IPopup)sender; if (ReferenceEquals(_activePopup, popup)) { ActivePopup = null; if (PopupClosed != null) { PopupClosed(sender, e); } } }
public static void DisablePopup(IPopup popup) { var disabledPopups = EditorPrefs.GetString(EditorConstants.DisabledPopupsEditorPrefsKey, ""); if (!string.IsNullOrEmpty(disabledPopups)) { disabledPopups += ","; } disabledPopups += popup.Id; EditorPrefs.SetString(EditorConstants.DisabledPopupsEditorPrefsKey, disabledPopups); }
public void ImageOperation(string tsmi) { ImageData newData; IOperation OPERATION = PROGRAM.GiveOperation(tsmi); if (OPERATION == null) { return; } string decision = OPERATION.AskIfPopup(); // ---------------------------------------------------------- if (decision == null) { return; } else if (decision == "NONE") { try { newData = OPERATION.GetResult(this); if (newData == null) { return; } DataOperation(newData, tsmi); } catch { imageWindow.ReloadImageData_All(data.LastData()); imageWindow.ReloadModificationsList(data.modifications); imageWindow.CloseProgressBar(); return; } } else { IPopup popup = PROGRAM.Build_PopupWindow(decision); if (popup == null) { return; } //string operationName = PROGRAM.GiveOperationName(tsmi); popupList.Add(popup); popup.Start(PROGRAM, this, OPERATION, tsmi); } imageWindow.CloseProgressBar(); }
public LineEditor(IView window, IPopup completionPane, string name, int histsize) { this.window = window; _completionPane = completionPane; handlers = new Handler[] { new Handler(ConsoleKey.Home, CmdHome), new Handler(ConsoleKey.End, CmdEnd), new Handler(ConsoleKey.LeftArrow, CmdLeft), new Handler(ConsoleKey.RightArrow, CmdRight), new Handler(ConsoleKey.UpArrow, CmdHistoryPrev), new Handler(ConsoleKey.DownArrow, CmdHistoryNext), new Handler(ConsoleKey.Enter, CmdDone), new Handler(ConsoleKey.Backspace, CmdBackspace), new Handler(ConsoleKey.Delete, CmdDeleteChar), new Handler(ConsoleKey.Tab, CmdTabOrComplete), // Emacs keys Handler.Control('A', CmdHome), Handler.Control('E', CmdEnd), Handler.Control('B', CmdLeft), Handler.Control('F', CmdRight), Handler.Control('P', CmdHistoryPrev), Handler.Control('N', CmdHistoryNext), Handler.Control('K', CmdKillToEOF), Handler.Control('Y', CmdYank), Handler.Control('D', CmdDeleteChar), Handler.Control('L', CmdRefresh), Handler.Control('R', CmdReverseSearch), Handler.Control('G', delegate {}), Handler.Alt('B', ConsoleKey.B, CmdBackwardWord), Handler.Alt('F', ConsoleKey.F, CmdForwardWord), Handler.Alt('D', ConsoleKey.D, CmdDeleteWord), Handler.Alt((char)8, ConsoleKey.Backspace, CmdDeleteBackword), // DEBUG //Handler.Control ('T', CmdDebug), // quote Handler.Control('Q', () => HandleChar(window.ReadKey().KeyChar)) }; rendered_text = new StringBuilder(); text = new StringBuilder(); history = new History(window, name, histsize); //if (File.Exists ("log"))File.Delete ("log"); //log = File.CreateText ("log"); }
public static void Open(IPopup popup) { CloseLastPopup(); var window = ScriptableObject.CreateInstance <PopupWindow>(); var size = new Vector2(600, 330); window.minSize = size; window.maxSize = size; window.titleContent = new GUIContent($"Edgar - {popup.Title}"); window.popup = popup; window.ShowUtility(); LastWindow = window; }
protected override void PressLinkCore(BarItemLink link, bool isArrow) { for (int n = OpenedPopups.Count - 1; n >= 0; n--) { IPopup popup = OpenedPopups[n] as IPopup; if (popup.ContainsLink(link)) { for (int i = 0; i < Manager.Ribbon.MiniToolbars.Count; i++) { Manager.Ribbon.MiniToolbars[i].Hide(); } } } base.PressLinkCore(link, isArrow); }
public Chart(ICanvas canvas, ICanvas drawMargin, IPopup tooltipContainer) { _canvas = canvas; _drawMargin = drawMargin; _tooltipContainer = tooltipContainer; _canvas.AddChildren(_drawMargin); MinHeightProperty = 50; MinWidthProperty = 80; AnimationsSpeedProperty = TimeSpan.FromMilliseconds(300); TooltipTimeoutProperty = TimeSpan.FromMilliseconds(800); AxisXProperty = new AxesCollection(); }
public void Init(IPopup popup, Dictionary <string, object> config, int depth) { _popup = popup; _depth = depth; object mask; if (config.TryGetValue("mask", out mask)) { bool show = true; Color32[] colours = new Color32[1]; switch ((string)mask) { case "dimmed": { colours[0] = new Color32(0, 0, 0, _dimmedMaskAlpha); break; } case "clear": { colours[0] = new Color32(0, 0, 0, 0); break; } default: { // "none" show = false; break; } } if (show) { _texture = new Texture2D(1, 1); _texture.SetPixels32(colours); _texture.Apply(); } } object actionObj; if (config.TryGetValue("action", out actionObj)) { RegisterAction((Dictionary <string, object>)actionObj, "shim"); } else { RegisterAction(); } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _popup = this.GetTemplateChild("Popup") as IPopup; _popupBorder = this.GetTemplateChild("PopupBorder") as Border; _background = this.GetTemplateChild("Background") as FrameworkElement; _contentPresenter = this.GetTemplateChild("ContentPresenter") as ContentPresenter; if (_background == null) { this.Log().Warn("ComboBox.Template is missing a 'Background' element. To ensure proper dropdown popup positionning, make sure the ControlTemplate contains a FrameworkElement named 'Background'."); } UpdateHeaderVisibility(); UpdateContentPresenter(); }
public void OnDispose() { mPackageKitWindow = null; mSplitView = null; mDisposableList.Dispose(); mDisposableList = null; mCategoriesSelectorView = null; mLeftLayout.Dispose(); mLeftLayout = null; mRightLayout.Dispose(); mRightLayout = null; mMarkdownViewer = null; }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (_actionDispatcher != null) { _actionDispatcher.Remove(_actionItem.Identifier); _actionDispatcher = null; } LayoutDropDownButton.MouseEnter -= ButtonComponent_MouseEnter; LayoutDropDownButton.MouseLeave -= ButtonComponent_MouseLeave; ButtonComponent.Click -= OnDropClick; _popup.Dispose(); _popup = null; _disposed = true; } }
public void Update(PropertyChangedEvent e) { if (e.PropertyName.Equals("Available")) { _actionItem.Visible = (bool)e.Value; Visibility = _actionItem.DesiredVisiblility; } else if (e.PropertyName.Equals("Visible")) { _actionItem.Visible = (bool)e.Value; Visibility = _actionItem.DesiredVisiblility; } else if (e.PropertyName.Equals("Enabled")) { _actionItem.Enabled = (bool)e.Value; ButtonComponent.IsEnabled = _actionItem.Enabled; DropButtonComponent.IsEnabled = _actionItem.Enabled; if (_actionItem.Checked && !_actionItem.Enabled) { CheckedIndicator.Opacity = 0.25; if (_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 0.25; } else if (_actionItem.Checked) { CheckedIndicator.Opacity = 1; if (_actionItem.IconSet.HasOverlay) OverlayCheckedIndicator.Opacity = 1; } else IndicateChecked(false); } else if (e.PropertyName.Equals("IconSet")) { _actionItem.IconSet = e.Value as WebIconSet; SetIcon(); } else if (e.PropertyName.Equals("ToolTip")) { _actionItem.ToolTip = e.Value as string; ToolTipService.SetToolTip(StackPanelVerticalComponent, _actionItem.ToolTip); } else if (e.PropertyName.Equals("Label")) { _actionItem.Label = e.Value as string; } else if (e.PropertyName.Equals("Checked")) { _actionItem.Checked = (bool)e.Value; IndicateChecked(_actionItem.Checked); } else if (e.PropertyName.Equals("DropDownActions")) { _actionItem.DropDownActions = e.Value as Collection<WebActionNode>; _dropMenu.Dispose(); _dropMenu = MenuBuilder.BuildContextMenu(_actionItem, _actionDispatcher); } UpdateLayout(); }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (_actionDispatcher != null) { _actionDispatcher.Remove(_actionItem.Identifier); _actionDispatcher = null; } StackPanelVerticalComponent.MouseEnter -= ButtonComponent_MouseEnter; StackPanelVerticalComponent.MouseLeave -= ButtonComponent_MouseLeave; ButtonComponent.Click -= OnClick; DropButtonComponent.Click -= OnDropClick; if (_dropMenu != null) { if (disposing) _dropMenu.Dispose(); _dropMenu = null; } _disposed = true; } }
private float originalCameraSize; //used for animating #endregion #region Init public void Initialize() { myPopup = this as IPopup; //parse out the clone name string newName = gameObject.name; gameObject.name = StringExtensions.ParseOutClone(ref newName); background.Start(); //resize it before we call preinit so we know we have correct size myPopup.PreInit(); myCam = GetComponent(typeof(Camera)) as Camera; originalCameraSize = myCam.orthographicSize; //pause game if (shouldPauseGame == true) Time.timeScale = 0.0f; if (openSound != null) SoundManager.PlaySoundOnce(openSound); if (cancelButton != null) { cancelButton.ResizeAndReposition(cancelButton);cancelButton.Start(); if (cancelButton.spriteText != null) { cancelButton.spriteText.multiline = false; cancelButton.spriteText.maxWidth = cancelButton.width - (cancelButton.width * GameValues.buttonTextPaddingPercentage); } } if (shouldAnimate) myCam.orthographicSize *= 5; popupManager = PopupManager.I; if (popupManager == null) { Kill(); return; } uiManager = UIManager.instance; if (uiManager != null) { //save all old cameras then delete from UIManager. Otherwise objects behind will still detect input originalCameraSettings = uiManager.uiCameras; for (int x = uiManager.uiCameras.Length -1; x >= 0; x--) { uiManager.RemoveCamera(x); } uiManager.AddCamera(myCam, myCam.cullingMask, Mathf.Infinity, 0); originalRayCam = uiManager.rayCamera; uiManager.rayCamera = myCam; } else { Kill(); return; } popupManager.activePopups.Add(myPopup); myCam.depth = popupManager.activePopups.Count + 1; if (shouldAnimate) { //called right before animation myPopup.PreAnimate(); HOTween.defUpdateType = UpdateType.TimeScaleIndependentUpdate; Sequence s = new Sequence(); //s.Append(HOTween.To(myCam, 1.2f, "orthographicSize", originalCameraSize)); s.Append(HOTween.To(myCam, 0.3f, new TweenParms() .UpdateType(UpdateType.TimeScaleIndependentUpdate) .Prop("orthographicSize", originalCameraSize) .Ease(EaseType.EaseInBounce) )); s.ApplyCallback(CallbackType.OnComplete, AnimationComplete); s.Play(); } else { AddCancelButtonDelegate(); myPopup.InitComplete(); } }
public void Init(IPopup popup, Dictionary<string, object> layout, Texture texture, int depth) { _popup = popup; _texture = texture; _depth = depth; object backgroundObj; if (layout.TryGetValue("background", out backgroundObj)) { var background = backgroundObj as Dictionary<string, object>; object actionObj; if ((background).TryGetValue("action", out actionObj)) { RegisterAction((Dictionary<string, object>)actionObj, "background"); } else { RegisterAction(); } object rulesObj; if (background.TryGetValue("cover", out rulesObj)) { _position = RenderAsCover((Dictionary<string, object>)rulesObj); } else if (background.TryGetValue("contain", out rulesObj)) { _position = RenderAsContain((Dictionary<string, object>)rulesObj); } else { Logger.LogError("Invalid layout"); } } else { RegisterAction(); } }
public void AfterOpenPopup(IMenu popupOwner, IPopup popup) { Owner = popupOwner; Popup = popup; AfterOpenPopup(); }
private void InitializePopup(FrameworkElement newPopup) { if (ReferenceEquals(newPopup, _tPopup)) return; if (_tPopup != null) { _tPopup.Opened -= OnPopupOpened; _tPopup.Closed -= OnPopupClosed; } _tPopup = newPopup.AsPopup(); if (_tPopup != null) { _tPopup.Opened += OnPopupOpened; _tPopup.Closed += OnPopupClosed; } }
internal static void RegisterSingletonPopup(IPopup popup) { popup.Opened += OnPopupOpened; popup.Closed += OnPopupClosed; }
public void addChildMenu(IPopup childMenuSettings) { ToolStrip childToolMenu = GetChildToolMenu(childMenuSettings, MergeAction.Append); ToolStripManager.Merge(childToolMenu, mainToolStrip); }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (_actionDispatcher != null) { _actionDispatcher.Remove(_actionItem.Identifier); _actionDispatcher = null; } LayoutDropDownButton.MouseEnter -= ButtonComponent_MouseEnter; LayoutDropDownButton.MouseLeave -= ButtonComponent_MouseLeave; ButtonComponent.Click -= OnDropClick; _popup.Dispose(); _popup = null; _disposed = true; } }
private static void OnPopupOpened(object sender, EventArgs e) { ActivePopup = (IPopup)sender; if (PopupOpened != null) PopupOpened(sender, e); }
public PopupProxy(IPopup popup) { RealPopup = popup; }
public void Init(IPopup popup, Dictionary<string, object> orientation, List<Texture> textures, BackgroundLayer content, int depth) { _popup = popup; _depth = depth; object buttonsObj; if (orientation.TryGetValue("buttons", out buttonsObj)) { var buttons = buttonsObj as List<object>; for (int i = 0; i < buttons.Count; ++i) { var button = buttons[i] as Dictionary<string, object>; float left = 0, top = 0; object x, y; if (button.TryGetValue("x", out x)) { left = (int)((long)x) * content.Scale + content.Position.xMin; } if (button.TryGetValue("y", out y)) { top = (int)((long)y) * content.Scale + content.Position.yMin; } _positions.Add(new Rect(left, top, textures[i].width * content.Scale, textures[i].height * content.Scale)); object actionObj; if (button.TryGetValue("action", out actionObj)) { RegisterAction((Dictionary<string, object>)actionObj, "button"+(i+1)); } else { RegisterAction(); } } _textures = textures; } }
public void Init(IPopup popup, Dictionary<string, object> config, int depth) { _popup = popup; _depth = depth; object mask; if (config.TryGetValue("mask", out mask)) { bool show = true; Color32[] colours = new Color32[1]; switch ((string)mask) { case "dimmed": { colours[0] = new Color32(0, 0, 0, _dimmedMaskAlpha); break; } case "clear": { colours[0] = new Color32(0, 0, 0, 0); break; } default: { // "none" show = false; break; } } if (show) { _texture = new Texture2D(1, 1); _texture.SetPixels32(colours); _texture.Apply(); } } object actionObj; if (config.TryGetValue("action", out actionObj)) { RegisterAction((Dictionary<string, object>)actionObj, "shim"); } else { RegisterAction(); } }
public void BeforeOpenPopup(IMenu popupOwner, IPopup popup) { Owner = popupOwner; Popup = popup; BeforeOpenPopup(); }