/// <summary>
 /// Adds a new category to the list.
 /// </summary>
 /// <param name="categoryName">Name of the category.</param>
 /// <returns>Newly created control.</returns>
 public virtual CollapsibleCategory Add(String categoryName)
 {
     CollapsibleCategory cat = new CollapsibleCategory(this);
     cat.Text = categoryName;
     Add(cat);
     return cat;
 }
Beispiel #2
0
        /// <summary>
        /// Adds a new category to the list.
        /// </summary>
        /// <param name="categoryName">Name of the category.</param>
        /// <returns>Newly created control.</returns>
        public virtual CollapsibleCategory Add(String categoryName)
        {
            CollapsibleCategory cat = new CollapsibleCategory(this);

            cat.Text = categoryName;
            Add(cat);
            return(cat);
        }
Beispiel #3
0
 /// <summary>
 /// Adds a category to the list.
 /// </summary>
 /// <param name="category">Category control to add.</param>
 protected virtual void Add(CollapsibleCategory category)
 {
     category.Parent     = this;
     category.Dock       = Pos.Top;
     category.Margin     = new Margin(1, 0, 1, 1);
     category.Selected  += OnCategorySelected;
     category.Collapsed += OnCategoryCollapsed;
     // this relies on fact that category.m_List is set to its parent
 }
 /// <summary>
 /// Adds a category to the list.
 /// </summary>
 /// <param name="category">Category control to add.</param>
 protected virtual void Add(CollapsibleCategory category)
 {
     category.Parent = this;
     category.Dock = Pos.Top;
     category.Margin = new Margin(1, 0, 1, 1);
     category.Selected += OnCategorySelected;
     category.Collapsed += OnCategoryCollapsed;
     // this relies on fact that category.m_List is set to its parent
 }
Beispiel #5
0
        /// <summary>
        /// Adds a category to the list.
        /// </summary>
        /// <param name="category">Category control to add.</param>
        protected virtual void Add(CollapsibleCategory category)
        {
            category.Parent     = m_Items;
            category.Margin     = new Margin(1, 1, 1, 0);
            category.Selected  += OnCategorySelected;
            category.Collapsed += OnCategoryCollapsed;

            Invalidate();
        }
Beispiel #6
0
        /// <summary>
        /// Adds a new category to the list.
        /// </summary>
        /// <param name="categoryName">Name of the category.</param>
        /// <returns>Newly created control.</returns>
        public virtual CollapsibleCategory Add(string categoryName, string name = null, object userData = null)
        {
            CollapsibleCategory cat = new CollapsibleCategory(this);

            cat.Text     = categoryName;
            cat.Name     = name;
            cat.UserData = userData;
            Add(cat);
            return(cat);
        }
Beispiel #7
0
        /// <summary>
        /// Unselects all entries.
        /// </summary>
        public virtual void UnselectAll()
        {
            foreach (Base child in Children)
            {
                CollapsibleCategory cat = child as CollapsibleCategory;
                if (cat == null)
                {
                    continue;
                }

                cat.UnselectAll();
            }
        }
Beispiel #8
0
        /// <summary>
        /// Handler for category collapsed event.
        /// </summary>
        /// <param name="control">Event source: <see cref="CollapsibleCategory"/>.</param>
        protected virtual void OnCategoryCollapsed(Base control, EventArgs args)
        {
            CollapsibleCategory cat = control as CollapsibleCategory;

            if (cat == null)
            {
                return;
            }

            if (CategoryCollapsed != null)
            {
                CategoryCollapsed.Invoke(control, EventArgs.Empty);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Handler for ItemSelected event.
        /// </summary>
        /// <param name="control">Event source: <see cref="CollapsibleList"/>.</param>
        protected virtual void OnCategorySelected(Base control, EventArgs args)
        {
            CollapsibleCategory cat = control as CollapsibleCategory;

            if (cat == null)
            {
                return;
            }

            if (ItemSelected != null)
            {
                ItemSelected.Invoke(this, new ItemSelectedEventArgs(cat));
            }
        }
Beispiel #10
0
        /// <summary>
        /// Handler for ItemSelected event.
        /// </summary>
        /// <param name="control">Event source: <see cref="CollapsibleList"/>.</param>
        protected virtual void OnCategorySelected(Base control)
        {
            CollapsibleCategory cat = control as CollapsibleCategory;

            if (cat == null)
            {
                return;
            }

            if (ItemSelected != null)
            {
                ItemSelected.Invoke(this);
            }
        }
Beispiel #11
0
        /// <summary>
        /// Handler for category collapsed event.
        /// </summary>
        /// <param name="control">Event source: <see cref="CollapsibleCategory"/>.</param>
        protected virtual void OnCategoryCollapsed(ControlBase control)
        {
            CollapsibleCategory cat = control as CollapsibleCategory;

            if (cat == null)
            {
                return;
            }

            if (CategoryCollapsed != null)
            {
                CategoryCollapsed.Invoke(control);
            }
        }
Beispiel #12
0
        // todo: iterator, make this as function? check if works

        /// <summary>
        /// Selected entry.
        /// </summary>
        public Button GetSelectedButton()
        {
            foreach (Base child in Children)
            {
                CollapsibleCategory cat = child as CollapsibleCategory;
                if (cat == null)
                {
                    continue;
                }

                Button button = cat.GetSelectedButton();

                if (button != null)
                {
                    return(button);
                }
            }

            return(null);
        }
Beispiel #13
0
 public void RegisterUnitTest(String name, CollapsibleCategory cat, GUnit test)
 {
     Control.Button btn = cat.Add(name);
     test.Dock = Pos.Fill;
     test.Hide();
     test.UnitTest = this;
     btn.UserData = test;
     btn.Clicked += OnCategorySelect;
 }