Helper class for custom tooltips
Example #1
0
    /// <summary>
    ///   Sets up the inputs and adds them as children.
    /// </summary>
    public override void _Ready()
    {
        inputActionHeader    = GetNode <Label>(InputActionHeaderPath);
        inputEventsContainer = GetNode <HBoxContainer>(InputEventsContainerPath);
        addInputEvent        = GetNode <Button>(AddInputEventPath);

        ToolTipHelper.RegisterToolTipForControl(
            addInputEvent, tooltipCallbacks, ToolTipManager.Instance.GetToolTip("addInputButton", "options"));

        inputActionHeader.Text = DisplayName;

        foreach (var input in Inputs)
        {
            input.AssociatedAction = new WeakReference <InputActionItem>(this);
            inputEventsContainer.AddChild(input);
        }

        inputEventsContainer.MoveChild(addInputEvent, Inputs.Count);

        Inputs.CollectionChanged += OnInputsChanged;
    }
Example #2
0
    /// <summary>
    ///   Setup the main menu.
    /// </summary>
    private void RunMenuSetup()
    {
        Background      = GetNode <TextureRect>("Background");
        guiAnimations   = GetNode <AnimationPlayer>("GUIAnimations");
        thriveLogo      = GetNode <TextureRect>(ThriveLogoPath);
        newGameButton   = GetNode <Button>(NewGameButtonPath);
        freebuildButton = GetNode <Button>(FreebuildButtonPath);

        MenuArray?.Clear();

        // Get all of menu items
        MenuArray = GetTree().GetNodesInGroup("MenuItem");

        if (MenuArray == null)
        {
            GD.PrintErr("Failed to find all the menu items!");
            return;
        }

        RandomizeBackground();

        options    = GetNode <OptionsMenu>("OptionsMenu");
        saves      = GetNode <SaveManagerGUI>("SaveManagerGUI");
        gles2Popup = GetNode <AcceptDialog>(GLES2PopupPath);

        // Set initial menu
        SwitchMenu();

        // Easter egg message
        ToolTipHelper.RegisterToolTipForControl(
            thriveLogo, toolTipCallbacks, ToolTipManager.Instance.GetToolTip("thriveLogoEasterEgg", "mainMenu"));

        if (OS.GetCurrentVideoDriver() == OS.VideoDriver.Gles2 && !IsReturningToMenu)
        {
            gles2Popup.PopupCenteredMinsize();
        }
    }
Example #3
0
    /// <summary>
    ///   Setup the main menu.
    /// </summary>
    private void RunMenuSetup()
    {
        Background      = GetNode <TextureRect>("Background");
        guiAnimations   = GetNode <AnimationPlayer>("GUIAnimations");
        thriveLogo      = GetNode <TextureRect>(ThriveLogoPath);
        newGameButton   = GetNode <Button>(NewGameButtonPath);
        freebuildButton = GetNode <Button>(FreebuildButtonPath);

        MenuArray?.Clear();

        // Get all of menu items
        MenuArray = GetTree().GetNodesInGroup("MenuItem");

        if (MenuArray == null)
        {
            GD.PrintErr("Failed to find all the menu items!");
            return;
        }

        RandomizeBackground();

        options = GetNode <OptionsMenu>("OptionsMenu");
        saves   = GetNode <SaveManagerGUI>("SaveManagerGUI");

        // Load settings
        if (Settings.Instance == null)
        {
            GD.PrintErr("Failed to initialize settings.");
        }

        // Set initial menu
        SwitchMenu();

        // Easter egg message
        ToolTipHelper.RegisterToolTipForControl(
            thriveLogo, toolTipCallbacks, ToolTipManager.Instance.GetToolTip("thriveLogoEasterEgg", "mainMenu"));
    }
Example #4
0
        public ToolTipHelper RegisterTooltip(Point t, FrameworkElement re)
        {
            Extensions.Execute.UIThread(() =>
            {
                MessageBox.Show(GetAbsoltutePlacement(re).ToString());
            });

            ToolTipHelper Helper = new ToolTipHelper
            {
                X            = Math.Abs(t.X),
                Y            = Math.Abs(t.Y),
                BorderBrush  = "FFFFFF",
                Background   = "000000",
                Opacity      = 0.9,
                Text         = "Hej",
                BorderSize   = 3,
                CornerRadius = 3,
                Width        = 100,
                Height       = 100,
            };

            Tooltips.Add(Helper);
            return(Helper);
        }
Example #5
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarBreakAllToolTip, dnSpy_Debugger_Resources.ShortCutKeyCtrlAltBreak);
Example #6
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarDebugAssemblyToolTip, dnSpy_Debugger_Resources.ShortCutKeyF5);
Example #7
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarShowNextStatementToolTip, dnSpy_Debugger_Resources.ShortCutAltAsterisk);
Example #8
0
 public override string GetToolTip(IToolBarItemContext context) =>
 ToolTipHelper.AddKeyboardShortcut(dnSpy_Resources.SearchAssembliesToolBarToolTip, dnSpy_Resources.ShortCutKeyCtrlShiftK);
