示例#1
0
 private void updateToolTip()
 {
     if (this.DropDownHovering)
     {
         toolTip.SetToolTip(this, Localization.Get(UI_Key.ToolTip_Filter_Button_Index));
         toolTip.Active = true;
     }
     else if (this.MouseHovering && this.ValueType != FilterValueType.None)
     {
         toolTip.SetToolTip(this, Localization.Get(UI_Key.ToolTip_Filter_Button_Release));
         toolTip.Active = true;
     }
     else
     {
         toolTip.Active = false;
     }
 }
示例#2
0
 private void setToolTip(bool value, string Text)
 {
     if (value)
     {
         toolTip.SetToolTip(this, Text);
         toolTip.Active = true;
     }
     else
     {
         toolTip.Active = false;
     }
 }
示例#3
0
        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);

            this.Opacity = OPAQUE;

            Track t = controller.PlayingTrack;

            if (t != null)
            {
                toolTipText = t.ToShortString();
                toolTip     = new QToolTip(this, toolTipText);
                toolTip.SetToolTip(this, toolTipText);
            }
            else
            {
                killToolTip();
            }
        }
示例#4
0
        public frmIndex(FilterBar Parent, Point Anchor, IndexCallback Callback, FilterButton Button) : base(String.Empty, ButtonCreateType.None)
        {
            this.DoubleBuffered = true;

            callback = Callback;
            button   = Button;

            this.filterChar = '\0';

            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition   = FormStartPosition.Manual;
            this.KeyPreview      = true;
            this.FilterTypeBasis = button.FilterType;

            setCaption();

            buttons = new List <QButton>();

            var aa = getChars(Parent, Button.FilterType).ToList();

            aa.RemoveAll(c => c <= ' ' || c == CLEAR_CHAR);

            if (aa.Count() == 0)
            {
                this.NoData = true;
                this.Close();
                this.callback(this);
                return;
            }

            this.NoData = false;

            aa.Sort();

            if (button.ValueType != FilterValueType.None)
            {
                aa.Add(CLEAR_CHAR);
            }

            aa = aa.Take(55).ToList();

            bool filterBadChars;

            switch (System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName)
            {
            case "en":
            case "de":
            case "it":
            case "cs":
            case "fr":
            case "pt":
                filterBadChars = true;
                break;

            default:
                filterBadChars = false;
                break;
            }

            foreach (char c in aa)
            {
                QButton b;
                if (Button.FilterType == FilterType.Year && c != CLEAR_CHAR)
                {
                    b = new QButton(c.ToString() + "0s", false, true);
                }
                else
                {
                    b = new QButton(c.ToString(), false, true);
                }

                if ((!filterBadChars) || (c < 0xFF))
                {
                    b.Tag = c;
                    buttons.Add(b);
                    b.BackColor      = this.BackColor;
                    b.ButtonPressed += new QButton.ButtonDelegate(click);
                    this.Controls.Add(b);
                }
            }

            this.MinimumSize = Size.Empty;

            buttons.Add(new QButton("~", false, true)); // placeholder for close button

            desiredWidth = arrangeButtons() + BORDER_WIDTH + 2;

            closeButtonRect = new Rectangle(buttons[buttons.Count - 1].Location, Properties.Resources.filter_index_close_hover.Size);

            buttons.RemoveAt(buttons.Count - 1);

            this.ClientSize = new System.Drawing.Size(desiredWidth,
                                                      rows * buttons[0].Height + BORDER_WIDTH * 2);


            Point p = Parent.PointToScreen(new Point(Math.Min(Anchor.X - this.Width / 2, Parent.Right - this.Width), Anchor.Y));

            p             = new Point(Math.Max(0, p.X), p.Y);
            this.Location = p;

            this.Owner = Lib.MainForm;

            this.Show(Lib.MainForm);

            QButton lastButton = buttons[buttons.Count - 1];

            if (lastButton.Text[0] == '_')
            {
                QToolTip clearToolTip = new QToolTip(lastButton, String.Empty);
                clearToolTip.SetToolTip(lastButton, Localization.Get(UI_Key.Filter_Index_Clear));
            }
            tooltip        = new QToolTip(this, Localization.Get(UI_Key.Filter_Index_Cancel));
            tooltip.Active = false;
        }