Esempio n. 1
0
        internal void GenerateView(IContextMenuProvider provider,
                                   KryptonContextMenuItems items,
                                   object parent,
                                   ViewLayoutStack columns,
                                   bool standardStyle,
                                   bool imageColumn)
        {
            // Create the initial column
            ViewBase column = AddColumn(provider, items, columns, standardStyle, imageColumn);

            // Process each item in the collection in turn
            foreach (KryptonContextMenuItemBase item in this)
            {
                if (item.Visible)
                {
                    // Special handling of separator items
                    if (item is KryptonContextMenuSeparator)
                    {
                        // Cast to correct type
                        KryptonContextMenuSeparator separator = (KryptonContextMenuSeparator)item;

                        // If vertical break....
                        if (!separator.Horizontal)
                        {
                            // Add separator as next column view element
                            columns.Add(separator.GenerateView(provider, this, columns, standardStyle, imageColumn));

                            // Start new column for subsequent child items
                            column = AddColumn(provider, items, columns, standardStyle, imageColumn);
                        }
                        else
                        {
                            // Add separator view into the current column
                            column.Add(separator.GenerateView(provider, this, columns, standardStyle, imageColumn));
                        }
                    }
                    else
                    {
                        // All other items we just ask them for the view to add
                        column.Add(item.GenerateView(provider, this, columns, standardStyle, imageColumn));
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuSeparator class.
        /// </summary>
        /// <param name="separator">Reference to owning separator entry.</param>
        /// <param name="palette">Palette for obtaining drawing values.</param>
        public ViewDrawMenuSeparator(KryptonContextMenuSeparator separator,
                                     PaletteDoubleRedirect palette)
            : base(separator.StateNormal.Back, separator.StateNormal.Border)
        {
            // Draw the separator by default
            _draw = true;

            // Give the separator object the redirector to use when inheriting values
            separator.SetPaletteRedirect(palette);

            if (separator.Horizontal)
            {
                Orientation = VisualOrientation.Top;
            }
            else
            {
                Orientation = VisualOrientation.Left;
            }

            // We need to be big enough to contain 1 pixel square spacer
            Add(new ViewLayoutSeparator(1));
        }