Example #9
0
        private void specialsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //If valid pizza is added, switch case will be selected and image and label will load.
            switch (specialsComboBox.SelectedItem)
            {
            case "PEPPERONI PIZZA":
            {
                pizzaPictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("pepperoni.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Pepperoni Pizza");
                typeOfPizzaLabel.Text = "Pepperoni Pizza $12.99";
            }
            break;

            case "CHEESE PIZZA":
            {
                pizzaPictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("cheese.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Cheese Pizza");
                typeOfPizzaLabel.Text = "Cheese Pizza $13.99";
            }
            break;

            case "CALZONE PIZZA":
            {
                pizzaPictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("calzone.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Calzone Pizza");
                typeOfPizzaLabel.Text = "Calzone Pizza $14.99";
            }
            break;

            case "ITALIAN PIZZA":
            {
                pizzaPictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("italian.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Italian Pizza");
                typeOfPizzaLabel.Text = "Italian Pizza $15.99";
            }
            break;
            }
        }
Example #10
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Resources.OpenToolBarToolTip, dnSpy_Resources.ShortCutKeyCtrlO);
Example #11
0
 public override string?GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Resources.NavigateForwardCommand, dnSpy_Resources.ShortCutKeyAltRightArrow);
Example #12
0
 public override string?GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Resources.NavigateBackCommand, dnSpy_Resources.ShortCutKeyBackspace);
Example #13
0
        private void loadSectionComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Switch case to set stateTextBox text and load the associated image and tooltip
            switch (loadSectionComboBox.SelectedItem)
            {
            case "OR":
            {
                stateTextBox.Text            = "State of Oregon";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("oregon.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of Oregon");
            }
            break;

            case "WA":
            {
                stateTextBox.Text            = "State of Washington";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("washington.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of Washington");
            }
            break;

            case "CA":
            {
                stateTextBox.Text            = "State of California";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("california.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of California");
            }
            break;

            case "NY":
            {
                stateTextBox.Text            = "State of New York";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("newyork.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of New York");
            }
            break;

            case "ID":
            {
                stateTextBox.Text            = "State of Idaho";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("idaho.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of Idaho");
            }
            break;

            case "TX":
            {
                stateTextBox.Text            = "State of Texas";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("texas.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of Texas");
            }
            break;

            case "MI":
            {
                stateTextBox.Text            = "State of Michigan";
                stateImagePictureBox.Visible = true;
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.stateImagePictureBox.Image = Image.FromFile("michigan.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this State did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(stateImagePictureBox, "Flag of Michigan");
            }
            break;
            }
        }
