Ejemplo n.º 1
0
        /// <summary>
        /// Constructor</summary>
        public StringTagSearchInputUI(TagLabelListControl tagListControl)
        {
            m_tagListControl = tagListControl;

            Visible    = true;
            GripStyle  = ToolStripGripStyle.Hidden;
            RenderMode = ToolStripRenderMode.System;

            ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton();

            dropDownButton.DisplayStyle          = ToolStripItemDisplayStyle.Image;
            dropDownButton.Image                 = ResourceUtil.GetImage16(Resources.SearchImage);
            dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            dropDownButton.Name = "SearchButton";
            dropDownButton.Size = new System.Drawing.Size(29, 22);
            dropDownButton.Text = "Search".Localize("'Search' is a verb");


            m_patternTextBox                         = new ToolStripAutoFitTextBox();
            m_patternTextBox.KeyDown                += patternTextBox_KeyDown;
            m_patternTextBox.TextChanged            += patternTextBox_TextChanged;
            m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown;
            m_patternTextBox.MaximumWidth            = 1080;

            Items.AddRange(new ToolStripItem[] {
                dropDownButton,
                m_patternTextBox,
                //clearSearchButton
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor</summary>
        public StringSearchInputUI()
        {
            m_patternTextRegex = string.Empty;

            Visible    = true;
            GripStyle  = ToolStripGripStyle.Hidden;
            RenderMode = ToolStripRenderMode.System;

            ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton();

            dropDownButton.DisplayStyle          = ToolStripItemDisplayStyle.Image;
            dropDownButton.Image                 = ResourceUtil.GetImage16(Resources.SearchImage);
            dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            dropDownButton.Name = "SearchButton";
            dropDownButton.Size = new System.Drawing.Size(29, 22);
            dropDownButton.Text = "Search".Localize("'Search' is a verb");

            ToolStripButton clearSearchButton = new ToolStripButton();

            clearSearchButton.DisplayStyle       = ToolStripItemDisplayStyle.Image;
            clearSearchButton.Image              = ResourceUtil.GetImage16(Resources.DeleteImage);
            dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            clearSearchButton.Name   = "ClearSearchButton";
            clearSearchButton.Size   = new System.Drawing.Size(29, 22);
            clearSearchButton.Text   = "Clear Search".Localize("'Clear' is a verb");
            clearSearchButton.Click += clearSearchButton_Click;

            m_patternTextBox                         = new ToolStripAutoFitTextBox();
            m_patternTextBox.KeyUp                  += patternTextBox_KeyUp;
            m_patternTextBox.TextChanged            += patternTextBox_TextChanged;
            m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown;
            m_patternTextBox.MaximumWidth            = 1080;

            Items.AddRange(new ToolStripItem[] {
                dropDownButton,
                m_patternTextBox,
                clearSearchButton
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor</summary>
        public StringSearchInputUI()
        {
            m_patternTextRegex = string.Empty;

            Visible = true;
            GripStyle = ToolStripGripStyle.Hidden;
            RenderMode = ToolStripRenderMode.System;

            ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton();
            dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage);
            dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            dropDownButton.Name = "SearchButton";
            dropDownButton.Size = new System.Drawing.Size(29, 22);
            dropDownButton.Text = "Search".Localize("'Search' is a verb");

            ToolStripButton clearSearchButton = new ToolStripButton();
            clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage);
            dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            clearSearchButton.Name = "ClearSearchButton";
            clearSearchButton.Size = new System.Drawing.Size(29, 22);
            clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb");
            clearSearchButton.Click += clearSearchButton_Click;

            m_patternTextBox = new ToolStripAutoFitTextBox();
            m_patternTextBox.KeyUp += patternTextBox_KeyUp;
            m_patternTextBox.TextChanged += patternTextBox_TextChanged;
            m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown;
            m_patternTextBox.MaximumWidth = 1080;

            Items.AddRange(new ToolStripItem[] { 
                    dropDownButton, 
                    m_patternTextBox,
                    clearSearchButton
                    });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor using given PropertyGridView and mode flags</summary>
        /// <param name="mode">The flags specifying the PropertyGrid's features and appearance</param>
        /// <param name="propertyGridView">The customized PropertyGridView</param>
        public PropertyGrid(PropertyGridMode mode, PropertyGridView propertyGridView)
        {
            m_propertyGridView = propertyGridView;
            m_propertyGridView.BackColor = SystemColors.Window;
            m_propertyGridView.Dock = DockStyle.Fill;
            m_propertyGridView.EditingContextChanged += propertyGrid_EditingContextChanged;
            m_propertyGridView.MouseUp += propertyGrid_MouseUp;
            m_propertyGridView.DragOver += propertyGrid_DragOver;
            m_propertyGridView.DragDrop += propertyGrid_DragDrop;
            m_propertyGridView.MouseHover += propertyGrid_MouseHover;
            m_propertyGridView.MouseLeave += propertyGrid_MouseLeave;
            if (m_descriptionTextBox != null)
            {
                m_propertyGridView.DescriptionSetter = p =>
                {
                    if (p != null)
                        m_descriptionTextBox.SetDescription(p.DisplayName, p.Description);
                    else
                        m_descriptionTextBox.ClearDescription();
                };
            }

            m_toolStrip = new ToolStrip();
            m_toolStrip.GripStyle = ToolStripGripStyle.Hidden;
            m_toolStrip.Dock = DockStyle.Top;

            if ((mode & PropertyGridMode.PropertySorting) != 0)
            {
                m_propertyOrganization = new ToolStripDropDownButton(null, s_categoryImage);
                m_propertyOrganization.ToolTipText = "Property Organization".Localize(
                    "Could be rephrased as 'How do you want these properties to be organized?'");
                m_propertyOrganization.ImageTransparentColor = Color.Magenta;
                m_propertyOrganization.DropDownItemClicked += organization_DropDownItemClicked;

                var item1 = new ToolStripMenuItem("Unsorted".Localize());
                item1.Tag = PropertySorting.None;

                var item2 = new ToolStripMenuItem("Alphabetical".Localize());
                item2.Tag = PropertySorting.Alphabetical;

                var item3 = new ToolStripMenuItem("Categorized".Localize());
                item3.Tag = PropertySorting.Categorized;

                var item4 = new ToolStripMenuItem("Categorized Alphabetical Properties".Localize());
                item4.Tag = PropertySorting.Categorized | PropertySorting.Alphabetical;

                var item5 = new ToolStripMenuItem("Alphabetical Categories".Localize());
                item5.Tag = PropertySorting.Categorized | PropertySorting.CategoryAlphabetical;

                var item6 = new ToolStripMenuItem("Alphabetical Categories And Properties".Localize());
                item6.Tag = PropertySorting.ByCategory;

                m_propertyOrganization.DropDownItems.Add(item1);
                m_propertyOrganization.DropDownItems.Add(item2);
                m_propertyOrganization.DropDownItems.Add(item3);
                m_propertyOrganization.DropDownItems.Add(item4);
                m_propertyOrganization.DropDownItems.Add(item5);
                m_propertyOrganization.DropDownItems.Add(item6);

                m_toolStrip.Items.Add(m_propertyOrganization);
                m_toolStrip.Items.Add(new ToolStripSeparator());
            }

            if ((mode & PropertyGridMode.DisableSearchControls) == 0)
            {
                var dropDownButton = new ToolStripDropDownButton();
                dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
                dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage);
                dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                dropDownButton.Name = "PropertyGridSearchButton";
                dropDownButton.Size = new System.Drawing.Size(29, 22);
                dropDownButton.Text = "Search".Localize("'Search' is a verb");

                m_patternTextBox = new ToolStripAutoFitTextBox();
                m_patternTextBox.Name = "patternTextBox";
                m_patternTextBox.MaximumWidth = 1080;
                m_patternTextBox.KeyUp += patternTextBox_KeyUp;
                m_patternTextBox.TextBox.PreviewKeyDown += patternTextBox_PreviewKeyDown;

                var clearSearchButton = new ToolStripButton();
                clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
                clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage);
                dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                clearSearchButton.Name = "PropertyGridClearSearchButton";
                clearSearchButton.Size = new System.Drawing.Size(29, 22);
                clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb");
                clearSearchButton.Click += clearSearchButton_Click;

                m_toolStrip.Items.AddRange(
                    new ToolStripItem[] { 
                    dropDownButton, 
                    m_patternTextBox,
                    clearSearchButton
                    });
            }

            if ((mode & PropertyGridMode.HideResetAllButton) == 0)
            {
                // Reset all button.
                var resetAllButton = new ToolStripButton();
                resetAllButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
                resetAllButton.Image = ResourceUtil.GetImage16(Resources.ResetImage);
                resetAllButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                resetAllButton.Name = "PropertyGridResetAllButton";
                resetAllButton.Size = new Size(29, 22);
                resetAllButton.ToolTipText = "Reset all properties".Localize();
                resetAllButton.Click += (sender, e) =>
                    {
                        ITransactionContext transaction = m_propertyGridView.EditingContext.As<ITransactionContext>();                        
                        transaction.DoTransaction(delegate
                        {
                            ResetAll();
                        },
                        "Reset All Properties".Localize("'Reset' is a verb and this is the name of a command"));
                    };
                m_toolStrip.Items.Add(resetAllButton);
            }

            if ((mode & PropertyGridMode.AllowEditingComposites) != 0)
            {
                m_navigateOut = new ToolStripButton(null, s_navigateOutImage, navigateOut_Click);
                m_navigateOut.Enabled = true;
                m_navigateOut.ToolTipText = "Navigate back to parent of selected object".Localize();

                m_toolStrip.Items.Add(m_navigateOut);

                m_propertyGridView.AllowEditingComposites = true;
            }

            SuspendLayout();

            if ((mode & PropertyGridMode.DisplayTooltips) != 0)
                m_propertyGridView.AllowTooltips = true;

            if ((mode & PropertyGridMode.DisplayDescriptions) == 0)
                Controls.Add(m_propertyGridView);
            else
            {
                m_splitContainer.Orientation = Orientation.Horizontal;
                m_splitContainer.BackColor = SystemColors.InactiveBorder;
                m_splitContainer.FixedPanel = FixedPanel.Panel2;
                m_splitContainer.SplitterWidth = 8;
                m_splitContainer.Dock = DockStyle.Fill;

                m_splitContainer.Panel1.Controls.Add(m_propertyGridView);

                m_descriptionTextBox = new DescriptionControl(this);
                m_descriptionTextBox.BackColor = SystemColors.Window;
                m_descriptionTextBox.Dock = DockStyle.Fill;

                m_splitContainer.Panel2.Controls.Add(m_descriptionTextBox);
                Controls.Add(m_splitContainer);

                m_propertyGridView.SelectedPropertyChanged += propertyGrid_SelectedRowChanged;
                m_descriptionTextBox.ClearDescription();
            }

            if (m_toolStrip.Items.Count > 0)
            {
                UpdateToolstripItems();
                Controls.Add(m_toolStrip);
            }
            else
            {
                m_toolStrip.Dispose();
                m_toolStrip = null;
            }

            Name = "PropertyGrid";
            Font = m_propertyGridView.Font;
            FontChanged += (sender, e) => m_propertyGridView.Font = Font;                
            ResumeLayout(false);
            PerformLayout();            
        }