Ejemplo n.º 1
0
 /// <summary>
 ///  Метод-callback для кнопки "опции"
 /// </summary>
 void OptionsButton_Click(object sender, RoutedEventArgs e)
 {
     if (ButtonFlag == ButtonFlags.LogIn)
     {
         ButtonFlag = ButtonFlags.Options;
         String[] str = MTSystem.LoadConnectionData();
         spRememberMe.Visibility = Visibility.Hidden;
         LogBox.Text             = str[0];
         PassBox.Text            = str[1];
         loginLabel.Text         = "Название БД";
         passLabel.Text          = "IP-адрес";
         LogButton.Content       = "Принять";
         OptionsButton.Content   = "Закрыть";
     }
     else
     {
         spRememberMe.Visibility = Visibility.Visible;
         ButtonFlag            = ButtonFlags.LogIn;
         LogBox.Text           = "";
         PassBox.Text          = "";
         loginLabel.Text       = "Логин";
         passLabel.Text        = "Пароль";
         LogButton.Content     = "Войти";
         OptionsButton.Content = "Опции";
     }
 }
Ejemplo n.º 2
0
        private static ButtonFlags ButtonsToFlags(MouseState state)
        {
            ButtonFlags flags = 0;

            if (state.LeftButton == ButtonState.Pressed)
            {
                flags |= ButtonFlags.LeftButton;
            }
            if (state.MiddleButton == ButtonState.Pressed)
            {
                flags |= ButtonFlags.MiddleButton;
            }
            if (state.RightButton == ButtonState.Pressed)
            {
                flags |= ButtonFlags.RightButton;
            }
            if (state.XButton1 == ButtonState.Pressed)
            {
                flags |= ButtonFlags.XButton1;
            }
            if (state.XButton2 == ButtonState.Pressed)
            {
                flags |= ButtonFlags.XButton2;
            }

            return(flags);
        }
Ejemplo n.º 3
0
        public static bool selectable(String label, ref bool selected, Vector2 sizeArg, SelectableFlags flags = 0)
        {
            Window win = currentWindow;

            if (win.skipItems == true)
            {
                return(false);
            }

            UInt32  id        = win.getChildId(label);
            Vector2 labelSize = style.textSize(label);
            Vector2 size      = new Vector2(sizeArg.X != 0 ? sizeArg.X : labelSize.X, sizeArg.Y != 0 ? sizeArg.Y : labelSize.Y);
            Vector2 rectPos   = win.cursorScreenPosition + style.framePadding;
            Rect    r         = Rect.fromPosSize(rectPos, size);

            if (flags.HasFlag(SelectableFlags.HasToggle) == false) //only move the draw cursor after the toggle is drawn
            {
                win.addItem(size);
            }

            bool        hovered;
            bool        held;
            ButtonFlags buttonFlags = 0;

            if (flags.HasFlag(SelectableFlags.Menu))
            {
                buttonFlags |= ButtonFlags.PressedOnClick;
            }
            if (flags.HasFlag(SelectableFlags.MenuItem))
            {
                buttonFlags |= ButtonFlags.PressedOnClick | ButtonFlags.PressedOnRelease;
            }
            if (flags.HasFlag(SelectableFlags.Disabled))
            {
                buttonFlags |= ButtonFlags.Disabled;
            }

            bool pressed = buttonBehavior(r, id, out hovered, out held, buttonFlags);

            if (hovered)
            {
                Color4 col = style.getColor((hovered == true ? ElementColor.HeaderHovered : ElementColor.Header));
                win.canvas.addRectFilled(r, col);
            }

            win.canvas.addText(r, style.getColor(ElementColor.Text), label, Alignment.Default);

            //close popups
            if (pressed && flags.HasFlag(SelectableFlags.DontClosePopups) == false && win.flags.HasFlag(Window.Flags.Popup))
            {
                closeCurrentPopup();
            }

            if (pressed)
            {
                selected = !selected;
            }

            return(pressed);
        }
Ejemplo n.º 4
0
 private void OnEnableButtons(ButtonFlags buttonFlags)
 {
     if (EnableButtons != null)
     {
         EnableButtons(this, buttonFlags);
     }
 }
