Beispiel #1
0
        /// <summary>
        /// Removes a band from te collection of bands
        /// </summary>
        /// <param name="band">The band to remove</param>
        public void RemoveBand(NaviBand band)
        {
            if (band.Button != null)
            {
                band.Button.Click   -= new EventHandler(button_Click);
                band.VisibleChanged -= new EventHandler(band_VisibleChanged);
            }

            if (Controls.Contains(band.Button))
            {
                Controls.Remove(band.Button);
            }
            if (buttons.Contains(band.Button))
            {
                buttons.Remove(band.Button);
            }

            if (Controls.Contains(band))
            {
                Controls.Remove(band);
            }
            if (bands.Contains(band))
            {
                bands.Remove(band);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Changes the currently active band to a new band
        /// </summary>
        /// <param name="newBand">The new band.</param>
        public void SetActiveBand(NaviBand newBand)
        {
            NaviBandEventArgs e = new NaviBandEventArgs(newBand);

            OnActiveBandChanging(e);
            if (!e.Canceled)
            {
                if (activeBand != newBand)
                {
                    foreach (NaviBand band in bands)
                    {
                        if ((band != newBand) && (band.Button != null))
                        {
                            band.Button.Active = false;
                        }
                    }
                }
                if ((newBand != null) && (newBand.Button != null))
                {
                    newBand.Button.Active = true;
                }

                activeBand = newBand;

                OnLayout(new LayoutEventArgs(this, "ActiveBand"));
                OnActiveBandChanged(new EventArgs());
                Invalidate();
            }
            else
            {
                // Lost focus but did not recieve an mouse leave event. So force redraw
                newBand.Button.Active = false;
            }
        }
        /// <summary>
        /// Adds the band verb clicked.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        void AddBandVerbClicked(object sender, EventArgs e)
        {
            NaviBand band = host.CreateComponent(typeof(NaviBand)) as NaviBand;

            if (band != null)
            {
                designingControl.AddBand(band);
            }
        }
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The <see cref="T:System.ComponentModel.IComponent" /> to associate with the designer.</param>
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            if (component is NaviBand)
            {
                designingComponent = (NaviBand)component;
            }

            EnableDesignMode(designingComponent.ClientArea, "ClientArea");
        }
Beispiel #5
0
        /// <summary>
        /// Relayouts the control
        /// </summary>
        /// <param name="sender">The band which triggered this event</param>
        /// <param name="e">Additional event info</param>
        void band_VisibleChanged(object sender, EventArgs e)
        {
            NaviBand band = sender as NaviBand;

            if ((band != null) && (band.Button != null))
            {
                band.Button.Visible = band.Visible;
            }
            OnLayout(new LayoutEventArgs(this, "Band.Visible"));
            Invalidate();
        }
Beispiel #6
0
        /// <summary>
        /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />, as shown in the following table.Value Meaning Less than zero <paramref name="x" /> is less than <paramref name="y" />. Zero <paramref name="x" /> equals <paramref name="y" />. Greater than zero <paramref name="x" /> is greater than <paramref name="y" />.</returns>
        /// <exception cref="System.ArgumentException">Both of the argument should be of type NaviBand</exception>
        public int Compare(object x, object y)
        {
            if (!(x is NaviBand) || !(y is NaviBand))
            {
                throw new ArgumentException("Both of the argument should be of type NaviBand");
            }

            NaviBand bandx = (NaviBand)x;
            NaviBand bandy = (NaviBand)y;

            return(bandx.OriginalOrder.CompareTo(bandy.OriginalOrder));
        }
Beispiel #7
0
        /// <summary>
        /// Adds a new band to the collection of bands
        /// </summary>
        /// <param name="band">The new band</param>
        internal void AddBand(NaviBand band)
        {
            if (!Controls.Contains(band))
            {
                Controls.Add(band);
            }

            if (!bands.Contains(band))
            {
                bands.SilentAdd(band);
            }

            AddButton(band);
            band.VisibleChanged += new EventHandler(band_VisibleChanged);

            band.LayoutStyle        = LayoutStyle;
            band.Button.LayoutStyle = LayoutStyle;

            OnBandAdded(new ControlEventArgs(band));
        }
Beispiel #8
0
        /// <summary>
        /// Adds the band button to the collection of controls
        /// </summary>
        /// <param name="band">The band</param>
        private void AddButton(NaviBand band)
        {
            if (band.Button == null)
            {
                NaviButton button = new NaviButton();

                button.SmallImage = band.SmallImage;
                button.LargeImage = band.LargeImage;
                button.Text       = band.Text;
                button.Click     += new EventHandler(button_Click);

                band.Button = button;
            }
            if (!Controls.Contains(band.Button))
            {
                Controls.Add(band.Button);
            }
            if (!buttons.Contains(band.Button))
            {
                buttons.Add(band.Button);
            }
        }
 /// <summary>
 /// Initializes a new instance of the NaviBandEventArgs class
 /// </summary>
 /// <param name="newActiveBand">The new active band.</param>
 public NaviBandEventArgs(NaviBand newActiveBand)
     : base()
 {
     this.newActiveBand = newActiveBand;
 }