示例#1
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null);
                //g_application.m_guiWindowOSD.OnMessage(msg);	// Send an init msg to the OSD
                GUIGraphicsContext.Save();
                GUIGraphicsContext.Calibrating = false;
                // reset our screen resolution to what it was initially
                //GUIGraphicsContext.SetGUIResolution(g_stSettings.m_ScreenResolution);
                // Inform the player so we can update the resolution
                //if (g_application.m_pPlayer)
                //  g_application.m_pPlayer.Update();
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);
                m_iControl = (int)Controls.CONTROL_TOP_LEFT;
                m_iSpeed   = 1;
                m_iCountU  = 0;
                m_iCountD  = 0;
                m_iCountL  = 0;
                m_iCountR  = 0;
                GUIGraphicsContext.Calibrating = true;
                // Inform the player so we can update the resolution

                // disable the UI calibration for our controls...
                GUIImage pControl = (GUIImage)GetControl((int)Controls.CONTROL_BOTTOM_RIGHT);
                if (null != pControl)
                {
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_TOP_LEFT);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_SUBTITLES);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_PIXEL_RATIO);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_OSD);
                    pControl.CalibrationEnabled = false;
                    m_fPixelRatioBoxHeight      = (float)pControl.Height;
                }

                GUIMessage msg    = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null);
                GUIWindow  window = GUIWindowManager.GetWindow((int)Window.WINDOW_OSD);
                window.OnMessage(msg); // Send an init msg to the OSD
                return(true);
            }
            }
            return(base.OnMessage(message));
        }
示例#2
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                base.OnMessage(message);
                m_pParentWindow            = null;
                m_bRunning                 = false;
                GUIGraphicsContext.Overlay = m_bOverlay;
                //base.OnMessage(message);
                Dispose();
                DeInitControls();
                GUILayerManager.UnRegisterLayer(this);
                return(true);
            }

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                m_bDialogActive = true;
                base.OnMessage(message);
                GUIGraphicsContext.Overlay = base.IsOverlayAllowed;
                m_pParentWindow            = GUIWindowManager.GetWindow(m_dwParentWindowID);
                GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.Dialog);
            }
                return(true);

            case GUIMessage.MessageType.GUI_MSG_CLICKED:
            {
                int iAction  = message.Param1;
                int iControl = message.SenderControlId;
                if (btnCancel != null && iControl == (int)btnCancel.GetID)
                {
                    m_bCanceled = true;
                    if (!m_bBusy)
                    {
                        Close();
                    }
                }

                if (btnYes != null && iControl == (int)btnYes.GetID)
                {
                    if (!m_bBusy)
                    {
                        m_bBusy = true;
                        FileItemMC(m_itemSourceItem);
                        m_bBusy = false;
                        Close();
                    }
                    else
                    {
                        m_bButtonYes = true;
                    }
                }

                if (btnNo != null && iControl == (int)btnNo.GetID)
                {
                    m_bButtonNo = true;
                }

                if (btnAlways != null && iControl == (int)btnAlways.GetID)
                {
                    m_bAlways = true;
                }

                if (btnNever != null && iControl == (int)btnNever.GetID)
                {
                    m_bNever = true;
                }
            }
            break;
            }

            if (m_pParentWindow != null)
            {
                if (message.TargetWindowId == m_pParentWindow.GetID)
                {
                    return(m_pParentWindow.OnMessage(message));
                }
            }
            return(base.OnMessage(message));
        }
示例#3
0
        public override bool HitTest(int x, int y, out int controlID, out bool focused)
        {
            switch (_buttonState)
            {
            case NextButtonStates.Activation:
                if (Dimmed == false) // let us check if something changed by keyboard input
                {
                    _buttonState = NextButtonStates.Deaktivation;
                    focused      = !Dimmed;
                    controlID    = _defaultcontrol;
                    return(true);
                }
                if (_imageFocused.HitTest(x, y, out controlID, out focused))
                {
                    focused      = !Dimmed;
                    controlID    = _defaultcontrol;
                    _buttonState = NextButtonStates.Outside;
                    return(true);
                }
                return(false);

            case NextButtonStates.Outside:
                if (Dimmed == true) // let us check if something changed by keyboard input
                {
                    _buttonState = NextButtonStates.Activation;
                    focused      = !Dimmed;
                    controlID    = -1;
                    return(false);
                }
                if (!_imageFocused.HitTest(x, y, out controlID, out focused))
                {
                    _buttonState = NextButtonStates.Deaktivation;
                }
                break;

            case NextButtonStates.Deaktivation:
                if (Dimmed == true) // let us check if something changed by keyboard input
                {
                    _buttonState = NextButtonStates.Activation;
                    focused      = !Dimmed;
                    controlID    = -1;
                    return(false);
                }
                if (_imageFocused.HitTest(x, y, out controlID, out focused))
                {
                    GUIMessage msg;
                    if (_exitcontrol == -1)
                    {
                        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LOSTFOCUS, _windowId, 0, GetFocusControlId(), 0, 0,
                                             null);
                    }
                    else
                    {
                        msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, _windowId, 0, _exitcontrol, 0, 0, null);
                    }
                    GUIWindow win = GUIWindowManager.GetWindow(_windowId);
                    if (win != null)
                    {
                        win.OnMessage(msg);
                    }
                    controlID    = -1;
                    _buttonState = NextButtonStates.Outside2;
                    return(false);
                }
                break;

            case NextButtonStates.Outside2:
                if (Dimmed == false) // let us check if something changed by keyboard input
                {
                    _buttonState = NextButtonStates.Deaktivation;
                    focused      = !Dimmed;
                    controlID    = _defaultcontrol;
                    return(true);
                }
                if (!_imageFocused.HitTest(x, y, out controlID, out focused))
                {
                    _buttonState = NextButtonStates.Activation;
                }
                return(false);
            }
            if (base.HitTest(x, y, out controlID, out focused))
            {
                return(true);
            }

            int posX   = Math.Min(_buttonX, _positionX);
            int posY   = Math.Min(_buttonY, _positionY);
            int width  = Math.Max(_buttonWidth, _width);
            int height = Math.Max(_buttonHeight, _height);

            focused   = !Dimmed;
            controlID = GetFocusControlId();

            if (controlID == -1)
            {
                controlID = _defaultcontrol;
            }
            if ((x >= posX) && (x <= posX + width) && (y >= posY) && (y <= posY + height))
            {
                return(true);
            }
            return(false);
        }