Ejemplo n.º 5
0
        public static bool selectable(String label, ref bool selected, Vector2 sizeArg, SelectableFlags flags = 0)
        {
            Window win = currentWindow;

            if (win.skipItems == true)
            {
                return(false);
            }

            win.addItem(style.selectable.padding);

            UInt32  id        = win.getChildId(label);
            Vector2 labelSize = style.font.size(label);
            Vector2 size      = new Vector2(sizeArg.X != 0 ? sizeArg.X : labelSize.X, sizeArg.Y != 0 ? sizeArg.Y : labelSize.Y);
            Rect    r         = Rect.fromPosSize(win.cursorScreenPosition, size);

            bool        hovered;
            bool        held;
            ButtonFlags buttonFlags = 0;

            if (flags.HasFlag(SelectableFlags.Menu))
            {
                buttonFlags |= ButtonFlags.PressedOnClick;
            }
            if (flags.HasFlag(SelectableFlags.MenuItem))
            {
                buttonFlags |= ButtonFlags.PressedOnClick | ButtonFlags.PressedOnRelease;
            }
            if (flags.HasFlag(SelectableFlags.Disabled))
            {
                buttonFlags |= ButtonFlags.Disabled;
            }

            bool pressed = buttonBehavior(r, id, out hovered, out held, buttonFlags);

            if (hovered)
            {
                Color4 col = style.selectable.textHoverActive;
                win.canvas.addRectFilled(r, col);
            }

            win.canvas.addText(r, style.selectable.textNormal, label, style.selectable.textAlignment);

            //close popups
            if (pressed && flags.HasFlag(SelectableFlags.DontClosePopups) == false && win.flags.HasFlag(Window.Flags.Popup))
            {
                closeCurrentPopup();
            }

            if (pressed)
            {
                selected = !selected;
            }


            win.addItem(size);

            return(pressed);
        }
Ejemplo n.º 6
0
 /*! \brief Specify a toolbox object to be shown when the user clicks Select and/or
  * Adjust on the %Iconbar icon.
  * \param [in] flags Bits 0 and 1 indicate which buttons to set objects for.
  * \param [in] selectClickShow The object to be shown if Select is clicked (if bit 0 set
  * in flags - ButtonFlags.Select).
  * \param [in] adjustClickShow The object to be shown if Adjust is clicked (if bit 1 set
  * in flags - ButtonFlags.Adjust).
  * \note Set to null to prevent any object from being shown.
  * \note The \e SelectClickShow and \e AdjustClickShow properties can be used for
  * the same purpose.  */
 public void SetShow(ButtonFlags flags, Toolbox.Object selectClickShow,
                     Toolbox.Object adjustClickShow)
 {
     MiscOp_SetR3R4((uint)flags,
                    Method.SetShow,
                    (selectClickShow != null) ? selectClickShow.ID : 0,
                    (adjustClickShow != null) ? adjustClickShow.ID : 0);
 }
Ejemplo n.º 7
0
 /*! \brief Return the toolbox event to be raised when the user clicks Select and/or
  * Adjust on the %Iconbar icon.
  * \param [in] flags Bits 0 and 1 indicate which buttons to return events for.
  * \param [out] selectEventCode The event to be raised if Select is clicked (if bit 0 set
  * in flags - ButtonFlags.Select).
  * \param [out] adjustEventCode The event to be raised if Adjust is clicked (if bit 1 set
  * in flags - ButtonFlags.Adjust).
  * \note The \e SelectClickEvent and \e AdjustClickEvent properties can be used for
  * the same purpose.  */
 public void GetEvent(ButtonFlags flags, out uint selectEventCode,
                      out uint adjustEventCode)
 {
     MiscOp_GetR0R1((uint)flags,
                    Method.GetEvent,
                    out selectEventCode,
                    out adjustEventCode);
 }
Ejemplo n.º 8
0
 /*! \brief Specify a toolbox event to be raised when the user clicks Select and/or
  * Adjust on the %Iconbar icon.
  * \param [in] flags Bits 0 and 1 indicate which buttons to set events for.
  * \param [in] selectEventCode The event to be raised if Select is clicked (if bit 0 set
  * in flags - ButtonFlags.Select).
  * \param [in] adjustEventCode The event to be raised if Adjust is clicked (if bit 1 set
  * in flags - ButtonFlags.Adjust).
  * \note The \e SelectClickEvent and \e AdjustClickEvent properties can be used for
  * the same purpose.  */
 public void SetEvent(ButtonFlags flags, uint selectEventCode,
                      uint adjustEventCode)
 {
     MiscOp_SetR3R4((uint)flags,
                    Method.SetEvent,
                    selectEventCode,
                    adjustEventCode);
 }
