Beispiel #1
0
        /// <summary>
        /// Handles Windows Messages for the GUI
        /// </summary>
        /// <param name="m">The message to handle</param>
        /// <returns><c>true</c> if the message was handled and no further processing is necessary</returns>
        public bool OnMsgProc(Message m)
        {
            // Exclusive input handling for MessageBox
            if (DialogManager.MessageBox != null && DialogManager.MessageBox.Visible)
            {
                return(DialogManager.MessageBox.
                       MessageProc(m.HWnd, (WindowMessage)m.Msg, m.WParam, m.LParam));
            }

            // Exclusive input handling for last modal dialog
            if (_modalDialogs.Count > 0)
            {
                return(_modalDialogs[_modalDialogs.Count - 1].DialogRender.
                       MessageProc(m.HWnd, (WindowMessage)m.Msg, m.WParam, m.LParam));
            }

            // Copy dialog list to an array first to prevent exceptions if dialogs are removed
            var currentGuis = new DialogRenderer[_normalDialogs.Count];

            _normalDialogs.CopyTo(currentGuis, 0);

            // Pass input to dialogs for handling from last to first
            for (int i = currentGuis.Length - 1; i >= 0; i--)
            {
                if (currentGuis[i].DialogRender.MessageProc(m.HWnd, (WindowMessage)m.Msg, m.WParam, m.LParam))
                {
                    // Input has been handled, no further processing
                    return(true);
                }
            }

            // Input was not handled
            return(false);
        }
Beispiel #2
0
 /// <summary>
 /// Removes/closes an open <see cref="DialogRenderer"/>.
 /// </summary>
 /// <param name="dialog">The <see cref="DialogRenderer"/> to close.</param>
 internal void Remove(DialogRenderer dialog)
 {
     dialog.DialogRender.Refresh();
     dialog.Dispose();
     _normalDialogs.Remove(dialog);
     _modalDialogs.Remove(dialog);
 }
Beispiel #3
0
 /// <summary>
 /// Adds a modal <see cref="DialogRenderer"/> to the GUI system that locks all other <see cref="DialogRenderer"/>s while it is active.
 /// </summary>
 /// <param name="dialog">The <see cref="DialogRenderer"/> to add.</param>
 internal void AddModal(DialogRenderer dialog)
 {
     _modalDialogs.Add(dialog);
 }
Beispiel #4
0
        //--------------------//

        #region Open
        /// <summary>
        /// Adds a normal <see cref="DialogRenderer"/> to the GUI system that shares user-input with all other <see cref="DialogRenderer"/>s.
        /// </summary>
        /// <param name="dialog">The <see cref="DialogRenderer"/> to add.</param>
        internal void AddNormal(DialogRenderer dialog)
        {
            _normalDialogs.Add(dialog);
        }