/// <summary> /// Create a new active hotkey which will notify the event handler, when the hotkey is pressed /// </summary> /// <param name="keyboardKeys">The keyboard keys of the hotkey which will be listened for</param> /// <param name="mouseButtons">The mouse buttons of the hotkey which will be listened for</param> /// <param name="hotkeyPressedEventHandler">The event handler which will be notified</param> /// <param name="enabled"><see langword="false"/> to disable the active hotkey by reference</param> /// <param name="suppressHotkey"><see langword="true"/> if the hotkey should not be forwarded down the chain</param> internal ActiveHotkey(List <Key> keyboardKeys, List <MouseButton> mouseButtons, KeyUpEventHandler hotkeyPressedEventHandler, ref bool enabled, bool suppressHotkey = false) : base(keyboardKeys, mouseButtons) { HotkeyPressedEventHandler += hotkeyPressedEventHandler; SuppressHotkey = suppressHotkey; Enabled = enabled; RegisterEventListeners(); }
/// <summary> /// Create a new active hotkey which will notify the event handler, when the hotkey is pressed /// </summary> /// <param name="hotkey">The hotkey which will be listened for</param> /// <param name="hotkeyPressedEventHandler">The event handler which will be notified</param> /// <param name="enabled"><see langword="false"/> to disable the active hotkey by reference</param> /// <param name="suppressHotkey"><see langword="true"/> if the hotkey should not be forwarded down the chain</param> internal ActiveHotkey(Hotkey hotkey, KeyUpEventHandler hotkeyPressedEventHandler, ref bool enabled, bool suppressHotkey = false) : base(hotkey.KeyboardKeys, hotkey.MouseButtons) { HotkeyPressedEventHandler += hotkeyPressedEventHandler; Enabled = enabled; SuppressHotkey = suppressHotkey; RegisterEventListeners(); }
/** Constructor * @param * name The name to be given to the widget (must be unique). * @param * dimensions The x Position, y Position, width, and height of the widget. * @param * positionMode The GuiMetricsMode for the values given for the position. (absolute/relative/pixel) * @param * sizeMode The GuiMetricsMode for the values given for the size. (absolute/relative/pixel) * @param * material Ogre material defining the widget image. * @param * overlayContainer associates the internal OverlayElement with a specified zOrder. * @param * ParentWidget parent widget which created this widget. */ public TextBox(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, ParentWidget) { mWidgetType = Widget.WidgetType.QGUI_TYPE_TEXTBOX; mMaskUserInput = false; mBackSpaceDown = false; mBackSpaceTimer = 0.0f; mDeleteDown = false; mDeleteTimer = 0.0f; mLeftArrowDown = false; mRightArrowDown = false; mMoveCursorTimer = 0.0f; mCursorVisibilityTimer = 0.0f; mReadOnly = false; mInputMode = false; // Border Overlay gives us ability to assign material to TextBox border and Panel separately. mOverlayElement = createPanelOverlayElement(mInstanceName + ".Background", mPixelDimensions, ""); mOverlayContainer.AddChild(mOverlayElement); mOverlayElement.Show(); setMaterial(mWidgetMaterial); mCharacterHeight = 0.75f; Mogre.Vector3 textDimensions = new Mogre.Vector3(0, 0, mCharacterHeight); // Label has no material, since it directly overlaps the textbox overlay element mTextWidget = new Text(mInstanceName + ".Text", textDimensions, QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mChildrenContainer, this); mTextWidget.setTruncateMode(Text.TruncateMode.LEFT); mTextWidget.setTruncationFeedback(""); mTextWidget.setZOrderOffset(1); _addChildWidget(mTextWidget); mHorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT; mVerticalAlignment = GuiVerticalAlignment.GVA_CENTER; alignText(mHorizontalAlignment, mVerticalAlignment); OnDeactivate += new DeactivateEventHandler(TextBox_OnDeactivate); OnCharacter += new CharacterEventHandler(TextBox_OnCharacter); OnKeyDown += new KeyDownEventHandler(TextBox_OnKeyDown); OnKeyUp += new KeyUpEventHandler(TextBox_OnKeyUp); OnMouseButtonDown += new MouseButtonDownEventHandler(TextBox_OnMouseButtonDown); OnTimeElapsed += new TimeElapsedHandler(TextBox_OnTimeElapsed); }
public TextBox() { Height = 30; Width = 150; KeyUp += new KeyUpEventHandler(keyUp); }
public static void RemoveKeyUpEventHandler(KeyUpEventHandler e) => ModBase.InputManager.RemoveKeyUpEventHandler(e);
public static void AddKeyUpEventHandler(KeyUpEventHandler e) => ModBase.InputManager.AddKeyUpEventHandler(e);