public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.Add(NameName, Name); node.Add(NormalName, Normal.ExportYAML(container)); node.Add(HoverName, Hover.ExportYAML(container)); node.Add(ActiveName, Active.ExportYAML(container)); node.Add(FocusedName, Focused.ExportYAML(container)); node.Add(OnNormalName, OnNormal.ExportYAML(container)); node.Add(OnHoverName, OnHover.ExportYAML(container)); node.Add(OnActiveName, OnActive.ExportYAML(container)); node.Add(OnFocusedName, OnFocused.ExportYAML(container)); node.Add(BorderName, Border.ExportYAML(container)); node.Add(MarginName, Margin.ExportYAML(container)); node.Add(PaddingName, Padding.ExportYAML(container)); node.Add(OverflowName, Overflow.ExportYAML(container)); node.Add(FontName, Font.ExportYAML(container)); node.Add(FontSizeName, FontSize); node.Add(FontStyleName, (int)FontStyle); node.Add(AlignmentName, (int)Alignment); node.Add(WordWrapName, WordWrap); node.Add(RichTextName, RichText); node.Add(TextClippingName, (int)TextClipping); node.Add(ImagePositionName, (int)ImagePosition); node.Add(ContentOffsetName, ContentOffset.ExportYAML(container)); node.Add(FixedWidthName, FixedWidth); node.Add(FixedHeightName, FixedHeight); node.Add(StretchWidthName, StretchWidth); node.Add(StretchHeightName, StretchHeight); return(node); }
/// <inheritdoc/> public override int GetHashCode() => Role.GetHashCode() ^ Name.GetHashCode() ^ Value.GetHashCode() ^ Description.GetHashCode() ^ KeyShortcuts.GetHashCode() ^ RoleDescription.GetHashCode() ^ ValueText.GetHashCode() ^ AutoComplete.GetHashCode() ^ HasPopup.GetHashCode() ^ Orientation.GetHashCode() ^ Disabled.GetHashCode() ^ Expanded.GetHashCode() ^ Focused.GetHashCode() ^ Modal.GetHashCode() ^ Multiline.GetHashCode() ^ Multiselectable.GetHashCode() ^ Readonly.GetHashCode() ^ Required.GetHashCode() ^ Selected.GetHashCode() ^ Pressed.GetHashCode() ^ Checked.GetHashCode() ^ Level.GetHashCode() ^ ValueMin.GetHashCode() ^ ValueMax.GetHashCode() ^ Children.GetHashCode();
public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.Add("m_Name", Name); node.Add("m_Normal", Normal.ExportYAML(container)); node.Add("m_Hover", Hover.ExportYAML(container)); node.Add("m_Active", Active.ExportYAML(container)); node.Add("m_Focused", Focused.ExportYAML(container)); node.Add("m_OnNormal", OnNormal.ExportYAML(container)); node.Add("m_OnHover", OnHover.ExportYAML(container)); node.Add("m_OnActive", OnActive.ExportYAML(container)); node.Add("m_OnFocused", OnFocused.ExportYAML(container)); node.Add("m_Border", Border.ExportYAML(container)); node.Add("m_Margin", Margin.ExportYAML(container)); node.Add("m_Padding", Padding.ExportYAML(container)); node.Add("m_Overflow", Overflow.ExportYAML(container)); node.Add("m_Font", Font.ExportYAML(container)); node.Add("m_FontSize", FontSize); node.Add("m_FontStyle", (int)FontStyle); node.Add("m_Alignment", (int)Alignment); node.Add("m_WordWrap", WordWrap); node.Add("m_RichText", RichText); node.Add("m_TextClipping", (int)TextClipping); node.Add("m_ImagePosition", (int)ImagePosition); node.Add("m_ContentOffset", ContentOffset.ExportYAML(container)); node.Add("m_FixedWidth", FixedWidth); node.Add("m_FixedHeight", FixedHeight); node.Add("m_StretchWidth", StretchWidth); node.Add("m_StretchHeight", StretchHeight); return(node); }
public void FocusNext() { Focused.RemoveFocus(); Index = Index == Items.Count - 1 ? 0 : ++Index; Focused.Focus(); Render.Update(); }
protected virtual void OnFocused() { if (Focused != null) { Focused.Invoke(this, System.EventArgs.Empty); } }
public override void Update(GameTime gameTime) { if (Enabled) { MiStandardControllerState newState = Controller.GetState(); foreach (MiControl control in Controller.controls) { if (oldState.IsReleased(control) && newState.IsPressed(control)) { Game.ScriptEngine.ExecuteScript(Focused.RespondToInput(control)); } if (oldState.IsPressed(control) && newState.IsPressed(control)) { holdTimer[control]++; if (holdTimer[control] > HOLD_REPEAT_INTERVAL) { holdTimer[control] = 0; Game.ScriptEngine.ExecuteScript(Focused.RespondToInput(control)); } } if (newState.IsReleased(control)) { holdTimer[control] = 0; } } oldState = newState; } }
public void Read(AssetStream stream) { StyleName = stream.ReadStringAligned(); Normal.Read(stream); Hover.Read(stream); Active.Read(stream); Focused.Read(stream); OnNormal.Read(stream); OnHover.Read(stream); OnActive.Read(stream); OnFocused.Read(stream); Border.Read(stream); Margin.Read(stream); Padding.Read(stream); Overflow.Read(stream); Font.Read(stream); FontSize = stream.ReadInt32(); FontStyle = stream.ReadInt32(); Alignment = stream.ReadInt32(); WordWrap = stream.ReadBoolean(); RichText = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); TextClipping = stream.ReadInt32(); ImagePosition = stream.ReadInt32(); ContentOffset.Read(stream); FixedWidth = stream.ReadSingle(); FixedHeight = stream.ReadSingle(); StretchWidth = stream.ReadBoolean(); StretchHeight = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); }
public void FocusPrevious() { Focused.RemoveFocus(); Index = Index == 0 ? Items.Count - 1 : --Index; Focused.Focus(); Render.Update(); }
public void ShowScreen(ScreenType type) { if (FocusedType == type) { return; } if (type == ScreenType.EMPTY) { Focused.Hide(); Focused = null; FocusedType = ScreenType.EMPTY; return; } Focused?.Hide(); if (!cachedScreens.ContainsKey(type)) { createScreen(type); } FocusedType = type; Focused = cachedScreens[type]; Focused?.Show(); }
/// <inheritdoc/> public override int GetHashCode() => (Role ?? string.Empty).GetHashCode() ^ (Name ?? string.Empty).GetHashCode() ^ (Value ?? string.Empty).GetHashCode() ^ (Description ?? string.Empty).GetHashCode() ^ (Keyshortcuts ?? string.Empty).GetHashCode() ^ (Roledescription ?? string.Empty).GetHashCode() ^ (Valuetext ?? string.Empty).GetHashCode() ^ Disabled.GetHashCode() ^ Expanded.GetHashCode() ^ Focused.GetHashCode() ^ Modal.GetHashCode() ^ Multiline.GetHashCode() ^ Multiselectable.GetHashCode() ^ Readonly.GetHashCode() ^ Required.GetHashCode() ^ Selected.GetHashCode() ^ Checked.GetHashCode() ^ Pressed.GetHashCode() ^ Level.GetHashCode() ^ Valuemin.GetHashCode() ^ Valuemax.GetHashCode() ^ (Autocomplete ?? string.Empty).GetHashCode() ^ (Haspopup ?? string.Empty).GetHashCode() ^ (Invalid ?? string.Empty).GetHashCode() ^ (Orientation ?? string.Empty).GetHashCode() ^ Children.GetHashCode();
public void ConfigureResourceDictionary(ResourceDictionary dictionary, string prefix) { TabFont.ConfigureResourceDictionary(dictionary, prefix + "Font"); Default.ConfigureResourceDictionary(dictionary, prefix); Selected.ConfigureResourceDictionary(dictionary, prefix + "Selected"); Focused.ConfigureResourceDictionary(dictionary, prefix + "Focused"); UnreadCount.ConfigureResourceDictionary(dictionary, prefix + "UnreadCount"); }
// TODO move keyboard handling into screen manager so basic functions aren't duplicated public void HandleInput() { //if (key == Keys.Back) // currentGame.screenManager.FocusScreen(GameScreen.TITLE_MAINMENU); if (currentGame.IsActive) { Focused.HandleInput(); } }
/// <summary> /// Performs a deep copy of this theme. /// </summary> /// <returns>A new instance of the theme.</returns> public ThemeStates Clone() => new ThemeStates() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), };
public virtual object Clone() => new ListBoxItemTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), };
/// <summary> /// The callback of the Realized event. /// </summary> /// <since_tizen> preview </since_tizen> protected override void OnRealized() { base.OnRealized(); _focused = new SmartEvent(this, "focused"); _focused.On += (s, e) => Focused?.Invoke(this, EventArgs.Empty); _unfocused = new SmartEvent(this, "unfocused"); _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty); }
public override object Clone() => new ListBoxItemColorTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), };
public void Focus() { if (IsFocused) { return; } IsFocused = true; Focused?.Invoke(this); }
/// <inheritdoc /> public override ThemeBase Clone() => new DrawingSurfaceTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), UseNormalStateOnly = UseNormalStateOnly };
public void Render() { Focused?.Render(); Chat.Render(); Message.Render(); Screen.Render(); Text.Render(); }
/// <inheritdoc /> public override ThemeBase Clone() => new ProgressBarTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), Foreground = Foreground?.Clone(), Background = Background?.Clone() };
internal void FireFocused(bool focused) { if (focused) { Focused.Fire(); } else { Unfocused.Fire(); } }
public void OnKey(ConsoleKeyInfo key) { if (!(Focused?.ProcessKey(key) ?? false)) { // focused input didn't handle the key, process here if (key.Key == ConsoleKey.Tab) { SwitchInput(key.Modifiers.HasFlag(ConsoleModifiers.Shift)); } } }
/// <summary> /// Called when the context becomes focused or active. This will be /// called after startup and after resume and means that the context is /// open and ready to recieve input. /// </summary> private void focus() { if (Focused != null) { Focused.Invoke(this); } if (!String.IsNullOrEmpty(FocusAction)) { runFinalAction(FocusAction); } }
/// <inheritdoc /> public override ThemeBase Clone() { return(new DrawingSurfaceTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), }); }
/// <summary> /// Starts rendering cycle and waits for shutdown /// </summary> public static void Start() { var pf = Environment.OSVersion.Platform; var isUnix = pf == PlatformID.Unix || pf == PlatformID.MacOSX || (int)pf == 128; // unix/macosx/mono linux var provider = isUnix ? (INativeConsoleProvider) new UnixNativeConsoleProvider() : new WindowsNativeConsoleProvider(); if (Provider != null) { throw new ArgumentException("Already started"); } Provider = provider; provider.Clear(_background); provider.KeyPressed += (o, e) => { if (CanChangeFocus && e.Info.Key == ConsoleKey.Tab && e.Info.Modifiers == 0) { _prevent = true; FocusNext(); _prevent = false; Refresh(); return; } if (CanChangeFocus && e.Info.Key == ConsoleKey.Tab && e.Info.Modifiers == ConsoleModifiers.Shift) // Can not intercept CTRL in Linux { _prevent = true; FocusNextWindow(); _prevent = false; Refresh(); return; } _prevent = true; Focused?.OnKeyPressedInternal(e.Info); _prevent = false; Refresh(); }; provider.SizeChanged += (o, e) => { _prevent = true; foreach (var window in Windows) { window.OnSizeChangedInternal(); } _prevent = false; Refresh(); }; _prevent = true; FocusNextWindow(); _prevent = false; Refresh(); }
/// <inheritdoc /> public override ThemeBase Clone() => new ListBoxTheme((ScrollBarTheme)ScrollBarTheme.Clone()) { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), BorderTheme = BorderTheme?.Clone(), BorderLineStyle = (int[])BorderLineStyle?.Clone(), DrawBorder = DrawBorder, };
/// <inheritdoc /> public override ThemeBase Clone() => new LabelTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), UseNormalStateOnly = UseNormalStateOnly, DecoratorStrikethrough = DecoratorStrikethrough, DecoratorUnderline = DecoratorUnderline };
/// <inheritdoc /> public override ThemeBase Clone() => new ButtonTheme() { Normal = Normal.Clone(), Disabled = Disabled.Clone(), MouseOver = MouseOver.Clone(), MouseDown = MouseDown.Clone(), Selected = Selected.Clone(), Focused = Focused.Clone(), ShowEnds = ShowEnds, EndCharacterLeft = EndCharacterLeft, EndCharacterRight = EndCharacterRight };
private void HandleFocusChange(object sender, FocusEventArgs e) { base.SetFocusChange(lblLabel, frmContainer, bxvLine); if (IsControlFocused) { Focused?.Invoke(this, e); } else { Unfocused?.Invoke(this, e); } }
protected override void KeyboardInput(InputEventArgs <TInput> args) { if (KeyboardAdapter.IsTab(args.Input)) { var index = Controls.IndexOf(Focused) + 1; Focused = Controls[index % Controls.Count]; Focused.IsFocused = true; } else { Focused.NotifyKeyboardInput(args.Input); } }