Ejemplo n.º 9
0
 public ButtonState(XBoxController controller, ButtonFlags button)
 {
     _button                  = button;
     _controller              = controller;
     controller.StateChanged += Controller_StateChanged;
     controller.ButtonDown   += Controller_ButtonDown;
     controller.ButtonUp     += Controller_ButtonUp;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Retrieves the value to set to the <see cref="MinusOneMinusButtonFlags"/> property.
        /// </summary>
        /// <param name="buttonFlags">The currently pressed buttons at this moment in time.</param>
        private int GetMinusOneButtonFlags(ButtonFlags buttonFlags)
        {
            // This function returns 0 if no window is active.
            if (WindowProperties.IsWindowActivated(Program.GameProcess.Process.MainWindowHandle))
            {
                return(-1 - (int)buttonFlags);
            }

            return(0);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Callback-Метод для входа игрока в систему
        /// </summary>
        void LogButton_Click(object sender, RoutedEventArgs e)
        {
            if (ButtonFlag == ButtonFlags.LogIn)
            {
                if (TryToLogIn() == 2)                //Если в режиме авторизации, пробуем залогиниться
                {
                    if (rememberMeBox.IsChecked == true)
                    {
                        WriteToRemeberDataFile(true, LogBox.Text, PassBox.Text);
                    }
                    else
                    {
                        WriteToRemeberDataFile(false, "NULL", "NULL");
                    }

                    User r    = MTSystem.LoadClient(LogBox.Text, PermType.All);
                    var  main = new Window1(r);
                    main.Show();
                    Close();
                }
            }
            else             //Если в режиме опций, то сохраняем данные
            {
                ButtonFlag = ButtonFlags.LogIn;
                spRememberMe.Visibility = Visibility.Visible;
                String[] str = new string[2];
                if (LogBox.Text == "")
                {
                    str[0] = "NULL";
                }
                else
                {
                    str[0] = LogBox.Text;
                }

                if (PassBox.Text == "")
                {
                    str[1] = "NULL";
                }
                else
                {
                    str[1] = PassBox.Text;
                }

                MTSystem.SaveConnectionData(str);

                LogBox.Text           = "";
                PassBox.Text          = "";
                loginLabel.Text       = "Логин";
                passLabel.Text        = "Пароль";
                LogButton.Content     = "Войти";
                OptionsButton.Content = "Опции";
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Resets the structure of currently pressed controls to 0.
 /// Used before we apply our own controls.
 /// </summary>
 public void Reset()
 {
     ButtonFlags = 0;
     MinusOneMinusButtonFlags  = -1;
     OneFramePressButtonFlag   = 0;
     OneFrameReleaseButtonFlag = 0;
     LeftStickX        = 0.0F;
     LeftStickY        = 0.0F;
     RightStickX       = 0.0F;
     RightStickY       = 0.0F;
     ProbablyIsEnabled = 1;
 }
Ejemplo n.º 13
0
 public DPrompt(string titleText, string bodyText, ButtonFlags buttons = ButtonFlags.OK, Sprite image = null, bool isModal = true, bool autoClose = true, bool isTranslated = false, bool useCloseButton = false)
 {
     TextFields     = new Dictionary <string, TextData>();
     Images         = new Dictionary <string, Sprite>();
     Buttons        = buttons;
     IsModal        = isModal;
     AutoClose      = autoClose;
     UseCloseButton = useCloseButton;
     CustomButtons  = null;
     TextFields.Add(PROMPT_TEXT_TITLE, new TextData(titleText, isTranslated));
     TextFields.Add(PROMPT_TEXT_BODY, new TextData(bodyText, isTranslated));
     Images.Add(PROMPT_IMAGE_DEFAULT, image);
 }
Ejemplo n.º 14
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.ButtonWidgetReferenceTextFlags = ((TextFlags)(binaryReader.ReadInt32()));
     this.AnimationIndex = ((AnimationIndexEnum)(binaryReader.ReadInt16()));
     this.IntroAnimationDelayMilliseconds = binaryReader.ReadInt16();
     this.fieldpad                         = binaryReader.ReadBytes(2);
     this.CustomFont                       = ((CustomFontEnum)(binaryReader.ReadInt16()));
     this.TextColor                        = binaryReader.ReadVector4();
     this.Bounds                           = binaryReader.ReadVector2();
     this.Bitmap                           = binaryReader.ReadTagReference();
     this.BitmapOffset                     = binaryReader.ReadPoint();
     this.StringId                         = binaryReader.ReadStringID();
     this.RenderDepthBias                  = binaryReader.ReadInt16();
     this.MouseRegionTopOffset             = binaryReader.ReadInt16();
     this.ButtonWidgetReferenceButtonFlags = ((ButtonFlags)(binaryReader.ReadInt32()));
     return(pointerQueue);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Emulates a left or right bumper press if any of the triggers are held.
        /// Returns the extra flags to be appended (OR'd) to the existing button flags.
        /// </summary>
        private ButtonFlags SetTriggers(ref ControllerInputs controllerInputs)
        {
            ButtonFlags extraFlags = 0;

            if (ControllerMapping.TriggerOptions.EnableTriggerRotation)
            {
                if (controllerInputs.GetLeftTriggerPressure() > 0)
                {
                    extraFlags |= ControllerMapping.TriggerOptions.SwapTriggers ? ButtonFlags.CameraR : ButtonFlags.CameraL;
                }

                if (controllerInputs.GetRightTriggerPressure() > 0)
                {
                    extraFlags |= ControllerMapping.TriggerOptions.SwapTriggers ? ButtonFlags.CameraL : ButtonFlags.CameraR;
                }
            }

            return(extraFlags);
        }
Ejemplo n.º 16
0
 public Button(Rect Bounds, string ATitle, int ACommand, ButtonFlags AFlags) : base(Bounds)
 {
     Options   |= (OptionFlags.ofFirstClick | OptionFlags.ofSelectable | OptionFlags.ofPreProcess | OptionFlags.ofPostProcess);
     EventMask |= EventMasks.evBroadcast;
     if (!CommandEnabled(ACommand))
     {
         State |= StateFlags.Disabled;
     }
     Flags = AFlags;
     if ((Flags & ButtonFlags.Default) != 0)
     {
         AmDefault = true;
     }
     else
     {
         AmDefault = false;
     }
     Title   = ATitle;
     Command = ACommand;
 }
Ejemplo n.º 17
0
 public async void CommandBarButtonClick(object sender, ButtonFlags buttonFlags)
 {
     switch (buttonFlags)
     {
         case ButtonFlags.Add:
             FeedUrlDialog dlg = new FeedUrlDialog();
             await dlg.ShowAsync();
             listView.ItemsSource = FeedManager.Feeds;
             break;
         case ButtonFlags.Remove:
             break;
         case ButtonFlags.Cancel:
             break;
         case ButtonFlags.Multiselect:
             break;
         case ButtonFlags.Search:
             break;
         default:
             break;
     }
 }
Ejemplo n.º 18
0
        /* Methods (Private) */

        /// <summary>
        /// Iterates over the set of mapping key value pairs and gets the currently enabled Heroes button flags.
        /// Updates the newly set and released buttons entries.
        /// </summary>
        private void SetButtonFlags(ref ControllerInputs controllerInputs)
        {
            ButtonFlags     currentFlags      = 0;
            JoystickButtons controllerButtons = controllerInputs.ControllerButtons;

            // Get the button flags.
            foreach (var keyValue in _controllerMappingDictionary)
            {
                if (keyValue.Value(controllerButtons))
                {
                    currentFlags |= keyValue.Key;
                }
            }

            // Set triggers.
            currentFlags |= SetTriggers(ref controllerInputs);

            // Update struct and last set buttons.
            (*HeroesController).SetPressedButtons(_lastFrameFlags, currentFlags);
            (*HeroesController).SetReleasedButtons(_lastFrameFlags, currentFlags);
            (*HeroesController).SetMinusOneButtonFlags(currentFlags);
            (*HeroesController).ButtonFlags = currentFlags;
            _lastFrameFlags = currentFlags;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Determines if the specified button became released between the last
 /// Update and the current Update
 /// </summary>
 /// <param name="button">Flag of the button to check.</param>
 /// <returns>Returns true if the button became released, false otherwise.</returns>
 public static bool WasReleased(ButtonFlags button)
 {
     return((releasedButtons & button) == button);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Determines if the specified button became pressed between the last
 /// Update and the current Update
 /// </summary>
 /// <param name="button">Flag of the button to check.</param>
 /// <returns>Returns true if the button became pressed, false otherwise.</returns>
 public static bool WasPressed(ButtonFlags button)
 {
     return((pressedButtons & button) == button);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Determines if the specified button is being held down
 /// </summary>
 /// <param name="button">Flag of the button to check.</param>
 /// <returns>Returns true if the button is being held down, false otherwise.</returns>
 public static bool IsHolding(ButtonFlags button)
 {
     return((previousButtons & buttons & button) == button);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Determines if the specified button is pressed in this Update
 /// </summary>
 /// <param name="button">Flag of the button to check.</param>
 /// <returns>Returns true if the button is currently pressed, false otherwise.</returns>
 public static bool IsPressed(ButtonFlags button)
 {
     return((buttons & button) == button);
 }
Ejemplo n.º 23
0
 internal static extern void evas_event_feed_mouse_up(IntPtr obj, int b, ButtonFlags flags, int timestamp, IntPtr data);
Ejemplo n.º 24
0
        public void EnableButtons(object sender, ButtonFlags buttonFlags)
        {
            commandBar.PrimaryCommands.Clear();

            foreach (ButtonFlags flag in Enum.GetValues(typeof(ButtonFlags)))
            {
                if((buttonFlags & flag) != 0)
                {
                    commandBar.PrimaryCommands.Add(buttons[flag]);
                }
            }
        }
Ejemplo n.º 25
0
        static bool buttonBehavior(Rect r, UInt32 id, out bool hovered, out bool held, ButtonFlags flags = 0)
        {
            Window win = currentWindow;

            if (flags.HasFlag(ButtonFlags.Disabled) == true)
            {
                hovered = false;
                held    = false;
                return(false);
            }

            bool pressed = false;

            //move mouse coords into window space by substracting window position
            hovered = r.containsPoint(mouse.pos.X, mouse.pos.Y);
            if (hovered)
            {
                hoveredId = id;
                if (!flags.HasFlag(ButtonFlags.NoKeyModifiers) || (!keyboard.keyPressed(Key.ControlLeft) && !keyboard.keyPressed(Key.ShiftLeft) && !keyboard.keyPressed(Key.LAlt)))
                {
                    if (mouse.buttonClicked[(int)MouseButton.Left])
                    {
                        if (flags.HasFlag(ButtonFlags.PressedOnClick))
                        {
                            pressed = true;
                            setActiveId(0);
                        }
                        else
                        {
                            setActiveId(id);
                        }
                        focusWindow(win);
                    }
                    else if (mouse.buttonReleased[(int)MouseButton.Left] && flags.HasFlag(ButtonFlags.PressedOnRelease))
                    {
                        pressed = true;
                        setActiveId(0);
                    }
                    else if (flags.HasFlag(ButtonFlags.Repeat) && activeId == id && mouse.isButtonClicked(MouseButton.Left, true)) //mouse was clicked
                    {
                        pressed = true;
                    }
                }
            }

            held = false;
            if (activeId == id)
            {
                if (mouse.buttonDown[(int)MouseButton.Left])
                {
                    held = true;
                }
                else
                {
                    if (hovered)
                    {
                        pressed = true;
                    }
                    setActiveId(0);
                }
            }

            return(pressed);
        }
Ejemplo n.º 26
0
	   private extern static void evas_event_feed_mouse_up (IntPtr e, int b, ButtonFlags flags, uint timestamp, IntPtr data);
Ejemplo n.º 27
0
	   public static void EventFeedMouseUp (Canvas c, int b, ButtonFlags flags, uint timestamp)
	   {
		   evas_event_feed_mouse_up (c.Raw, b, flags, timestamp, new IntPtr());
	   }	   
Ejemplo n.º 28
0
 public static bool button_pressed(ButtonFlags button)
 {
     return(((_lastState.wButtons & (ushort)button) == 0) && ((_oldState.wButtons & (ushort)button) != 0));
 }
Ejemplo n.º 29
0
        public static bool ButtonBehavior(Rect bb, int id, out bool outHovered, out bool outHeld, ButtonFlags flags = 0)
        {
            GUIContext    g      = Form.current.uiContext;
            WindowManager w      = g.WindowManager;
            Window        window = w.CurrentWindow;

            if (flags.HaveFlag(ButtonFlags.Disabled))
            {
                outHovered = false;
                outHeld    = false;
                if (g.ActiveId == id)
                {
                    g.SetActiveID(0);
                }
                return(false);
            }

            if (!flags.HaveFlag(ButtonFlags.PressedOnClickRelease | ButtonFlags.PressedOnClick | ButtonFlags.PressedOnRelease | ButtonFlags.PressedOnDoubleClick))
            {
                flags |= ButtonFlags.PressedOnClickRelease;
            }

            bool pressed = false;
            bool hovered = g.IsHovered(bb, id, flags.HaveFlag(ButtonFlags.FlattenChilds));

            if (hovered)
            {
                g.SetHoverID(id);
                if (!flags.HaveFlag(ButtonFlags.NoKeyModifiers) || (!Keyboard.Instance.KeyPressed(Key.LeftControl) && !Keyboard.Instance.KeyPressed(Key.LeftShift) && !Keyboard.Instance.KeyPressed(Key.LeftAlt)))
                {
                    //                        | CLICKING        | HOLDING with ButtonFlags.Repeat
                    // PressedOnClickRelease  |  <on release>*  |  <on repeat> <on repeat> .. (NOT on release)  <-- MOST COMMON! (*) only if both click/release were over bounds
                    // PressedOnClick         |  <on click>     |  <on click> <on repeat> <on repeat> ..
                    // PressedOnRelease       |  <on release>   |  <on repeat> <on repeat> .. (NOT on release)
                    // PressedOnDoubleClick   |  <on dclick>    |  <on dclick> <on repeat> <on repeat> ..
                    if (flags.HaveFlag(ButtonFlags.PressedOnClickRelease) && Mouse.Instance.LeftButtonPressed)
                    {
                        g.SetActiveID(id, window); // Hold on ID
                        w.FocusWindow(window);
                        g.ActiveIdClickOffset = Mouse.Instance.Position - bb.Min;
                    }
                    if (((flags.HaveFlag(ButtonFlags.PressedOnClick) && Mouse.Instance.LeftButtonPressed) ||
                         (flags.HaveFlag(ButtonFlags.PressedOnDoubleClick) && Mouse.Instance.LeftButtonDoubleClicked)))
                    {
                        pressed = true;
                        g.SetActiveID(0);
                        w.FocusWindow(window);
                    }
                    if (flags.HaveFlag(ButtonFlags.PressedOnRelease) && Mouse.Instance.LeftButtonReleased)
                    {
                        if (!(flags.HaveFlag(ButtonFlags.Repeat) && Mouse.Instance.LeftButtonDownDurationPrev >= Keyboard.KeyRepeatDelay))  // Repeat mode trumps <on release>
                        {
                            pressed = true;
                        }
                        g.SetActiveID(0);
                    }

                    // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).
                    // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.
                    if (flags.HaveFlag(ButtonFlags.Repeat) && g.ActiveId == id && Mouse.Instance.LeftButtonDownDuration > 0.0f && g.IsMouseLeftButtonClicked(true))
                    {
                        pressed = true;
                    }
                }
            }

            bool held = false;

            if (g.ActiveId == id)
            {
                if (Mouse.Instance.LeftButtonState == KeyState.Down)
                {
                    held = true;
                }
                else
                {
                    if (hovered && flags.HaveFlag(ButtonFlags.PressedOnClickRelease))
                    {
                        if (!(flags.HaveFlag(ButtonFlags.Repeat) && Mouse.Instance.LeftButtonDownDurationPrev >= Keyboard.KeyRepeatDelay))  // Repeat mode trumps <on release>
                        {
                            pressed = true;
                        }
                    }
                    g.SetActiveID(0);
                }
            }

            // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
            if (hovered && flags.HaveFlag(ButtonFlags.AllowOverlapMode) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
            {
                hovered = pressed = held = false;
            }

            outHovered = hovered;
            outHeld    = held;

            return(pressed);
        }
Ejemplo n.º 30
0
 public ActionModal(string text, ButtonFlags buttons = ButtonFlags.None, Action <ButtonFlags> action = null, string name = "") : base(name)
 {
     this.Text    = text;
     this.Action  = action;
     this.Buttons = buttons;
 }
Ejemplo n.º 31
0
 private extern static void evas_event_feed_mouse_up(IntPtr e, int b, ButtonFlags flags, uint timestamp, IntPtr data);
Ejemplo n.º 32
0
 public ControllerButtonDownEventArgs(ButtonFlags button)
 {
     Button  = button;
     Handled = false;
 }
Ejemplo n.º 33
0
 public static void EventFeedMouseUp(Canvas c, int b, ButtonFlags flags, uint timestamp)
 {
     evas_event_feed_mouse_up(c.Raw, b, flags, timestamp, new IntPtr());
 }
Ejemplo n.º 34
0
 public static bool HaveFlag(this ButtonFlags value, ButtonFlags flag)
 {
     return((value & flag) != 0);
 }
Ejemplo n.º 35
0
 public static bool is_button_down(ButtonFlags button)
 {
     return((_lastState.wButtons & (ushort)button) != 0);
 }