Example #14
0
        private void addToShoppingCartButton_Click(object sender, EventArgs e)
        {
            //handles duplicate and no text entered. Adds pizza types to list box of price and pizza.
            if (selectedPizzaListBox.Items.Contains(orderPizzaTextBox.Text.ToUpper()))
            {
                MessageBox.Show("Duplicates not allowed");
            }
            else if (orderPizzaTextBox.Text == "CHEESE PIZZA")
            {
                passwordLoginErrorProvider.SetError(orderPizzaTextBox, null);
                selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper());
                priceListBox.Items.Add(13.99);
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("cheese.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Cheese Pizza");
                typeOfPizzaLabel.Text = "Cheese Pizza $13.99";
            }

            else if (orderPizzaTextBox.Text == "PEPPERONI PIZZA")
            {
                passwordLoginErrorProvider.SetError(orderPizzaTextBox, null);
                selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper());
                priceListBox.Items.Add(12.99);
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("pepperoni.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Pepperoni Pizza");
                typeOfPizzaLabel.Text = "Pepperoni Pizza $12.99";
            }
            else if (orderPizzaTextBox.Text == "CALZONE PIZZA")
            {
                passwordLoginErrorProvider.SetError(orderPizzaTextBox, null);
                selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper());
                priceListBox.Items.Add(14.99);
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("calzone.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Calzone Pizza");
                typeOfPizzaLabel.Text = "Calzone Pizza $14.99";
            }

            else if (orderPizzaTextBox.Text == "ITALIAN PIZZA")
            {
                passwordLoginErrorProvider.SetError(orderPizzaTextBox, null);
                selectedPizzaListBox.Items.Add(orderPizzaTextBox.Text.ToUpper());
                priceListBox.Items.Add(15.99);
                //Try for image load
                try
                {
                    //If the operation is normal,this line of code will execute
                    this.pizzaPictureBox.Image = Image.FromFile("italian.jpg");
                }
                catch
                {
                    //    if the operation detects picture load failure,
                    //the control will be passed to the catch statement
                    MessageBox.Show
                        ("The image for this pizza did not load."
                        , "Warning!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
                ToolTip tt = ToolTipHelper.GetControlToolTip("");
                tt.SetToolTip(pizzaPictureBox, "Italian Pizza");
                typeOfPizzaLabel.Text = "Italian Pizza $15.99";
            }
            else
            {
                MessageBox.Show("Please enter valid Pizza name");
            }
            orderPizzaTextBox.ResetText();
        }
Example #15
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarStopDebuggingToolTip, dnSpy_Debugger_Resources.ShortCutKeyShiftF5);
Example #16
0
        public TextEditorControl(IThemeManager themeManager, ToolTipHelper toolTipHelper, ITextEditorSettings textEditorSettings, ITextEditorUIContextImpl uiContext, ITextEditorHelper textEditorHelper, ITextLineObjectManager textLineObjectManager, IImageManager imageManager, IIconBarCommandManager iconBarCommandManager)
        {
            this.references         = new TextSegmentCollection <ReferenceSegment>();
            this.themeManager       = themeManager;
            this.toolTipHelper      = toolTipHelper;
            this.textEditorSettings = textEditorSettings;
            this.textEditorHelper   = textEditorHelper;
            InitializeComponent();
            this.textEditorSettings.PropertyChanged += TextEditorSettings_PropertyChanged;

            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            textEditor = new NewTextEditor(themeManager);
            this.toolTipHelper.Initialize(TextEditor);
            RemoveCommands(TextEditor);
            newTextEditor.Content      = TextEditor;
            TextEditor.IsReadOnly      = true;
            TextEditor.ShowLineNumbers = true;
            TextEditor.Options.RequireControlModifierForHyperlinkClick = false;

            referenceElementGenerator = new ReferenceElementGenerator(JumpToReference, a => true);
            // Add the ref elem generator first in case one of the refs looks like a http link etc
            TextEditor.TextArea.TextView.ElementGenerators.Insert(0, referenceElementGenerator);
            this.uiElementGenerator = new UIElementGenerator();
            textEditor.TextArea.TextView.ElementGenerators.Add(uiElementGenerator);

            TextEditor.SetBinding(FontFamilyProperty, new Binding {
                Source = textEditorSettings,
                Path   = new PropertyPath("FontFamily"),
                Mode   = BindingMode.OneWay,
            });
            TextEditor.SetBinding(FontSizeProperty, new Binding {
                Source = textEditorSettings,
                Path   = new PropertyPath("FontSize"),
                Mode   = BindingMode.OneWay,
            });
            TextEditor.SetBinding(ICSharpCode.AvalonEdit.TextEditor.WordWrapProperty, new Binding {
                Source = textEditorSettings,
                Path   = new PropertyPath("WordWrap"),
                Mode   = BindingMode.OneWay,
            });

            iconBarMargin = new IconBarMargin(uiContext, textLineObjectManager, imageManager, themeManager);
            iconBarCommandManager.Initialize(iconBarMargin);
            TextEditor.TextArea.LeftMargins.Insert(0, iconBarMargin);
            TextEditor.TextArea.TextView.VisualLinesChanged += (s, e) => iconBarMargin.InvalidateVisual();

            textMarkerService = new TextMarkerService(this, uiContext, textLineObjectManager);
            TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);

            searchPanel = SearchPanel.Install(TextEditor.TextArea);
            searchPanel.RegisterCommands(this.CommandBindings);
            searchPanel.Localization = new AvalonEditSearchPanelLocalization();

            TextEditor.TextArea.Caret.PositionChanged += Caret_PositionChanged;

            TextEditor.TextArea.MouseRightButtonDown += (s, e) => TextEditor.GoToMousePosition();

            InputBindings.Add(new KeyBinding(new RelayCommand(a => MoveReference(true)), Key.Tab, ModifierKeys.None));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => MoveReference(false)), Key.Tab, ModifierKeys.Shift));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => MoveToNextDefinition(true)), Key.Down, ModifierKeys.Alt));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => MoveToNextDefinition(false)), Key.Up, ModifierKeys.Alt));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => FollowReference()), Key.F12, ModifierKeys.None));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => FollowReference()), Key.Enter, ModifierKeys.None));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => FollowReferenceNewTab()), Key.F12, ModifierKeys.Control));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => FollowReferenceNewTab()), Key.Enter, ModifierKeys.Control));
            InputBindings.Add(new KeyBinding(new RelayCommand(a => ClearMarkedReferencesAndToolTip()), Key.Escape, ModifierKeys.None));

            this.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnGotKeyboardFocus), true);
            this.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnLostKeyboardFocus), true);

            OnHighlightCurrentLineChanged();
            OnShowLineNumbersChanged();
            OnAutoHighlightRefsChanged();
        }
Example #17
0
 void OnHoverOverNode(object sender, RoutedEventArgs e)
 {
     Shape.ToolTip = ToolTipHelper.Serialize(Entities);
 }
Example #18
0
 public override string GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_AsmEditor_Resources.RedoToolBarToolTip, dnSpy_AsmEditor_Resources.ShortCutKeyCtrlY);
Example #19
0
 public override string?GetToolTip(IToolBarItemContext context) => ToolTipHelper.AddKeyboardShortcut(dnSpy_Debugger_Resources.ToolBarStepOverToolTip, dnSpy_Debugger_Resources.ShortCutKeyF10);