GetPaletteForMode() 공개 정적인 메소드

Gets the implementation for the requested palette mode.
public static GetPaletteForMode ( PaletteMode mode ) : IPalette
mode PaletteMode Requested palette mode.
리턴 IPalette
        private void RefreshPalette()
        {
            if (m_PaletteMode == PaletteMode.Global)
            {
                m_Palette = KryptonManager.CurrentGlobalPalette;
            }
            else
            {
                m_Palette = KryptonManager.GetPaletteForMode(m_PaletteMode);
            }

            m_Renderer = m_Palette.GetRenderer();

            m_ViewLayoutContext = new ViewLayoutContext(g_ViewLayoutContextControl, m_Renderer);
            g_TabFontBold       = new Font(m_Palette.GetContentShortTextFont(PaletteContentStyle.ButtonNavigatorStack, PaletteState.Normal), FontStyle.Bold);
            g_TabFontRegular    = new Font(g_TabFontBold, FontStyle.Regular);

            m_PaletteRedirect             = new PaletteRedirect(m_Palette);
            m_PaletteTabControlBackground = new PaletteBackInheritRedirect(m_PaletteRedirect);
            m_PaletteTabPageBorder        = new PaletteBorderInheritRedirect(m_PaletteRedirect);
            m_PaletteTabButtonBackground  = new PaletteBackInheritRedirect(m_PaletteRedirect);
            m_PaletteTabButtonBorder      = new PaletteBorderInheritRedirect(m_PaletteRedirect);

            m_PaletteTabControlBackground.Style = PaletteBackStyle.PanelClient;
            m_PaletteTabPageBorder.Style        = PaletteBorderStyle.ButtonNavigatorStack;
            m_PaletteTabButtonBackground.Style  = PaletteBackStyle.ButtonNavigatorStack;
            m_PaletteTabButtonBorder.Style      = PaletteBorderStyle.ButtonNavigatorMini;

            m_TabBrush = new SolidBrush(m_Palette.GetContentShortTextColor1(PaletteContentStyle.ButtonNavigatorStack, PaletteState.Normal));

            Refresh();
        }
예제 #2
0
        /// <summary>
        ///  Initialize a new instance of the VisualContextMenu class.
        /// </summary>
        /// <param name="provider">Original source of provider details</param>
        /// <param name="items">Enabled state of the context menu.</param>
        /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param>
        public VisualContextMenu(IContextMenuProvider provider,
            KryptonContextMenuCollection items,
            bool keyboardActivated)
            : base(true)
        {
            _redirector = provider.ProviderRedirector;

            // Create the view manager instance with root element
            ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull());

            // Set the initial resolved palette to the appropriate setting
            if (provider.ProviderPalette != null)
                SetPalette(provider.ProviderPalette);
            else
                SetPalette(KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode));

            // Set of context menu columns
            _viewColumns = new ViewLayoutStack(true);

            // Create provider instance
            _provider = new ContextMenuProvider(provider, (ViewContextMenuManager)ViewManager, _viewColumns, NeedPaintDelegate);
            _provider.Closing += new CancelEventHandler(OnProviderClosing);
            _provider.Close += new EventHandler<CloseReasonEventArgs>(OnProviderClose);
            _provider.Dispose += new EventHandler(OnProviderClose);

            Construct(items, keyboardActivated);
        }
        /// <summary>
        ///  Initialize a new instance of the VisualContextMenu class.
        /// </summary>
        /// <param name="contextMenu">Originating context menu instance.</param>
        /// <param name="palette">Local palette setting to use initially.</param>
        /// <param name="paletteMode">Palette mode setting to use initially.</param>
        /// <param name="redirector">Redirector used for obtaining palette values.</param>
        /// <param name="redirectorImages">Redirector used for obtaining images.</param>
        /// <param name="items">Collection of context menu items to be displayed.</param>
        /// <param name="enabled">Enabled state of the context menu.</param>
        /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param>
        public VisualContextMenu(KryptonContextMenu contextMenu,
                                 IPalette palette,
                                 PaletteMode paletteMode,
                                 PaletteRedirect redirector,
                                 PaletteRedirectContextMenu redirectorImages,
                                 KryptonContextMenuCollection items,
                                 bool enabled,
                                 bool keyboardActivated)
            : base(true)
        {
            _contextMenu = contextMenu;
            Redirector   = redirector;

            // Create the view manager instance with root element
            ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull());

            // Set the initial resolved palette to the appropriate setting
            SetPalette(palette ?? KryptonManager.GetPaletteForMode(paletteMode));

            // Set of context menu columns
            _viewColumns = new ViewLayoutStack(true);

            // Create provider instance
            _provider = new ContextMenuProvider(contextMenu, (ViewContextMenuManager)ViewManager, _viewColumns,
                                                palette, paletteMode, redirector, redirectorImages,
                                                NeedPaintDelegate, enabled);

            _provider.Closing += OnProviderClosing;
            _provider.Close   += OnProviderClose;
            _provider.Dispose += OnProviderClose;

            Construct(items, keyboardActivated);
        }
예제 #4
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutMenuItemSelect class.
        /// </summary>
        /// <param name="itemSelect">Reference to owning instance.</param>
        /// <param name="provider">Provider of context menu information.</param>
        public ViewLayoutMenuItemSelect(KryptonContextMenuImageSelect itemSelect,
                                        IContextMenuProvider provider)
        {
            Debug.Assert(itemSelect != null);
            Debug.Assert(provider != null);

            // Store incoming references
            _itemSelect = itemSelect;
            _provider   = provider;

            _itemSelect.TrackingIndex = -1;
            _enabled     = provider.ProviderEnabled;
            _viewManager = provider.ProviderViewManager;

            // Cache the values to use when running
            _imageList       = _itemSelect.ImageList;
            _imageIndexStart = _itemSelect.ImageIndexStart;
            _imageIndexEnd   = _itemSelect.ImageIndexEnd;
            _lineItems       = _itemSelect.LineItems;
            _needPaint       = provider.ProviderNeedPaintDelegate;
            _padding         = _itemSelect.Padding;
            _imageCount      = (_imageList == null ? 0 : _imageList.Images.Count);

            // Limit check the start and end values
            _imageIndexStart = Math.Max(0, _imageIndexStart);
            _imageIndexEnd   = Math.Min(_imageIndexEnd, _imageCount - 1);
            _imageIndexCount = Math.Max(0, (_imageIndexEnd - _imageIndexStart) + 1);

            IPalette palette = provider.ProviderPalette;

            if (palette == null)
            {
                palette = KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode);
            }

            // Create triple that can be used by the draw button
            _triple = new PaletteTripleToPalette(palette,
                                                 PaletteBackStyle.ButtonLowProfile,
                                                 PaletteBorderStyle.ButtonLowProfile,
                                                 PaletteContentStyle.ButtonLowProfile);

            // Update with current button style
            _triple.SetStyles(itemSelect.ButtonStyle);
        }
예제 #5
0
        private void RefreshPalette()
        {
            if (m_PaletteMode == PaletteMode.Global)
            {
                m_Palette = KryptonManager.CurrentGlobalPalette;
            }
            else
            {
                m_Palette = KryptonManager.GetPaletteForMode(m_PaletteMode);
            }

            m_Renderer        = m_Palette.GetRenderer();
            m_PaletteRedirect = new PaletteRedirect(m_Palette);

            m_PaletteTabPageBackground       = new PaletteBackInheritRedirect(m_PaletteRedirect);
            m_PaletteTabPageBackground.Style = PaletteBackStyle.PanelClient;

            Refresh();
        }